From 96558b53b89fb8a72d087db5d55b6ce64848953d Mon Sep 17 00:00:00 2001 From: Taus Date: Thu, 15 May 2025 14:53:15 +0000 Subject: [PATCH] Python: Update test The second test case now sets the `paths-ignore` setting in the config file in order to skip files in hidden directories. --- python/extractor/cli-integration-test/hidden-files/config.yml | 3 +++ .../cli-integration-test/hidden-files/query-default.expected | 1 + .../.hidden_dir/internal_non_hidden/another_non_hidden.py | 0 python/extractor/cli-integration-test/hidden-files/test.sh | 4 ++-- 4 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 python/extractor/cli-integration-test/hidden-files/config.yml create mode 100644 python/extractor/cli-integration-test/hidden-files/repo_dir/.hidden_dir/internal_non_hidden/another_non_hidden.py diff --git a/python/extractor/cli-integration-test/hidden-files/config.yml b/python/extractor/cli-integration-test/hidden-files/config.yml new file mode 100644 index 00000000000..69d94597d95 --- /dev/null +++ b/python/extractor/cli-integration-test/hidden-files/config.yml @@ -0,0 +1,3 @@ +name: Test Config +paths-ignore: + - "**/.*/**" diff --git a/python/extractor/cli-integration-test/hidden-files/query-default.expected b/python/extractor/cli-integration-test/hidden-files/query-default.expected index cc92af624b3..72d34a1ab0b 100644 --- a/python/extractor/cli-integration-test/hidden-files/query-default.expected +++ b/python/extractor/cli-integration-test/hidden-files/query-default.expected @@ -1,5 +1,6 @@ | name | +-------------------------------+ | .hidden_file.py | +| another_non_hidden.py | | foo.py | | visible_file_in_hidden_dir.py | diff --git a/python/extractor/cli-integration-test/hidden-files/repo_dir/.hidden_dir/internal_non_hidden/another_non_hidden.py b/python/extractor/cli-integration-test/hidden-files/repo_dir/.hidden_dir/internal_non_hidden/another_non_hidden.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/python/extractor/cli-integration-test/hidden-files/test.sh b/python/extractor/cli-integration-test/hidden-files/test.sh index 77cb12664af..45485985adb 100755 --- a/python/extractor/cli-integration-test/hidden-files/test.sh +++ b/python/extractor/cli-integration-test/hidden-files/test.sh @@ -16,8 +16,8 @@ $CODEQL database create db --language python --source-root repo_dir/ $CODEQL query run --database db query.ql > query-default.actual diff query-default.expected query-default.actual -# Test 2: Setting the relevant extractor option to true skips files in hidden directories -$CODEQL database create db-skipped --language python --source-root repo_dir/ --extractor-option python.skip_hidden_directories=true +# Test 2: The default behavior can be overridden by setting `paths-ignore` in the config file +$CODEQL database create db-skipped --language python --source-root repo_dir/ --codescanning-config=config.yml $CODEQL query run --database db-skipped query.ql > query-skipped.actual diff query-skipped.expected query-skipped.actual