-
Notifications
You must be signed in to change notification settings - Fork 7
103 lines (99 loc) · 3.29 KB
/
lint.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Lint the code
on:
pull_request:
branches: [main, develop]
paths-ignore:
- '**/README.md'
jobs:
lint:
name: lint the dart code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_ASSETS_KEY }}
- name: Create env file
run: |
touch .env
echo -e "${{ secrets.DEV_ENV }}" | sed 's/\\n/\n/g' >> .env
cat .env
- name: Submoudles update
run: git -c submodule.auto-test.update=none submodule update --init --recursive
- run: flutter pub get
- uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install codespell
run: pip install codespell
- name: Get changed files
id: changed-files
run: |
if ${{ github.event_name == 'pull_request' }}; then
echo "changed_files=$(git diff --name-only -r HEAD^1 HEAD --diff-filter=ACMRTUXB | xargs)" >> $GITHUB_OUTPUT
else
echo "changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} --diff-filter=ACMRTUXB | xargs)" >> $GITHUB_OUTPUT
fi
- name: Code review and auto-fix the changed files
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for file in ${{ steps.changed-files.outputs.changed_files }}; do
echo "fixing: $file"
if [[ $file == *.dart ]]; then
flutter analyze --no-preamble $file | reviewdog -efm="%p%t%r • %m • %f:%l:%c • %s" -name=flutter-analyze -reporter=github-pr-review
dart format $file
dart fix --apply $file
else
echo "skipping non-Go file: $file"
fi
codespell -q 3 -w -I .codespellignore --skip "**/*.g.dart,*.svg" $file | reviewdog -efm="%f:%l: %m" -name=codespell -reporter=github-pr-review || true
done
- name: suggester / dart fixes
uses: reviewdog/action-suggester@v1
with:
tool_name: dart fix
filter_mode: added
cleanup: true
gitleaks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: gitleaks
uses: reviewdog/action-gitleaks@v1
with:
reporter: github-pr-review
dotenv-linter:
name: runner / dotenv-linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run dotenv-linter with code suggestions
uses: dotenv-linter/action-dotenv-linter@v2
with:
reporter: github-code-suggestions
misspell:
name: Check code spelling
runs-on: ubuntu-latest
steps:
- name: Check out code.
uses: actions/checkout@v4
- name: misspell
uses: reviewdog/action-misspell@v1
with:
reporter: github-pr-review
level: warning
locale: "US"
pattern: |
*.dart
*.swift
*.kt