Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
Checks: >
-*,
cppcoreguidelines-non-private-member-variables-in-classes,
cppcoreguidelines-prefer-member-initializer,
cppcoreguidelines-pro-type-cstyle-cast,
misc-const-correctness,
misc-unused-parameters,
modernize-loop-convert,
modernize-use-auto,
modernize-use-nullptr,
readability-magic-numbers
readability-braces-around-statements,
readability-identifier-naming,
readability-make-member-function-const,
performance-for-range-copy,
performance-enum-size,
performance-move-const-arg,
performance-no-automatic-move,
performance-noexcept-destructor,
performance-noexcept-move-constructor,
performance-noexcept-swap,
performance-unnecessary-copy-initialization,
performance-unnecessary-value-param,
performance-use-std-move,
performance-move-constructor-init,
HeaderFilterRegex: 'src/.*'
WarningsAsErrors: '*'
CheckOptions:
- key: readability-identifier-naming.VariableCase
value: camelBack
- key: readability-identifier-naming.FunctionCase
value: camelBack
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.MemberCase
value: camelBack
- key: misc-const-correctness.TransformValues
value: 'true'
# required because using "-fix" puts "const" after the typename instead of before
- key: misc-const-correctness.TransformValues
value: 'false'
- key: misc-const-correctness.TransformReferences
value: 'false'
- key: misc-const-correctness.TransformPointersAsValues
value: 'false'
- key: misc-const-correctness.TransformPointersAsPointers
value: 'false'
...
56 changes: 51 additions & 5 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,63 @@ jobs:
- name: Uninstall old conflicting packages
run: sudo apt purge --assume-yes --auto-remove llvm python3-lldb-14 llvm-14

- name: Install automatic LLVM 16
run: wget https://apt.llvm.org/llvm.sh -O /tmp/llvm-install.sh; chmod +x /tmp/llvm-install.sh; sudo /tmp/llvm-install.sh 16
- name: Install automatic LLVM 20
run: wget https://apt.llvm.org/llvm.sh -O /tmp/llvm-install.sh; chmod +x /tmp/llvm-install.sh; sudo /tmp/llvm-install.sh 20

- name: Install clang-format-16
run: sudo apt --assume-yes install clang-format-16
- name: Install clang-format-20
run: sudo apt --assume-yes install clang-format-20

- name: Install gitpython
run: sudo pip install gitpython

- name: Run clang-format
run: |
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-16 160
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-20 200
clang-format --version
python scripts/clang-format.py --check --verbose

clang-tidy:
needs: changes
# if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Build Dependencies
run: |
sudo apt update
sudo apt install -y \
build-essential cmake ninja-build meson \
qt6-base-dev qt6-tools-dev \
qt6-tools-dev-tools libqt6svg6-dev libqt6core5compat6-dev \
libqt6svgwidgets6 qt6-l10n-tools \
libgl1-mesa-dev libglu1-mesa-dev

- name: Install automatic LLVM 20
run: wget https://apt.llvm.org/llvm.sh -O /tmp/llvm-install.sh; chmod +x /tmp/llvm-install.sh; sudo /tmp/llvm-install.sh 20

- name: Install clang-tidy-20
run: |
sudo apt --assume-yes install clang-tidy-20

- name: CMake Configuration
run: |
cmake -S . -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCUTTER_QT=6 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON

- name: Run autogen
run: |
cmake --build build --target Cutter_autogen

- name: Run Clang-Tidy
run: |
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-20 200
sudo update-alternatives --install /usr/bin/run-clang-tidy run-clang-tidy /usr/bin/run-clang-tidy-20 200
clang-tidy -version
python3 scripts/clang-tidy.py
15 changes: 8 additions & 7 deletions _clang-format
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Do not edit this file! Automatically generated using scripts/udate_clang_format.sh and scripts/_clang_format
# See update_clang_format.sh for more information.
# generated using clang-format version 8.0.0-3~ubuntu16.04.1 (tags/RELEASE_800/final)
# generated using clang-format version 8.0.1
---
Language: Cpp
AccessModifierOffset: -4
Expand Down Expand Up @@ -67,14 +67,14 @@ ForEachMacros:
- QBENCHMARK
- QBENCHMARK_ONCE
- CutterRzListForeach
IncludeBlocks: Preserve
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
- Regex: '^"([^"]*)"'
Priority: 1
- Regex: '^<[Qq]'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
Priority: 3
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: AfterHash
Expand All @@ -101,7 +101,7 @@ PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
SortIncludes: false
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false
Expand All @@ -125,3 +125,4 @@ StatementMacros:
TabWidth: 8
UseTab: Never
...

2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# -- Project information -----------------------------------------------------

project = 'Cutter'
copyright = '2020, The Cutter Developers'
copyright = '2026, The Cutter Developers'
author = 'The Cutter Developers'

# The short X.Y version
Expand Down
Loading
Loading