Yuanyuan Chen
3255e7872b
Enable all flake8-logging-format rules ( #164655 )
...
These rules are enabled by removing existing suppressions.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164655
Approved by: https://github.com/janeyx99 , https://github.com/mlazos
2025-10-19 00:59:28 +00:00
Tom Ritchford
9a8c42ff94
Get rid of unused code in linters ( #154043 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/154043
Approved by: https://github.com/XuehaiPan , https://github.com/Skylion007
2025-05-22 15:24:54 +00:00
Xuehai Pan
267f82b860
[BE] Format .ci/ / .github/ / benchmarks/ / functorch/ / tools/ / torchgen/ with ruff format ( #132577 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/132577
Approved by: https://github.com/malfet
2024-10-11 18:30:26 +00:00
Xuehai Pan
758a0a88a2
[BE][Easy] enable ruff rule PIE790: unnecessary pass statement ( #133200 )
...
This PR removes unnecessary `pass` statement. This is semanticly safe because the bytecode for the Python code does not change.
Note that if there is a docstring in the function, a empty function does not need a `pass` statement as placeholder.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133200
Approved by: https://github.com/malfet , https://github.com/eqy , https://github.com/kit1980
2024-08-15 15:50:19 +00:00
Xuehai Pan
8a67daf283
[BE][Easy] enable postponed annotations in tools ( #129375 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/129375
Approved by: https://github.com/malfet
2024-06-29 09:23:35 +00:00
PyTorch MergeBot
a32ce5ce34
Revert "[BE][Easy] enable postponed annotations in tools ( #129375 )"
...
This reverts commit 59eb2897f1 .
Reverted https://github.com/pytorch/pytorch/pull/129375 on behalf of https://github.com/huydhn due to Sorry for reverting your change but I need to revert to cleanly revert https://github.com/pytorch/pytorch/pull/129374 , please do a rebase and reland this ([comment](https://github.com/pytorch/pytorch/pull/129375#issuecomment-2197800541 ))
2024-06-29 00:44:25 +00:00
Xuehai Pan
59eb2897f1
[BE][Easy] enable postponed annotations in tools ( #129375 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/129375
Approved by: https://github.com/malfet
2024-06-28 15:37:54 +00:00
Justin Chu
4cc1745b13
[BE] f-stringify torch/ and scripts ( #105538 )
...
This PR is a follow up on the pyupgrade series to convert more strings to use f-strings using `flynt`.
- https://docs.python.org/3/reference/lexical_analysis.html#f-strings
- https://pypi.org/project/flynt/
Command used:
```
flynt torch/ -ll 120
flynt scripts/ -ll 120
flynt tools/ -ll 120
```
and excluded `collect_env.py`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/105538
Approved by: https://github.com/ezyang , https://github.com/malfet
2023-07-21 19:35:24 +00:00
Aaron Gokaslan
2f95a3d0fc
[BE]: Apply ruff PERF fixes to torch ( #104917 )
...
Applies automated ruff fixes in the PERF modules and enables all automatic ones. I also updated ruff which applied some additional fixes.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/104917
Approved by: https://github.com/ezyang , https://github.com/albanD
2023-07-11 20:45:21 +00:00
Aaron Gokaslan
9171f7d4cd
[BE] Modernize PyTorch even more for 3.8 with pyupgrade ( #94520 )
...
Applies some more pyupgrade fixits to PyTorch
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94520
Approved by: https://github.com/ezyang
2023-02-10 18:02:50 +00:00
Huy Do
ef035d083e
Add ufmt to unify black and usort ( #81157 )
...
This reworks [80257](https://github.com/pytorch/pytorch/pull/80257 ) a bit to use ufmt:
* ufmt https://ufmt.omnilib.dev/en/stable/ unifies both black and usort to automatically format the file in the "most Pythonic" way
* Also make a demo run for all files in `tools/linter/**/*.py`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81157
Approved by: https://github.com/suo
2022-07-11 19:20:22 +00:00
Edward Z. Yang
a11c1bbdd0
Run Black on all of tools/
...
Signed-off-by: Edward Z. Yang <ezyangfb.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76089
Approved by: https://github.com/albanD
2022-04-20 17:29:41 +00:00
Michael Suo
123297a8c0
[lint] use python to run flake8 and mypy in linter
...
Previously we were just using whatever version the shell picked up, but
malfet reported that this can (and is) overridden on some machines.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75858
Approved by: https://github.com/malfet
2022-04-15 04:22:45 +00:00
Michael Suo
fe1e6de73a
[lint] fixes to mypy linter
...
I thought I landed this already, but:
- Don't run one mypy instance per file, run one per config
- Do the same for flake8
- Properly handle stub files
Pull Request resolved: https://github.com/pytorch/pytorch/pull/68479
Approved by: https://github.com/janeyx99
2022-04-13 17:14:24 +00:00
Michael Suo
8e2528132b
[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
2021-11-08 09:45:26 -08:00
Michael Suo
5bb5bfccf7
[lint] add lintrunner support for circleci_linter ( #67872 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/67872
As title. This demonstrates some of the nice features of lintrunner:
- Uniform error reporting means you get a nice diff of the changes for
free
- Can run with -a to just accept the changes (don't need to tell people
to run a special regenerate command since the linter adaper already knows how.)
Differential Revision:
D32187386
D32187386
Test Plan: Imported from OSS
Reviewed By: driazati
Pulled By: suo
fbshipit-source-id: 71de6b042730be80ff6794652039e9bc655a72b1
2021-11-08 09:43:25 -08:00
Michael Suo
6df0d7d502
[lint] add basic lintrunner compatibility ( #67110 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/67110
Adds support for using lintrunner with:
- clang-format
- clang-tidy
- flake8
- mypy
Test Plan: Imported from OSS
Reviewed By: driazati
Differential Revision: D32145555
Pulled By: suo
fbshipit-source-id: 2150348e26fba4ae738cd0b9684b2889ce0f1133
2021-11-03 12:35:28 -07:00