Skip to content

Commit 90af964

Browse files
authored
Clazy support (#1948)
* Add Clazy linter * Ignore thirdparty dirs * Run only for modified files * Treat all warnings as errors (?)
1 parent 738219c commit 90af964

File tree

4 files changed

+28
-7
lines changed

4 files changed

+28
-7
lines changed

.github/workflows/common_build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
uses: ./.github/workflows/setup_environment.yml
4141
with:
4242
os: ubuntu-latest
43-
lint: true
43+
lint_vera: true
4444
build: false
4545
build_installer: false
4646

@@ -93,6 +93,7 @@ jobs:
9393
build_installer: false
9494
qmake_extra: "CONFIG+=tests CONFIG+=noPch CONFIG+=ccache CONFIG+=no-sanitizers CONFIG+=use_system_qscintilla2 CONFIG+=use_system_quazip"
9595
trik_python3_version_minor: 10
96+
lint_clazy: true
9697

9798
build-ubuntu-debug-tests:
9899
needs: lint

.github/workflows/setup_environment.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ on:
1010
required: false
1111
type: string
1212
default: "time"
13-
lint:
13+
lint_vera:
14+
required: false
15+
type: boolean
16+
default: false
17+
lint_clazy:
1418
required: false
1519
type: boolean
1620
default: false
@@ -99,7 +103,7 @@ jobs:
99103
uses: actions/checkout@v4
100104
with:
101105
submodules: recursive
102-
fetch-depth: 0
106+
fetch-depth: 2
103107

104108
- name: Remove thirdparty submodules (use from libs from distro)
105109
run: |
@@ -124,11 +128,11 @@ jobs:
124128
INSTALL_INSTALLER_ENVIRONMENT: ${{ inputs.linux_installer_environment }}
125129
if: ${{ inputs.build }}
126130

127-
- name: Lint
131+
- name: Lint Vera
128132
run: |
129133
sudo apt-get update && sudo apt-get install -y --no-install-recommends qttools5-dev-tools qtbase5-dev vera++
130134
${{ inputs.executor }} buildScripts/github/vera_translation.sh
131-
if: ${{ inputs.lint }}
135+
if: ${{ inputs.lint_vera }}
132136

133137
- name: Restore cache
134138
uses: actions/cache@v4
@@ -152,6 +156,7 @@ jobs:
152156
CONFIG: ${{ inputs.config }}
153157
EXECUTOR: ${{ inputs.executor }}
154158
QMAKE_EXTRA: ${{ inputs.qmake_extra }}
159+
NEED_COMPILE_DATABASE: ${{ inputs.lint_clazy }}
155160
if: ${{ inputs.build }}
156161

157162
- name: Save build cache
@@ -168,6 +173,17 @@ jobs:
168173
TESTS: ${{ inputs.tests }}
169174
if: ${{ inputs.build == true }}
170175

176+
- name: Clazy-standalone
177+
uses: MinyazevR/clazy-standalone-action@v0.3.2
178+
with:
179+
checks: 'level0,level1,level2'
180+
database: './compile_commands.json'
181+
fail-on-warning: true
182+
install-stable: true
183+
only-diff: true
184+
ignore-dirs: '^(buildScripts|thirdparty|installer)$'
185+
if: ${{ inputs.lint_clazy }}
186+
171187
- name: Build Installer
172188
run: |
173189
buildScripts/github/build_installer.sh

buildScripts/github/build_internal.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ rm -f .qmake.cache
1515
qmake -Wall PYTHON_VERSION=3.$TRIK_PYTHON3_VERSION_MINOR PYTHON_PATH=/usr CONFIG+=$CONFIG $QMAKE_EXTRA $PROJECT.pro
1616
make -j $(nproc) qmake_all 2>&1 | tee -a build.log
1717
ccache -s
18-
make -j $(nproc) all 2>&1 | tee -a build.log
18+
if [ "$NEED_COMPILE_DATABASE" = "true" ]; then
19+
bear -- make -j $(nproc) all 2>&1 | tee -a build.log
20+
else
21+
make -j $(nproc) all 2>&1 | tee -a build.log
22+
fi
1923
ccache -s
2024
ls bin

buildScripts/github/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ case "$(uname)" in
5353
elif [ "$ID" = "ubuntu" ]; then
5454
sudo apt-get update && sudo apt-get install -y --no-install-recommends ccache curl libusb-1.0-0-dev \
5555
make qtscript5-dev qttools5-dev-tools qtmultimedia5-dev libqt5serialport5-dev libqt5svg5-dev \
56-
libudev-dev "$TRIK_PYTHON"-dev qtbase5-private-dev qtwayland5 libqscintilla2-qt5-dev libquazip5-dev
56+
libudev-dev "$TRIK_PYTHON"-dev qtbase5-private-dev qtwayland5 libqscintilla2-qt5-dev libquazip5-dev bear
5757
elif [[ "$ID" = "rocky" || "$ID" = '"rocky"' ]]; then
5858
GCC_VERSION=${GCC_VERSION:-13}
5959
sudo yum update -y && sudo yum install -y --setopt=install_weak_deps=False epel-release

0 commit comments

Comments
 (0)