File tree 2 files changed +55
-1
lines changed 2 files changed +55
-1
lines changed Original file line number Diff line number Diff line change 1
- name : clang-tools code analysis
1
+ name : code analysis
2
2
3
3
on : pull_request
4
4
# push:
30
30
run : sudo apt-get install -y clang-format
31
31
- name : run clang-format script
32
32
run : .ci/format_script.sh
33
+
34
+ ruff :
35
+ if : |
36
+ (github.repository_owner == 'root-project' && github.event_name != 'pull_request') ||
37
+ (github.event_name == 'pull_request' && !contains(github.event.pull_request.title, '[skip-ci]'))
38
+
39
+ runs-on : ubuntu-latest
40
+ steps :
41
+ - name : Checkout code
42
+ uses : actions/checkout@v4
43
+
44
+ - name : Get the list of changed files
45
+ id : diff
46
+ run : |
47
+ git fetch --depth=1 origin $GITHUB_BASE_REF
48
+ git diff --name-only origin/$GITHUB_BASE_REF > changed_files.txt
49
+
50
+ - name : Install ruff
51
+ uses : astral-sh/ruff-action@v3
52
+ with :
53
+ args : " --version"
54
+
55
+ - name : Lint code
56
+ run : |
57
+ files=$(cat changed_files.txt | grep '\.py$' || echo "")
58
+ if [ -n "$files" ]; then
59
+ echo "$files" | xargs ruff check --diff || true
60
+ echo "$files" | xargs ruff check
61
+ else
62
+ echo "No python files to lint"
63
+ fi
64
+
65
+ - name : Format code
66
+ if : always()
67
+ run : |
68
+ files=$(cat changed_files.txt | grep '\.py$' || echo "")
69
+ if [ -n "$files" ]; then
70
+ echo "$files" | xargs ruff format --diff
71
+ else
72
+ echo "No python files to format"
73
+ fi
Original file line number Diff line number Diff line change
1
+ line-length = 120
2
+
3
+ [lint ]
4
+ select = [
5
+ # Pyflakes
6
+ " F" ,
7
+ # Pycodestyle
8
+ " E4" ,
9
+ " E7" ,
10
+ " E9" ,
11
+ # isort
12
+ " I001"
13
+ ]
You can’t perform that action at this time.
0 commit comments