class CC::Analyzer::IssueValidations::RelativePathValidation
Constants
- BUILDER_CODE_PATH
Public Instance Methods
message()
click to toggle source
# File lib/cc/analyzer/issue_validations/relative_path_validation.rb, line 17 def message "Path must be relative to the project directory" end
valid?()
click to toggle source
# File lib/cc/analyzer/issue_validations/relative_path_validation.rb, line 9 def valid? path && !path.start_with?("/") && ( relative_to?(MountedPath.code.container_path) || relative_to?(BUILDER_CODE_PATH) ) end
Private Instance Methods
relative_to?(directory)
click to toggle source
# File lib/cc/analyzer/issue_validations/relative_path_validation.rb, line 23 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