Sha256: d9240e3b8b45711df2631324c944f6a4b0457ae2eea237e3d6415cf8cf849002
Contents?: true
Size: 713 Bytes
Versions: 4
Compression:
Stored size: 713 Bytes
Contents
require "pathname" module CC module Analyzer module IssueValidations class RelativePathValidation < Validation def valid? path && !path.start_with?("/") && relative_to?(MountedPath.code.container_path) end def message "Path must be relative to the project directory" end private def relative_to?(directory) expanded_base = Pathname.new(directory).expand_path.to_s expanded_path = Pathname.new(path).expand_path.to_s expanded_path.start_with?(expanded_base) end def path object.fetch("location", {})["path"] end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems