Commit Graph

10 Commits

Author SHA1 Message Date
PyTorch MergeBot
db6165215e Revert "[ci] use lintrunner in CI"
This reverts commit 4c3ee53522.

Reverted https://github.com/pytorch/pytorch/pull/68460 on behalf of https://github.com/malfet
2022-04-14 23:27:27 +00:00
Michael Suo
4c3ee53522 [ci] use lintrunner in CI
This changes our lint workflows to use lintrunner for the linters that
are currently supported

+ some random fixes to make things lint clean on master
+ changes to Makefile to use lintrunner

Pull Request resolved: https://github.com/pytorch/pytorch/pull/68460

Approved by: https://github.com/t10-13rocket, https://github.com/seemethere, https://github.com/janeyx99
2022-04-14 17:43:41 +00:00
driazati
a679bb5ecf Refactor local lint (#58798)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/58798

In #58623 there was a bug in `make quicklint` where ShellCheck would run on the entire repo when there were no files. This PR fixes that by refactoring out common stuff (like skipping quicklint when there are no files, let checks do their own file filtering) and pushes the logic into a runner class.

Test Plan: Imported from OSS

Reviewed By: samestep

Differential Revision: D28649889

Pulled By: driazati

fbshipit-source-id: b19f32cdb63396c806cb689b2f6daf97e1724d44
2021-05-24 13:52:53 -07:00
driazati
84b6c629d3 [lint] Move shellcheck to its own step (#58623)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/58623

This splits out everything shellcheck related into its own job that generates and checks GHA workflows, then shellchecks those + jenkins scripts. This PR also integrates shellcheck into the changed-only stuff in `actions_local_runner.py` so that shellcheck won't do anything unless someone edits a shell script in their local checkout. This is the final piece to clean up the output of `make quicklint` and speeds it up by a good bit (before it was shellchecking everything which took a few seconds):

```
$ make quicklint -j $(nproc)
✓ quick-checks: Ensure no unqualified noqa
✓ quick-checks: Ensure canonical include
✓ quick-checks: Ensure no unqualified type ignore
✓ quick-checks: Ensure no direct cub include
✓ quick-checks: Ensure no tabs
✓ quick-checks: Ensure no non-breaking spaces
✓ shellcheck: Regenerate workflows
✓ quick-checks: Ensure no versionless Python shebangs
✓ quick-checks: Ensure correct trailing newlines
✓ shellcheck: Assert that regenerating the workflows didn't change them
✓ mypy (skipped typestub generation)
✓ cmakelint: Run cmakelint
✓ quick-checks: Ensure no trailing spaces
✓ flake8
✓ shellcheck: Extract scripts from GitHub Actions workflows
✓ shellcheck: Run Shellcheck
real 0.92
user 6.12
sys 2.45
```

Test Plan: Imported from OSS

Reviewed By: nikithamalgifb

Differential Revision: D28617293

Pulled By: driazati

fbshipit-source-id: af960ed441db797d07697bfb8292aff5010ca45b
2021-05-21 18:23:40 -07:00
Your Name
4ce8378ec5 [local lint] Remove success checks in tests (#58490)
Summary:
Testing for both that a lint job ran and that it was successful depends
on having lint pass for the PR, which can create confusion if it doesn't
(i.e. a flake8 failure also causes this job to fail, and it's not
immediately clear why). With this PR we just check for the presence of
job names to see that something ran.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/58490

Reviewed By: samestep

Differential Revision: D28511229

Pulled By: driazati

fbshipit-source-id: 3036deff9f9d0ef2e78b44a9a43b342acdcfa296
2021-05-18 09:31:13 -07:00
Sam Estep
26aeec35a1 Disable more of quicklint test (#58257)
Summary:
Essentially a followup to https://github.com/pytorch/pytorch/issues/57968. For now, this test is just too flaky to run on every PR.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/58257

Test Plan: The repro steps in https://github.com/pytorch/pytorch/issues/58253.

Reviewed By: walterddr

Differential Revision: D28424862

Pulled By: samestep

fbshipit-source-id: 00aed872fe505db67e48414b1234505a71099262
2021-05-13 14:45:45 -07:00
Sam Estep
c36055bb42 Make mypy_wrapper.py accept multiple filenames (#57998)
Summary:
A followup to https://github.com/pytorch/pytorch/issues/57752.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/57998

Test Plan:
```
mypy --config=mypy-strict.ini
python tools/test/test_mypy_wrapper.py
python tools/test/test_actions_local_runner.py -k mypy
```

Reviewed By: driazati

Differential Revision: D28338531

Pulled By: samestep

fbshipit-source-id: ae31e3fa4a2b8060c200f9a13f768beaf2f55694
2021-05-11 15:54:12 -07:00
davidriazati@fb.com
f1d01b9488 Disable test for quicklint (#57968)
Summary:
Disabling until we fix https://github.com/pytorch/pytorch/issues/57967

Pull Request resolved: https://github.com/pytorch/pytorch/pull/57968

Pulled By: driazati

Reviewed By: samestep

Differential Revision: D28330226

fbshipit-source-id: 7ea130e0cf7b94959a7db18838d21e4711716625
2021-05-10 14:40:59 -07:00
davidriazati@fb.com
c88167d2ed Respect .ini for flake8 and mypy (#57752)
Summary:
Previously `make quicklint` would lint all changed files for both mypy `ini`s, regardless of whether that file was actually supposed to be run under that configuration. This PR fixes that so we are using `tools/mypy_wrapper.py` to check if files should be included.

There's a similar change for `flake8` so that it now only outputs errors once and correctly excludes the paths in `.flake8`.

This also adds a bunch of tests to ensure that `make lint` and `make quicklint` both work and that `make quicklint` is excluding and including what it should.

Fixes #57644
](https://our.intern.facebook.com/intern/diff/28259692/)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/57752

Pulled By: driazati

Reviewed By: samestep

Differential Revision: D28259692

fbshipit-source-id: 233d355781230f11f98a6f61e2c07e9f5e737e24
2021-05-07 15:21:57 -07:00
davidriazati@fb.com
5e4dfd0140 Add quicklint make target (#56559)
Summary:
This queries the local git repo for changed files (any changed files, not just committed ones) and sends them to mypy/flake8 instead of the default (which is the whole repo, defined the .flake8 and mypy.ini files). This brings a good speedup (from 15 seconds with no cache to < 1 second from my local testing on this PR).

```bash
make quicklint -j 6
```

It should be noted that the results of this aren’t exactly what’s in the CI, since mypy and flake8 ignore the `include` and `exclude` parts of their config when an explicit list of files is passed in.
](https://our.intern.facebook.com/intern/diff/27901577/)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56559

Pulled By: driazati

Reviewed By: malfet

Differential Revision: D27901577

fbshipit-source-id: 99f351cdfe5aba007948aea2b8a78f683c5d8583
2021-04-21 13:47:25 -07:00