Skip to content

Commit 67566f7

Browse files
committed
Merge branch 'main' into add-cpp-lint
2 parents cbb762c + 3b6997f commit 67566f7

File tree

5 files changed

+62
-0
lines changed

5 files changed

+62
-0
lines changed

.gersemirc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# yamllint disable-line rule:line-length
2+
# yaml-language-server: $schema=https://raw.githubusercontent.com/BlankSpruce/gersemi/master/gersemi/configuration.schema.json
3+
4+
line_length: 100
5+
list_expansion: "favour-expansion"

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
cmake_minimum_required(VERSION 3.16.3)
2+
project(YSTDLIB_CPP LANGUAGES CXX)
3+
4+
set(YSTDLIB_CPP_VERSION "0.0.1" CACHE STRING "Project version.")

lint-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
clang-format>=19.1.6
2+
colorama>=0.4.6
3+
gersemi>=0.16.2
24
yamllint>=1.35.1

taskfiles/lint-cmake.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
version: "3"
2+
3+
tasks:
4+
cmake-check:
5+
desc: "Runs the CMake linters."
6+
sources: &cmake_format_src_files
7+
- "{{.ROOT_DIR}}/**/*.cmake"
8+
- "{{.ROOT_DIR}}/**/*.cmake.in"
9+
- "{{.ROOT_DIR}}/**/CMakeLists.txt"
10+
- "{{.TASKFILE}}"
11+
- exclude: "{{.ROOT_DIR}}/**/build/*"
12+
- exclude: "{{.ROOT_DIR}}/**/submodules/*"
13+
- exclude: "{{.ROOT_DIR}}/**/tools/*"
14+
cmds:
15+
- task: "gersemi"
16+
vars:
17+
FLAGS: "--diff --color"
18+
- task: "gersemi"
19+
silent: true
20+
vars:
21+
FLAGS: "--check"
22+
23+
cmake-fix:
24+
desc: "Runs the CMake linters and fixes all violations."
25+
sources: *cmake_format_src_files
26+
cmds:
27+
- task: "gersemi"
28+
vars:
29+
FLAGS: "--in-place"
30+
31+
gersemi:
32+
internal: true
33+
requires:
34+
vars:
35+
- "FLAGS"
36+
dir: "{{.ROOT_DIR}}"
37+
deps:
38+
- "venv"
39+
cmds:
40+
- |-
41+
. "{{.G_LINT_VENV_DIR}}/bin/activate"
42+
find . \
43+
\( -path '**/build' -o -path '**/submodules' -o -path '**/tools' \) -prune -o \
44+
\( -iname "CMakeLists.txt" -o -iname "*.cmake" -o -iname "*.cmake.in" \) \
45+
-print0 | \
46+
xargs -0 --no-run-if-empty gersemi {{.FLAGS}}

taskfiles/lint.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
version: "3"
22

33
includes:
4+
cmake:
5+
flatten: true
6+
taskfile: "./lint-cmake.yaml"
47
cpp:
58
flatten: true
69
taskfile: "./lint-cpp.yaml"
@@ -18,12 +21,14 @@ tasks:
1821
check:
1922
desc: "Runs the full suite of linters to identify warnings and violations."
2023
cmds:
24+
- task: "cmake-check"
2125
- task: "cpp-check"
2226
- task: "yaml-check"
2327

2428
fix:
2529
desc: "Runs the full suite of linters and fixes some violations."
2630
cmds:
31+
- task: "cmake-fix"
2732
- task: "cpp-fix"
2833
- task: "yaml-fix"
2934

0 commit comments

Comments
 (0)