Skip to content

Commit 7c346d7

Browse files
authored
ci: run lintrunner on ghstack base branches; lint with editorconfig (#227)
Run on base branches too so that only new alerts are shown in a PR review file view. Also added editorconfig-checker linter: lint time is 1.2seconds. Total runtime 3.5min vs before 8.5min on CI. Renamed spellcheck etc. to Optional Lint to reflect the purposes of the reviewdog linters
1 parent edaf1ea commit 7c346d7

File tree

8 files changed

+40
-16
lines changed

8 files changed

+40
-16
lines changed

.github/workflows/lint.yaml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,19 @@ on:
44
push:
55
branches:
66
- main
7+
- 'gh/**/base' # ghstack base branches
78
pull_request:
89

910
jobs:
10-
lint-python:
11-
name: Lint Python
11+
optional-lint:
12+
name: Optional Lint
1213
runs-on: ubuntu-latest
1314
permissions:
1415
pull-requests: write
1516

1617
steps:
17-
- uses: actions/checkout@v2
18-
- name: Setup Python
19-
uses: actions/[email protected]
20-
with:
21-
python-version: "3.10"
22-
- name: misspell # Check spellings as well
18+
- uses: actions/checkout@v3
19+
- name: misspell # Check spelling
2320
uses: reviewdog/action-misspell@v1
2421
with:
2522
github_token: ${{ secrets.github_token }}
@@ -39,9 +36,9 @@ jobs:
3936
name: Enforce style
4037
runs-on: ubuntu-latest
4138
steps:
42-
- uses: actions/checkout@v2
39+
- uses: actions/checkout@v3
4340
- name: Setup Python
44-
uses: actions/setup-python@v4.1.0
41+
uses: actions/setup-python@v4
4542
with:
4643
# Version range or exact version of Python to use, using SemVer's version range syntax. Reads from .python-version if unset.
4744
python-version: "3.10"

.lintrunner.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ command = [
6464
'run',
6565
'mypy_linter',
6666
'--config=pyproject.toml',
67+
'--show-disable',
6768
'--',
6869
'@{{PATHSFILE}}'
6970
]
@@ -128,6 +129,7 @@ command = [
128129
'run',
129130
'pylint_linter',
130131
'--rcfile=pyproject_pylint.toml',
132+
'--show-disable',
131133
'--',
132134
'@{{PATHSFILE}}'
133135
]
@@ -140,3 +142,28 @@ init_command = [
140142
'--dry-run={{DRYRUN}}',
141143
'pylint==2.15.5',
142144
]
145+
146+
[[linter]]
147+
code = 'EDITORCONFIG-CHECKER'
148+
include_patterns = ['**']
149+
exclude_patterns = [
150+
'**/*.ipynb',
151+
]
152+
command = [
153+
'python',
154+
'-m',
155+
'lintrunner_adapters',
156+
'run',
157+
'editorconfig_checker_linter',
158+
'--',
159+
'@{{PATHSFILE}}'
160+
]
161+
init_command = [
162+
'python',
163+
'-m',
164+
'lintrunner_adapters',
165+
'run',
166+
'pip_init',
167+
'--dry-run={{DRYRUN}}',
168+
'editorconfig-checker==2.6.2',
169+
]

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"recommendations": [
33
"editorconfig.editorconfig"
44
]
5-
}
5+
}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ include requirements.txt
77

88
# exclude from sdist
99
exclude *.onnx
10-
prune */__pycache__
10+
prune */__pycache__

ROADMAP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ Python features/constructs as early as possible and report it.
2828
- Improve type-annotation support, especially for tensor shapes
2929
- Improve support for non-tensor types (sequences, maps, and optional)
3030
- Improve checking in eager-mode to ensure its semantics is aligned with ONNX semantics
31-
- Support for variadic inputs/outputs
31+
- Support for variadic inputs/outputs

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ We prefer all communications to be in English.
3838

3939
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
4040

41-
<!-- END MICROSOFT SECURITY.MD BLOCK -->
41+
<!-- END MICROSOFT SECURITY.MD BLOCK -->

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ torch
2222

2323
# Lint
2424
lintrunner
25-
lintrunner_adapters
25+
lintrunner_adapters>=0.3

0 commit comments

Comments
 (0)