-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from mlcommons/lint
Integrate flake8 and pyre for automated linting and type checking
- Loading branch information
Showing
13 changed files
with
313 additions
and
335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
[flake8] | ||
enable-extensions = G | ||
select = B,C,E,F,G,P,SIM1,T4,W,B9,TOR0,TOR1,TOR2 | ||
max-line-length = 120 | ||
# C408 ignored because we like the dict keyword argument syntax | ||
# E501 is not flexible enough, we're using B950 instead | ||
ignore = | ||
E203,E305,E402,E501,E721,E741,F405,F821,F841,F999,W503,W504,C408,E302,W291,E303, | ||
# fix these lints in the future | ||
E275, | ||
# shebang has extra meaning in fbcode lints, so I think it's not worth trying | ||
# to line this up with executable bit | ||
EXE001, | ||
# these ignores are from flake8-bugbear; please fix! | ||
B007,B008,B017,B019,B023,B028,B903,B904,B905,B906,B907 | ||
# these ignores are from flake8-comprehensions; please fix! | ||
C407, | ||
# these ignores are from flake8-logging-format; please fix! | ||
G100,G101,G200,G201,G202 | ||
# these ignores are from flake8-simplify. please fix or ignore with commented reason | ||
SIM105,SIM108,SIM110,SIM111,SIM113,SIM114,SIM115,SIM116,SIM117,SIM118,SIM119,SIM12, | ||
# flake8-simplify code styles | ||
SIM102,SIM103,SIM106,SIM112, | ||
# TorchFix codes that don't make sense for PyTorch itself: | ||
# removed and deprecated PyTorch functions. | ||
TOR001,TOR101, | ||
# TODO(kit1980): fix all TOR102 issues | ||
# `torch.load` without `weights_only` parameter is unsafe | ||
TOR102, | ||
P201, | ||
per-file-ignores = | ||
__init__.py: F401 | ||
optional-ascii-coding = True | ||
exclude = | ||
./.git, | ||
./build, | ||
./et_def/et_def_pb2.py, | ||
./et_def/et_def_pb2_grpc.py, | ||
./third_party/utils/protolib.py, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Python Linting | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
lint-and-format: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.8' | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install flake8 | ||
pip install pyre-check | ||
pip install . | ||
- name: Run Flake8 | ||
run: flake8 . | ||
|
||
- name: Run Pyre Check | ||
run: pyre check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ build/ | |
__pycache__/ | ||
*.egg | ||
*.et | ||
*.dot | ||
*.dot | ||
.pyre |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"source_directories": [ | ||
"timeline_visualizer", | ||
"et_converter" | ||
], | ||
"search_path": ["/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.