Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .gersemirc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# yamllint disable-line rule:line-length
# yaml-language-server: $schema=https://raw.githubusercontent.com/BlankSpruce/gersemi/master/gersemi/configuration.schema.json

line_length: 100
list_expansion: "favour-expansion"
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.16.3)
project(YSTDLIB_CPP LANGUAGES CXX)

set(YSTDLIB_CPP_VERSION "0.0.1" CACHE STRING "Project version.")
2 changes: 2 additions & 0 deletions lint-requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
colorama>=0.4.6
gersemi>=0.16.2
yamllint>=1.35.1
46 changes: 46 additions & 0 deletions taskfiles/lint-cmake.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: "3"

tasks:
cmake-check:
desc: "Runs the CMake linters."
sources: &cmake_format_src_files
- "{{.ROOT_DIR}}/**/*.cmake"
- "{{.ROOT_DIR}}/**/*.cmake.in"
- "{{.ROOT_DIR}}/**/CMakeLists.txt"
- "{{.TASKFILE}}"
- exclude: "{{.ROOT_DIR}}/**/build/*"
- exclude: "{{.ROOT_DIR}}/**/submodules/*"
- exclude: "{{.ROOT_DIR}}/**/tools/*"
cmds:
- task: "gersemi"
vars:
FLAGS: "--diff --color"
- task: "gersemi"
silent: true
vars:
FLAGS: "--check"

cmake-fix:
desc: "Runs the CMake linters and fixes all violations."
sources: *cmake_format_src_files
cmds:
- task: "gersemi"
vars:
FLAGS: "--in-place"

gersemi:
internal: true
requires:
vars:
- "FLAGS"
dir: "{{.ROOT_DIR}}"
deps:
- "venv"
cmds:
- |-
. "{{.G_LINT_VENV_DIR}}/bin/activate"
find . \
\( -path '**/build' -o -path '**/submodules' -o -path '**/tools' \) -prune -o \
\( -iname "CMakeLists.txt" -o -iname "*.cmake" -o -iname "*.cmake.in" \) \
-print0 | \
xargs -0 --no-run-if-empty gersemi {{.FLAGS}}
6 changes: 6 additions & 0 deletions taskfiles/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
version: "3"

includes:
cmake:
flatten: true
taskfile: "./lint-cmake.yaml"
yaml:
flatten: true
taskfile: "./lint-yaml.yaml"
Expand All @@ -13,11 +16,13 @@ tasks:
check:
desc: "Runs the full suite of linters to identify warnings and violations."
cmds:
- task: "cmake-check"
- task: "yaml-check"

fix:
desc: "Runs the full suite of linters and fixes some violations."
cmds:
- task: "cmake-fix"
- task: "yaml-fix"

venv:
Expand All @@ -31,6 +36,7 @@ tasks:
- "lint-requirements.txt"
generates:
- "{{.CHECKSUM_FILE}}"
run: "once"
deps:
- ":init"
- task: ":utils:validate-checksum"
Expand Down
Loading