Sha256: 4ea91a8302dd45fbdb54e86f3788f9909fd3bc4335ef31c5a985d603147ff64d
Contents?: true
Size: 636 Bytes
Versions: 52
Compression:
Stored size: 636 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 end end end end
Version data entries
52 entries across 52 versions & 1 rubygems