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 starts with root_path (prefix match)
-
It does NOT start with ignored_path (when ignored_path is set)
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 path.start_with?(root_path) if ignored_path.is_a?(String) && !ignored_path.empty? return false if path.start_with?(ignored_path) end true end |