File tree Expand file tree Collapse file tree 2 files changed +60
-1
lines changed Expand file tree Collapse file tree 2 files changed +60
-1
lines changed Original file line number Diff line number Diff line change
1
+ # Automatic code formatting
2
+ name : " Code formatting"
3
+ on :
4
+ push :
5
+ branches :
6
+ - " **"
7
+
8
+ env :
9
+ python_version : " 3.9"
10
+
11
+ jobs :
12
+ format-code :
13
+ runs-on : ubuntu-latest
14
+ if : ${{ github.repository_owner != 'mlcommons' }}
15
+ steps :
16
+ - uses : actions/checkout@v4
17
+ with :
18
+ fetch-depth : 0
19
+ ssh-key : ${{ secrets.DEPLOY_KEY }}
20
+ - name : Set up Python ${{ env.python_version }}
21
+ uses : actions/setup-python@v3
22
+ with :
23
+ python-version : ${{ env.python_version }}
24
+
25
+ - name : Format modified python files
26
+ run : |
27
+ python3 -m pip install black
28
+ for FILE in $(git diff --name-only ${{ github.event.before }} | grep -E '.*\.py$')
29
+ do
30
+ black $FILE
31
+ git add $FILE
32
+ done
33
+
34
+
35
+ - name : Commit and Push
36
+ run : |
37
+ HAS_CHANGES=$(git diff --staged --name-only)
38
+ if [ -n "$HAS_CHANGES" ]; then
39
+ git config --global user.name mlcommons-bot
40
+ git config --global user.email "[email protected] "
41
+ # Commit changes
42
+ git commit -m '[Automated Commit] Format Codebase'
43
+ git push
44
+
45
+ # Push changes to a new branch
46
+ # BRANCH_NAME="auto/code-format"
47
+ # git branch $BRANCH_NAME
48
+ # git push origin $BRANCH_NAME --force
49
+
50
+ # Create a pull request to the "code-format" branch
51
+ # gh pr create --base code-format --head $BRANCH_NAME --title "[Automated PR] Format Codebase" --body "This pull request contains automated code formatting changes."
52
+ fi
53
+ # env:
54
+ # GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
Original file line number Diff line number Diff line change @@ -443,7 +443,12 @@ def get(
443
443
f"{ ', ' .join (unused_options )} "
444
444
)
445
445
446
- unused_sections = set (conf .sections ()) - {"server" , "ptd" }
446
+ unused_sections = (
447
+ set (conf .sections ())
448
+ - {"server" , "ptd" }
449
+ - set ([i for i in conf .sections () if i .startswith ("analyzer" )])
450
+ )
451
+
447
452
if len (unused_sections ) != 0 :
448
453
logging .warning (
449
454
f"{ filename } : ignoring unknown sections: { ', ' .join (unused_sections )} "
You can’t perform that action at this time.
0 commit comments