regex-lint
Lint your code using regex patterns, e.g. to check for copyright headers.
To activate this with the lint
goal, you must set [regex-lint].config
.
Unlike other linters, this can run on files not owned by targets, such as BUILD files.
Backend: pants.backend.project_info
Config section: [regex-lint]
Basic options
default:
False
If true, don't use regex-lint when running pants lint
.
default:
{}
Config schema is as follows:
```
{
'required_matches': {
'path_pattern1': [content_pattern1, content_pattern2],
'path_pattern2': [content_pattern1, content_pattern3],
...
},
'path_patterns': [
{
'name': path_pattern1',
'pattern': <path regex pattern>,
'inverted': True|False (defaults to False),
'content_encoding': <encoding> (defaults to utf8)
},
...
],
'content_patterns': [
{
'name': 'content_pattern1',
'pattern': <content regex pattern>,
'inverted': True|False (defaults to False)
}
...
]
}
```
Meaning: if a file matches some path pattern, its content must match all the corresponding content patterns.
It's often helpful to load this config from a JSON or YAML file. To do that, set [regex-lint].config = '@path/to/config.yaml'
, for example.
one of:
default:
none, summary, nonmatching, names, all
default:
nonmatching
How much detail to include in the result.
Advanced options
None
Deprecated options
None
Updated about 1 month ago