OLive/.lintrunner.toml

292 строки
4.9 KiB
TOML

# Configuration for lintrunner https://github.com/suo/lintrunner
# You can install the dependencies and initialize with
#
# ```sh
# pip install lintrunner lintrunner-adapters
# lintrunner init
# ```
#
# This will install lintrunner on your system and download all the necessary
# dependencies to run linters locally.
# If you want to see what lintrunner init will install, run
# `lintrunner init --dry-run`.
#
# To lint local changes:
#
# ```bash
# lintrunner
# ```
#
# To lint all files:
#
# ```bash
# lintrunner --all-files
# ```
#
# To format files:
#
# ```bash
# lintrunner f --all-files
# ```
#
# To read more about lintrunner, see [wiki](https://github.com/pytorch/pytorch/wiki/lintrunner).
# To update an existing linting rule or create a new one, modify this file or create a
# new adapter following examples in https://github.com/justinchuby/lintrunner-adapters.
merge_base_with = 'origin/main'
[[linter]]
code = 'RUFF'
include_patterns = [
'**/*.py',
'**/*.pyi'
]
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'ruff_linter',
'--config=pyproject.toml',
'@{{PATHSFILE}}'
]
init_command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'pip_init',
'--dry-run={{DRYRUN}}',
'--requirement=requirements-dev.txt'
]
is_formatter = true
[[linter]]
code = 'BLACK-ISORT'
include_patterns = [
'**/*.py'
]
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'black_isort_linter',
'--',
'@{{PATHSFILE}}'
]
init_command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'pip_init',
'--dry-run={{DRYRUN}}',
'--requirement=requirements-dev.txt'
]
is_formatter = true
[[linter]]
code = 'PYLINT'
include_patterns = [
'**/*.py'
]
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'pylint_linter',
'--rcfile=pyproject.toml',
'--',
'@{{PATHSFILE}}'
]
init_command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'pip_init',
'--dry-run={{DRYRUN}}',
'--requirement=requirements-dev.txt'
]
[[linter]]
code = 'MYPY'
include_patterns = [
'**/*.py',
'**/*.pyi'
]
exclude_patterns = [
'examples/pytorch/*.py'
]
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'mypy_linter',
'--config=pyproject.toml',
'--show-notes',
'--show-disable',
'--',
'@{{PATHSFILE}}'
]
init_command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'pip_init',
'--dry-run={{DRYRUN}}',
'mypy==1.0.0'
]
[[linter]]
code = 'NOQA'
include_patterns = ['**/*.py', '**/*.pyi']
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'grep_linter',
'--pattern=# noqa([^:]|$)',
'--linter-name=NOQA',
'--error-name=unqualified noqa',
"""--error-description=\
This line has an unqualified `noqa`; \
please convert it to `noqa: XXXX`\
""",
'--',
'@{{PATHSFILE}}'
]
[[linter]]
code = 'SPACES'
include_patterns = ['**']
exclude_patterns = [
'**/*.json'
]
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'grep_linter',
'--pattern=[[:blank:]]$',
'--linter-name=SPACES',
'--error-name=trailing spaces',
'--replace-pattern=s/[[:blank:]]+$//',
"""--error-description=\
This line has trailing spaces; please remove them.\
""",
'--',
'@{{PATHSFILE}}'
]
[[linter]]
code = 'TABS'
include_patterns = ['**']
exclude_patterns = [
'.lintrunner.toml',
'**/Makefile',
'**/*.bat',
'**/*.json'
]
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'grep_linter',
# @lint-ignore TXT2
'--pattern= ',
'--linter-name=TABS',
'--error-name=saw some tabs',
'--replace-pattern=s/\t/ /',
"""--error-description=\
This line has tabs; please replace them with spaces.\
""",
'--',
'@{{PATHSFILE}}'
]
[[linter]]
code = 'TOML-SORT'
is_formatter = true
include_patterns = ['**/*.toml']
exclude_patterns = []
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'toml_sort_linter',
'@{{PATHSFILE}}'
]
init_command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'pip_init',
'--dry-run={{DRYRUN}}',
'toml-sort==0.23.1'
]
[[linter]]
code = 'EDITORCONFIG-CHECKER'
include_patterns = ['**']
exclude_patterns = [
'**/*.ipynb',
'**/*.json',
'**/Makefile'
]
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'editorconfig_checker_linter',
'--',
'@{{PATHSFILE}}'
]
init_command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'pip_init',
'--dry-run={{DRYRUN}}',
'--requirement=requirements-dev.txt'
]
[[linter]]
code = 'REQUIREMENTS-TXT'
is_formatter = true
include_patterns = ['**/requirements*.txt']
exclude_patterns = []
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'requirements_txt_linter',
'--',
'@{{PATHSFILE}}'
]
[[linter]]
code = "FORMAT-JSON"
is_formatter = true
include_patterns = ['**/*.json']
command = [
'python',
'scripts/format_json.py',
'--linter-mode',
'--indent=4',
'--max-line-length=120',
'@{{PATHSFILE}}'
]