Skip to content

Commit 9468926

Browse files
authored
[ez][BE] Apply lintrunner to non tutorials files (#3468)
Removes the files from the exclusion lists and run `lintrunner --all-files -a` to apply the changes This is only files at the root level and in `.github` and `.jenkins` folders The linters should just be whitespace changes
1 parent 4dee820 commit 9468926

15 files changed

+138
-156
lines changed

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ body:
1313
- type: textarea
1414
attributes:
1515
label: Add Link
16-
description: |
16+
description: |
1717
**Add the link to the tutorial***
1818
placeholder: |
1919
Link to the tutorial on the website:
2020
validations:
21-
required: true
21+
required: true
2222
- type: textarea
2323
attributes:
2424
label: Describe the bug
25-
description: |
26-
**Add the bug description**
25+
description: |
26+
**Add the bug description**
2727
placeholder: |
2828
Provide a detailed description of the issue with code samples if relevant
2929
```python

.github/ISSUE_TEMPLATE/feature-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ body:
1818
- type: textarea
1919
attributes:
2020
label: Existing tutorials on this topic
21-
description: |
21+
description: |
2222
**Add a list of existing tutorials on the same topic.**
2323
placeholder: |
2424
List tutorials that already explain this functionality if exist. On pytorch.org or elsewhere.

.github/scripts/docathon-label-sync.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def main():
3030
# if the issue has a docathon label, add all labels from the issue to the PR.
3131
if not docathon_label_present:
3232
print("The 'docathon-h1-2025' label is not present in the issue.")
33-
return
33+
return
3434
pull_request_labels = pull_request.get_labels()
3535
issue_label_names = [label.name for label in issue_labels]
3636
labels_to_add = [label for label in issue_label_names if label not in pull_request_labels]
@@ -39,8 +39,8 @@ def main():
3939
return
4040
pull_request.add_to_labels(*labels_to_add)
4141
print("Labels added to the pull request!")
42-
4342

44-
43+
44+
4545
if __name__ == "__main__":
4646
main()

.github/workflows/MonthlyLinkCheck.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Runs once a month and checks links in the repo to ensure they are valid
1+
#Runs once a month and checks links in the repo to ensure they are valid
22
#If action fails, it creates an issue with the failing links and an "incorrect link" label
33
#If link is valid but failing, it can be added to the .lycheeignore file
44
#Action can also be run manually as needed.
@@ -34,8 +34,8 @@ jobs:
3434
content-filepath: ./lychee/out.md
3535
labels: 'incorrect link'
3636
#token: ${{ secrets.CUSTOM_TOKEN }}
37-
38-
37+
38+
3939
- name: Suggestions
4040
if: failure()
4141
run: |

.github/workflows/StalePRs.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ on:
2121
jobs:
2222
stale:
2323
if: ${{ github.repository == 'pytorch/tutorials' }}
24-
runs-on: ubuntu-latest
24+
runs-on: ubuntu-latest
2525
permissions:
2626
contents: read
2727
pull-requests: write
@@ -154,4 +154,3 @@ jobs:
154154
}
155155
}
156156
core.info(`Processed ${numProcessed} PRs total.`);
157-

.github/workflows/link_checkPR.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ jobs:
3131
issue_number: context.issue.number
3232
});
3333
return labels.data.some(label => label.name === 'skip-link-check');
34-
34+
3535
- name: Check Links
3636
if: steps.skip-label.outputs.result == 'false'
3737
uses: lycheeverse/lychee-action@v1
3838
with:
3939
args: --accept=200,403,429 --base . --verbose --no-progress ${{ steps.changed-files.outputs.all_changed_files }}
4040
token: ${{ secrets.CUSTOM_TOKEN }}
4141
fail: true
42-
42+
4343
- name: Skip Message
4444
if: steps.skip-label.outputs.result == 'true'
4545
run: echo "Link check was skipped due to the presence of the 'skip-link-check' label."
@@ -48,7 +48,7 @@ jobs:
4848
- name: No Files to Check
4949
if: steps.skip-label.outputs.result == 'false' && steps.changed-files.outputs.any_changed == 'true'
5050
run: echo "No relevant files were changed in this PR that require link checking."
51-
51+
5252
- name: Suggestions
5353
if: failure()
5454
run: |

.github/workflows/spelling.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
script: |
1818
let skipCheck = false;
1919
let changedFiles = [];
20-
20+
2121
if (context.eventName === 'pull_request') {
2222
// Check for skip label
2323
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
@@ -26,15 +26,15 @@ jobs:
2626
issue_number: context.issue.number
2727
});
2828
skipCheck = labels.some(label => label.name === 'skip-spell-check');
29-
29+
3030
if (!skipCheck) {
3131
// Get changed files in PR
3232
const { data: files } = await github.rest.pulls.listFiles({
3333
owner: context.repo.owner,
3434
repo: context.repo.repo,
3535
pull_number: context.issue.number
3636
});
37-
37+
3838
changedFiles = files
3939
.filter(file => file.filename.match(/\.(py|rst|md)$/))
4040
.map(file => file.filename);
@@ -43,7 +43,7 @@ jobs:
4343
// For push events, we'll still need to use git diff
4444
// We'll handle this after checkout
4545
}
46-
46+
4747
core.setOutput('skip', skipCheck.toString());
4848
core.setOutput('files', changedFiles.join('\n'));
4949
core.setOutput('is-pr', (context.eventName === 'pull_request').toString());
@@ -73,7 +73,7 @@ jobs:
7373
else
7474
FILES="${{ steps.push-files.outputs.files }}"
7575
fi
76-
76+
7777
if [ -z "$FILES" ]; then
7878
echo "skip=true" >> $GITHUB_OUTPUT
7979
echo "No relevant files changed (*.py, *.rst, *.md), skipping spell check"
@@ -110,7 +110,7 @@ jobs:
110110
else
111111
mapfile -t FILES <<< "${{ steps.push-files.outputs.files }}"
112112
fi
113-
113+
114114
# Check each file individually
115115
FINAL_EXIT_CODE=0
116116
SPELLCHECK_LOG=""

.jenkins/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ elif [[ "${JOB_TYPE}" == "manager" ]]; then
152152
if [[ "$COMMIT_SOURCE" == "refs/heads/master" || "$COMMIT_SOURCE" == "refs/heads/main" ]]; then
153153
git clone https://github.com/pytorch/tutorials.git -b gh-pages gh-pages
154154
# Clean up directories that contain tutorials
155-
155+
156156
for dir in beginner intermediate prototype recipes advanced distributed vision text audio; do
157157
rm -rf "gh-pages/$dir"
158158
done
159-
159+
160160
cp -r docs/* gh-pages/
161161
pushd gh-pages
162162
# DANGER! DO NOT REMOVE THE `set +x` SETTING HERE!

.jenkins/post_process_notebooks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"""
66
This post-processing script needs to run after the .ipynb files are
77
generated. The script removes extraneous ```{=html} syntax from the
8-
admonitions and splits the cells that have video iframe into a
8+
admonitions and splits the cells that have video iframe into a
99
separate code cell that can be run to load the video directly
1010
in the notebook. This script is included in build.sh.
1111
"""
@@ -36,7 +36,7 @@ def process_video_cell(notebook_path):
3636
before_html_block = match.group(1)
3737
code_block = match.group(2)
3838

39-
# Add a comment to run the cell to display the video
39+
# Add a comment to run the cell to display the video
4040
code_block = "# Run this cell to load the video\n" + code_block
4141
# Create a new code cell
4242
new_code_cell = nbf.v4.new_code_cell(source=code_block)

.lintrunner.toml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@ exclude_patterns = [
99
"_static/**/*", # Contains some files that should usually not be linted
1010
# All files below this should be checked and either removed from the
1111
# exclusion list by fixing them or have a reason to be excluded.
12-
".github/ISSUE_TEMPLATE/bug-report.yml",
13-
".github/ISSUE_TEMPLATE/feature-request.yml",
14-
".github/scripts/docathon-label-sync.py",
15-
".github/workflows/MonthlyLinkCheck.yml",
16-
".github/workflows/StalePRs.yml",
17-
".github/workflows/link_checkPR.yml",
18-
".github/workflows/spelling.yml",
19-
".jenkins/post_process_notebooks.py",
20-
".lycheeignore",
21-
"CONTRIBUTING.md",
2212
"advanced_source/coding_ddpg.py",
2313
"advanced_source/cpp_autograd.rst",
2414
"advanced_source/cpp_custom_ops.rst",
@@ -60,7 +50,6 @@ exclude_patterns = [
6050
"beginner_source/saving_loading_models.py",
6151
"beginner_source/template_tutorial.py",
6252
"beginner_source/transfer_learning_tutorial.py",
63-
"docathon-leaderboard.md",
6453
"intermediate_source/TCPStore_libuv_backend.rst",
6554
"intermediate_source/ax_multiobjective_nas_tutorial.py",
6655
"intermediate_source/compiled_autograd_tutorial.rst",
@@ -108,9 +97,6 @@ exclude_patterns = [
10897
"recipes_source/torch_compiler_set_stance_tutorial.py",
10998
"recipes_source/torch_export_aoti_python.py",
11099
"recipes_source/xeon_run_cpu.rst",
111-
"redirects.py",
112-
"tutorial_submission_policy.md",
113-
".jenkins/build.sh",
114100
"advanced_source/cpp_export.rst",
115101
"advanced_source/torch-script-parallelism.rst",
116102
"advanced_source/torch_script_custom_classes.rst",
@@ -148,9 +134,9 @@ include_patterns = ['**']
148134
exclude_patterns = [
149135
"_static/**/*", # Contains some files that should usually not be linted
150136
".lintrunner.toml", # Ironically needs to contain the tab character to find in other files
137+
"Makefile", # Wants tabs for indentationo
151138
# All files below this should be checked and either removed from the
152139
# exclusion list by fixing them or have a reason to be excluded.
153-
"Makefile",
154140
"advanced_source/README.txt",
155141
"advanced_source/cpp_frontend.rst",
156142
"advanced_source/torch_script_custom_ops.rst",
@@ -202,8 +188,6 @@ exclude_patterns=[
202188
"_static/**/*", # Contains some files that should usually not be linted
203189
# All files below this should be checked and either removed from the
204190
# exclusion list by fixing them or have a reason to be excluded.
205-
".github/workflows/StalePRs.yml",
206-
"CONTRIBUTING.md",
207191
"advanced_source/extend_dispatcher.rst",
208192
"advanced_source/neural_style_tutorial.py",
209193
"advanced_source/sharding.rst",

0 commit comments

Comments
 (0)