mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
[lint] small updates to .lintrunner.toml (#67942)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/67942 - Change "name" to "code" for consistency with linttool and LintMessage format. - Change "args" and "init_args" to "command" and "init_command" for consistency with internal representation. Test Plan: Imported from OSS Reviewed By: H-Huang Differential Revision: D32250606 Pulled By: suo fbshipit-source-id: 557fef731bab9adca7ab1e7cc41b996956076b05
This commit is contained in:
parent
d201102d36
commit
8e2528132b
|
|
@ -1,5 +1,5 @@
|
|||
[[linter]]
|
||||
name = 'FLAKE8'
|
||||
code = 'FLAKE8'
|
||||
include_patterns = ['**/*.py']
|
||||
exclude_patterns = [
|
||||
'.git/**',
|
||||
|
|
@ -18,14 +18,14 @@ exclude_patterns = [
|
|||
'venv/**',
|
||||
'**/*.pyi',
|
||||
]
|
||||
args = [
|
||||
command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/flake8_linter.py',
|
||||
'--binary=flake8',
|
||||
'--',
|
||||
'@{{PATHSFILE}}'
|
||||
]
|
||||
init_args = [
|
||||
init_command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/pip_init.py',
|
||||
'--dry-run={{DRYRUN}}',
|
||||
|
|
@ -41,7 +41,7 @@ init_args = [
|
|||
|
||||
|
||||
[[linter]]
|
||||
name = 'CLANGFORMAT'
|
||||
code = 'CLANGFORMAT'
|
||||
include_patterns = [
|
||||
'c10/**/*.h',
|
||||
'c10/**/*.cpp',
|
||||
|
|
@ -54,8 +54,7 @@ include_patterns = [
|
|||
'test/cpp/tensorexpr/**/*.h',
|
||||
'test/cpp/tensorexpr/**/*.cpp',
|
||||
]
|
||||
exclude_patterns = []
|
||||
args = [
|
||||
command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/clangformat_linter.py',
|
||||
'--binary=clang-format',
|
||||
|
|
@ -64,7 +63,7 @@ args = [
|
|||
]
|
||||
|
||||
[[linter]]
|
||||
name = 'MYPY'
|
||||
code = 'MYPY'
|
||||
include_patterns = [
|
||||
'torch/**/*.py',
|
||||
'caffe2/**/*.py',
|
||||
|
|
@ -84,7 +83,7 @@ exclude_patterns = [
|
|||
'torch/csrc/**',
|
||||
'torch/distributed/elastic/agent/server/api.py',
|
||||
]
|
||||
args = [
|
||||
command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/mypy_linter.py',
|
||||
'--binary=mypy',
|
||||
|
|
@ -92,7 +91,7 @@ args = [
|
|||
'--',
|
||||
'@{{PATHSFILE}}'
|
||||
]
|
||||
init_args = [
|
||||
init_command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/pip_init.py',
|
||||
'--dry-run={{DRYRUN}}',
|
||||
|
|
@ -104,7 +103,7 @@ init_args = [
|
|||
]
|
||||
|
||||
[[linter]]
|
||||
name = 'MYPY_STRICT'
|
||||
code = 'MYPYSTRICT'
|
||||
include_patterns = [
|
||||
'.github/**/*.py',
|
||||
'benchmarks/instruction_counts/**/*.py',
|
||||
|
|
@ -114,8 +113,7 @@ include_patterns = [
|
|||
'torch/utils/benchmark/utils/timer.py',
|
||||
'torch/utils/benchmark/utils/valgrind_wrapper/**/*.py',
|
||||
]
|
||||
exclude_patterns = []
|
||||
args = [
|
||||
command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/mypy_linter.py',
|
||||
'--binary=mypy',
|
||||
|
|
@ -125,17 +123,23 @@ args = [
|
|||
]
|
||||
|
||||
[[linter]]
|
||||
name = 'CLANGTIDY'
|
||||
include_patterns = ['**/*.cpp']
|
||||
exclude_patterns = []
|
||||
init_args = [
|
||||
code = 'CLANGTIDY'
|
||||
include_patterns = [
|
||||
'**/*.cpp',
|
||||
'torch/csrc/fx/**/*.cpp',
|
||||
'torch/csrc/utils/**/*.cpp',
|
||||
'torch/csrc/generic/**/*.cpp',
|
||||
'torch/csrc/deploy/**/*.cpp',
|
||||
'torch/csrc/tensor/**/*.cpp',
|
||||
]
|
||||
init_command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/clangtidy_init.py',
|
||||
'--dry_run={{DRYRUN}}',
|
||||
'--output_dir=.clang-tidy-bin',
|
||||
'--output_name=clang-tidy',
|
||||
]
|
||||
args = [
|
||||
command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/clangtidy_linter.py',
|
||||
'--binary=.clang-tidy-bin/clang-tidy',
|
||||
|
|
@ -145,10 +149,10 @@ args = [
|
|||
]
|
||||
|
||||
[[linter]]
|
||||
name = 'TYPEIGNORE'
|
||||
code = 'TYPEIGNORE'
|
||||
include_patterns = ['**/*.py', '**/*.pyi']
|
||||
exclude_patterns = ['test/test_jit.py']
|
||||
args = [
|
||||
command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/grep_linter.py',
|
||||
'--pattern=# type:\s*ignore(?!\[)',
|
||||
|
|
@ -163,10 +167,10 @@ args = [
|
|||
]
|
||||
|
||||
[[linter]]
|
||||
name = 'NOQA'
|
||||
code = 'NOQA'
|
||||
include_patterns = ['**/*.py', '**/*.pyi']
|
||||
exclude_patterns = ['caffe2/**']
|
||||
args = [
|
||||
command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/grep_linter.py',
|
||||
'--pattern=# type:\s*ignore(?!\[)',
|
||||
|
|
@ -181,35 +185,33 @@ args = [
|
|||
]
|
||||
|
||||
[[linter]]
|
||||
name = 'CIRCLECI'
|
||||
code = 'CIRCLECI'
|
||||
include_patterns=['.circleci/**']
|
||||
args = [
|
||||
command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/circleci_linter.py',
|
||||
'--regen-script-working-dir=.circleci',
|
||||
'--config-yml=.circleci/config.yml',
|
||||
'--regen-script=generate_config_yml.py',
|
||||
]
|
||||
bypass_matched_file_filter = true
|
||||
|
||||
[[linter]]
|
||||
name = 'NATIVEFUNCTIONS'
|
||||
code = 'NATIVEFUNCTIONS'
|
||||
include_patterns=['aten/src/ATen/native/native_functions.yaml']
|
||||
args = [
|
||||
command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/nativefunctions_linter.py',
|
||||
'--native-functions-yml=aten/src/ATen/native/native_functions.yaml',
|
||||
]
|
||||
init_args = [
|
||||
init_command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/pip_init.py',
|
||||
'--dry-run={{DRYRUN}}',
|
||||
'ruamel.yaml==0.17.4',
|
||||
]
|
||||
bypass_matched_file_filter = true
|
||||
|
||||
[[linter]]
|
||||
name = 'NEWLINE'
|
||||
code = 'NEWLINE'
|
||||
include_patterns=['**']
|
||||
exclude_patterns=[
|
||||
'**/contrib/**',
|
||||
|
|
@ -218,7 +220,7 @@ exclude_patterns=[
|
|||
'**/*.ipynb',
|
||||
'tools/clang_format_hash/**',
|
||||
]
|
||||
args = [
|
||||
command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/newlines_linter.py',
|
||||
'--',
|
||||
|
|
@ -226,14 +228,14 @@ args = [
|
|||
]
|
||||
|
||||
[[linter]]
|
||||
name = 'SPACES'
|
||||
code = 'SPACES'
|
||||
include_patterns = ['**']
|
||||
exclude_patterns = [
|
||||
'**/contrib/**',
|
||||
'**/*.diff',
|
||||
'third_party/**',
|
||||
]
|
||||
args = [
|
||||
command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/grep_linter.py',
|
||||
'--pattern=[[:blank:]]$',
|
||||
|
|
@ -248,7 +250,7 @@ args = [
|
|||
]
|
||||
|
||||
[[linter]]
|
||||
name = 'TABS'
|
||||
code = 'TABS'
|
||||
include_patterns = ['**']
|
||||
exclude_patterns = [
|
||||
'**/*.svg',
|
||||
|
|
@ -258,7 +260,7 @@ exclude_patterns = [
|
|||
'**/.gitattributes',
|
||||
'**/.gitmodules',
|
||||
]
|
||||
args = [
|
||||
command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/grep_linter.py',
|
||||
'--pattern=\t',
|
||||
|
|
@ -273,7 +275,7 @@ args = [
|
|||
]
|
||||
|
||||
[[linter]]
|
||||
name = 'INCLUDE'
|
||||
code = 'INCLUDE'
|
||||
include_patterns = [
|
||||
'c10/**',
|
||||
'aten/**',
|
||||
|
|
@ -282,7 +284,7 @@ include_patterns = [
|
|||
exclude_patterns = [
|
||||
'aten/src/ATen/native/quantized/cpu/qnnpack/**',
|
||||
]
|
||||
args = [
|
||||
command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/grep_linter.py',
|
||||
'--pattern=#include "',
|
||||
|
|
@ -297,7 +299,7 @@ args = [
|
|||
]
|
||||
|
||||
[[linter]]
|
||||
name = 'PYPIDEP'
|
||||
code = 'PYPIDEP'
|
||||
include_patterns = ['.github/**']
|
||||
exclude_patterns = [
|
||||
'**/*.rst',
|
||||
|
|
@ -305,7 +307,7 @@ exclude_patterns = [
|
|||
'**/*.md',
|
||||
'**/*.diff',
|
||||
]
|
||||
args = [
|
||||
command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/grep_linter.py',
|
||||
"""--pattern=\
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ class LintMessage(NamedTuple):
|
|||
original: Optional[str]
|
||||
replacement: Optional[str]
|
||||
description: Optional[str]
|
||||
bypassChangedLineFiltering: Optional[bool]
|
||||
|
||||
|
||||
IS_WINDOWS: bool = os.name == "nt"
|
||||
|
|
@ -90,7 +89,6 @@ def run_check(
|
|||
stdout=err.stdout.decode("utf-8").strip() or "(empty)",
|
||||
)
|
||||
),
|
||||
bypassChangedLineFiltering=None,
|
||||
)
|
||||
]
|
||||
|
||||
|
|
@ -113,7 +111,6 @@ def run_check(
|
|||
"The checked-in CircleCI config.yml file does not match what was generated by the scripts. "
|
||||
"Re-run with '-a' to accept changes."
|
||||
),
|
||||
bypassChangedLineFiltering=True,
|
||||
)
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ class LintMessage(NamedTuple):
|
|||
original: Optional[str]
|
||||
replacement: Optional[str]
|
||||
description: Optional[str]
|
||||
bypassChangedLineFiltering: Optional[bool]
|
||||
|
||||
|
||||
def as_posix(name: str) -> str:
|
||||
|
|
@ -115,7 +114,6 @@ def check_file(
|
|||
"Please report an issue in pytorch/pytorch with the "
|
||||
"label 'module: lint'"
|
||||
),
|
||||
bypassChangedLineFiltering=None,
|
||||
)
|
||||
]
|
||||
except (OSError, subprocess.CalledProcessError) as err:
|
||||
|
|
@ -144,7 +142,6 @@ def check_file(
|
|||
stdout=err.stdout.decode("utf-8").strip() or "(empty)",
|
||||
)
|
||||
),
|
||||
bypassChangedLineFiltering=None,
|
||||
)
|
||||
]
|
||||
|
||||
|
|
@ -163,7 +160,6 @@ def check_file(
|
|||
original=original.decode("utf-8"),
|
||||
replacement=replacement.decode("utf-8"),
|
||||
description="See https://clang.llvm.org/docs/ClangFormat.html.\nRun `lintrunner -a` to apply this patch.",
|
||||
bypassChangedLineFiltering=True,
|
||||
)
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ class LintMessage(NamedTuple):
|
|||
original: Optional[str]
|
||||
replacement: Optional[str]
|
||||
description: Optional[str]
|
||||
bypassChangedLineFiltering: Optional[bool]
|
||||
|
||||
|
||||
def as_posix(name: str) -> str:
|
||||
|
|
@ -146,7 +145,6 @@ def check_file(
|
|||
description=(
|
||||
f"Failed due to {err.__class__.__name__}:\n{err}"
|
||||
),
|
||||
bypassChangedLineFiltering=None,
|
||||
)
|
||||
]
|
||||
lint_messages = []
|
||||
|
|
@ -171,7 +169,6 @@ def check_file(
|
|||
severity=severities.get(match["severity"], LintSeverity.ERROR),
|
||||
original=None,
|
||||
replacement=None,
|
||||
bypassChangedLineFiltering=None,
|
||||
)
|
||||
lint_messages.append(message)
|
||||
finally:
|
||||
|
|
@ -232,7 +229,6 @@ def main() -> None:
|
|||
f"Could not find clang-tidy binary at {args.binary},"
|
||||
" you may need to run `lintrunner init`."
|
||||
),
|
||||
bypassChangedLineFiltering=None,
|
||||
)
|
||||
print(json.dumps(err_msg._asdict()), flush=True)
|
||||
exit(0)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ class LintMessage(NamedTuple):
|
|||
original: Optional[str]
|
||||
replacement: Optional[str]
|
||||
description: Optional[str]
|
||||
bypassChangedLineFiltering: Optional[bool]
|
||||
|
||||
|
||||
def as_posix(name: str) -> str:
|
||||
|
|
@ -286,7 +285,6 @@ def check_file(
|
|||
stdout=err.stdout.strip() or "(empty)",
|
||||
)
|
||||
),
|
||||
bypassChangedLineFiltering=None,
|
||||
)
|
||||
]
|
||||
|
||||
|
|
@ -306,7 +304,6 @@ def check_file(
|
|||
severity=severities.get(match["code"]) or get_issue_severity(match["code"]),
|
||||
original=None,
|
||||
replacement=None,
|
||||
bypassChangedLineFiltering=None,
|
||||
)
|
||||
for match in RESULTS_RE.finditer(proc.stdout)
|
||||
]
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ class LintMessage(NamedTuple):
|
|||
original: Optional[str]
|
||||
replacement: Optional[str]
|
||||
description: Optional[str]
|
||||
bypassChangedLineFiltering: Optional[bool]
|
||||
|
||||
|
||||
def as_posix(name: str) -> str:
|
||||
|
|
@ -100,7 +99,6 @@ def lint_file(
|
|||
stdout=err.stdout.decode("utf-8").strip() or "(empty)",
|
||||
)
|
||||
),
|
||||
bypassChangedLineFiltering=None,
|
||||
)
|
||||
|
||||
return LintMessage(
|
||||
|
|
@ -113,7 +111,6 @@ def lint_file(
|
|||
original=original,
|
||||
replacement=replacement,
|
||||
description=error_description,
|
||||
bypassChangedLineFiltering=None,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -189,7 +186,6 @@ def main() -> None:
|
|||
stdout=err.stdout.decode("utf-8").strip() or "(empty)",
|
||||
)
|
||||
),
|
||||
bypassChangedLineFiltering=None,
|
||||
)
|
||||
print(json.dumps(err_msg._asdict()), flush=True)
|
||||
exit(0)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ class LintMessage(NamedTuple):
|
|||
original: Optional[str]
|
||||
replacement: Optional[str]
|
||||
description: Optional[str]
|
||||
bypassChangedLineFiltering: Optional[bool]
|
||||
|
||||
|
||||
def as_posix(name: str) -> str:
|
||||
|
|
@ -109,7 +108,6 @@ def check_file(
|
|||
description=(
|
||||
f"Failed due to {err.__class__.__name__}:\n{err}"
|
||||
),
|
||||
bypassChangedLineFiltering=None,
|
||||
)
|
||||
]
|
||||
stdout = str(proc.stdout, "utf-8").strip()
|
||||
|
|
@ -126,7 +124,6 @@ def check_file(
|
|||
severity=severities.get(match["severity"], LintSeverity.ERROR),
|
||||
original=None,
|
||||
replacement=None,
|
||||
bypassChangedLineFiltering=None,
|
||||
)
|
||||
for match in RESULTS_RE.finditer(stdout)
|
||||
]
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ class LintMessage(NamedTuple):
|
|||
original: Optional[str]
|
||||
replacement: Optional[str]
|
||||
description: Optional[str]
|
||||
bypassChangedLineFiltering: Optional[bool]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
@ -75,7 +74,6 @@ if __name__ == "__main__":
|
|||
original=None,
|
||||
replacement=None,
|
||||
description=f"Failed due to {err.__class__.__name__}:\n{err}",
|
||||
bypassChangedLineFiltering=None,
|
||||
)
|
||||
|
||||
print(json.dumps(msg._asdict()), flush=True)
|
||||
|
|
@ -102,7 +100,6 @@ if __name__ == "__main__":
|
|||
"YAML roundtrip failed; run `lintrunner --take NATIVEFUNCTIONS -a` to apply the suggested changes. "
|
||||
"If you think this is in error, please see tools/linter/adapters/nativefunctions_linter.py"
|
||||
),
|
||||
bypassChangedLineFiltering=None,
|
||||
)
|
||||
|
||||
print(json.dumps(msg._asdict()), flush=True)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ class LintMessage(NamedTuple):
|
|||
original: Optional[str]
|
||||
replacement: Optional[str]
|
||||
description: Optional[str]
|
||||
bypassChangedLineFiltering: Optional[bool]
|
||||
|
||||
|
||||
def correct_trailing_newlines(filename: str) -> bool:
|
||||
|
|
@ -69,7 +68,6 @@ def check_file(filename: str) -> Optional[LintMessage]:
|
|||
original=None,
|
||||
replacement=None,
|
||||
description="Trailing newline found. Run `lintunner --take NEWLINE -a` to apply changes.",
|
||||
bypassChangedLineFiltering=None,
|
||||
)
|
||||
|
||||
else:
|
||||
|
|
@ -94,7 +92,6 @@ def check_file(filename: str) -> Optional[LintMessage]:
|
|||
original=None,
|
||||
replacement=None,
|
||||
description=f"utf-8 decoding failed due to {err.__class__.__name__}:\n{err}",
|
||||
bypassChangedLineFiltering=None,
|
||||
)
|
||||
|
||||
return LintMessage(
|
||||
|
|
@ -107,7 +104,6 @@ def check_file(filename: str) -> Optional[LintMessage]:
|
|||
original=original,
|
||||
replacement=original.rstrip("\n") + "\n",
|
||||
description="Trailing newline found. Run `lintunner --take NEWLINE -a` to apply changes.",
|
||||
bypassChangedLineFiltering=None,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user