#7942 `regex-lint` (formerly `validate`) should allow path blocklisting
Issue created by
jsirois
Right now, content checks are restricted to path sets built up from path allow lists. Often it would be more robust to apply a content check to all files of a certain type save some small handfull. For those cases adding to a blocklist is both more concise and robust than enumerating allow listed directories.
Concretely, this sort of config today:
x-path-pattern: &path-pattern
content_encoding: utf8
path_patterns:
# We use several python path patterns here to avoid src/python/kythe which contains 3rdparty code
# that we don't have license over (python proto stubs for kythe-licensed protobuf files).
python_prod:
<<: *path-pattern
pattern: prod/.+(?<!
init)\.py$
python_source:
<<: *path-pattern
pattern: src/python/toolchain/.+(?<!
init)\.py$
python_test:
<<: *path-pattern
pattern: test/.+(?<!
init)\.py$
content_patterns:
python_header:
# NB: We match an optional shebang line here.
pattern: |-
^(#![^\n]+
)?# Copyright © 20\d\d Toolchain Labs, Inc\. All rights reserved\.
#
# Toolchain Labs, Inc\. CONFIDENTIAL
#
# This file includes unpublished proprietary source code of Toolchain Labs, Inc\.
# The copyright notice above does not evidence any actual or intended publication of such source code\.
# Disclosure of this source code or any related proprietary information is strictly prohibited without
# the express written permission of Toolchain Labs, Inc\.
required_matches:
python_prod:
- python_header
python_source:
- python_header
python_test:
- python_header
Could be written as follows with blacklists:
x-path-pattern: &path-pattern
content_encoding: utf8
path_patterns:
# We don't have license over the python files under src/python/kythe (python proto stubs for
# kythe-licensed protobuf files).
python_source:
<<: *path-pattern
pattern: (?<!
init)\.py$
exclude: src/python/kythe/.+\.py$
content_patterns:
python_header:
# NB: We match an optional shebang line here.
pattern: |-
^(#![^\n]+
)?# Copyright © 20\d\d Toolchain Labs, Inc\. All rights reserved\.
#
# Toolchain Labs, Inc\. CONFIDENTIAL
#
# This file includes unpublished proprietary source code of Toolchain Labs, Inc\.
# The copyright notice above does not evidence any actual or intended publication of such source code\.
# Disclosure of this source code or any related proprietary information is strictly prohibited without
# the express written permission of Toolchain Labs, Inc\.
required_matches:
python_source:
- python_header
pantsbuild/pants