Module: Datadog::CI::SourceCode::PathFilter
- Defined in:
- lib/datadog/ci/source_code/path_filter.rb
Overview
PathFilter determines whether a file path should be included in test impact analysis.
A path is included if:
- It is equal to root_path or located below it
- It is NOT equal to ignored_path or located below it
This module mirrors the C implementation in datadog_common.c (dd_ci_is_path_included).
Class Method Summary collapse
-
.included?(path, root_path, ignored_path = nil) ⇒ Boolean
Check if a file path should be included in analysis.
Class Method Details
.included?(path, root_path, ignored_path = nil) ⇒ Boolean
Check if a file path should be included in analysis.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/datadog/ci/source_code/path_filter.rb', line 20 def self.included?(path, root_path, ignored_path = nil) return false unless path.is_a?(String) && root_path.is_a?(String) return false unless directory_prefix?(path, root_path) if ignored_path.is_a?(String) && !ignored_path.empty? return false if directory_prefix?(path, ignored_path) end true end |