Skip to content

Commit 2817b1c

Browse files
authored
Merge pull request #1 from e06084/dev
ci: add flake8 isort lint check
2 parents 2cb4309 + ecd9447 commit 2817b1c

3 files changed

Lines changed: 114 additions & 0 deletions

File tree

.github/pull_request_template.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.
2+
3+
## Motivation
4+
5+
Please describe the motivation of this PR and the goal you want to achieve through this PR.
6+
7+
## Modification
8+
9+
Please briefly describe what modification is made in this PR.
10+
11+
## BC-breaking (Optional)
12+
13+
Does the modification introduce changes that break the backward compatibility of the downstream repositories?
14+
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.
15+
16+
## Use cases (Optional)
17+
18+
If this PR introduces a new feature, it is better to list some use cases here and update the documentation.
19+
20+
## Checklist
21+
22+
**Before PR**:
23+
24+
- [ ] Pre-commit or other linting tools are used to fix the potential lint issues.
25+
- [ ] Bug fixes are fully covered by unit tests, the case that causes the bug should be added in the unit tests.
26+
- [ ] The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
27+
- [ ] The documentation has been modified accordingly, like docstring or example tutorials.
28+
29+
**After PR**:
30+
31+
- [ ] If the modification has potential influence on downstream or other related projects, this PR should be tested with those projects.
32+
- [ ] CLA has been signed and all committers have signed the CLA in this PR.

.github/workflows/lint.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: lint
2+
3+
on: [push, pull_request]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: [3.10.15]
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Install pre-commit hook
22+
run: |
23+
pip install pre-commit==3.8.0
24+
pip install jupyter
25+
pre-commit install
26+
- name: Linting
27+
run: pre-commit run --all-files

.pre-commit-config.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
repos:
2+
- repo: https://github.com/PyCQA/flake8
3+
rev: 5.0.4
4+
hooks:
5+
- id: flake8
6+
args: [ "--max-line-length=2200", "--ignore=E131,E125,W503,W504,E203,E231,E702,E128" ]
7+
exclude: '^tests/.*/assets/'
8+
- repo: https://github.com/PyCQA/isort
9+
rev: 5.11.5
10+
hooks:
11+
- id: isort
12+
exclude: '^tests/.*/assets/'
13+
- repo: https://github.com/pre-commit/mirrors-yapf
14+
rev: v0.32.0
15+
hooks:
16+
- id: yapf
17+
args: ["--style={based_on_style: google, column_limit: 200, indent_width: 4}"]
18+
exclude: '^tests/.*/assets/'
19+
- repo: https://github.com/pre-commit/pre-commit-hooks
20+
rev: v4.3.0
21+
hooks:
22+
- id: trailing-whitespace
23+
- id: check-yaml
24+
- id: end-of-file-fixer
25+
- id: requirements-txt-fixer
26+
- id: double-quote-string-fixer
27+
- id: check-merge-conflict
28+
- id: fix-encoding-pragma
29+
args: [ "--remove" ]
30+
- id: mixed-line-ending
31+
args: [ "--fix=lf" ]
32+
exclude: '^tests/.*/assets/|\.ipynb$'
33+
- repo: https://github.com/executablebooks/mdformat
34+
rev: 0.7.9
35+
hooks:
36+
- id: mdformat
37+
args: [ "--number", "--table-width", "200" ]
38+
additional_dependencies:
39+
- mdformat-openmmlab
40+
- mdformat_frontmatter
41+
- linkify-it-py
42+
exclude: '^tests/.*/assets/'
43+
- repo: https://github.com/myint/docformatter
44+
rev: v1.3.1
45+
hooks:
46+
- id: docformatter
47+
args: [ "--in-place", "--wrap-descriptions", "119" ]
48+
- repo: local
49+
hooks:
50+
- id: clear-jupyter-notebook-output
51+
name: Clear Jupyter Notebook Output
52+
entry: jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace
53+
language: system
54+
files: \.ipynb$
55+
types: [file]

0 commit comments

Comments
 (0)