Skip to content

Commit

Permalink
Merge pull request #482 from imperialCHEPI/remove_prettier_hook
Browse files Browse the repository at this point in the history
pre-commit: Replace prettier hook with separate JSON and YAML formatters
  • Loading branch information
alexdewar authored Aug 12, 2024
2 parents 3e19acc + a5b8e2b commit 4cfa3c2
Show file tree
Hide file tree
Showing 9 changed files with 245 additions and 112 deletions.
81 changes: 40 additions & 41 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,45 +1,44 @@
---
Checks: >
# Checks to include
clang-diagnostic-*,
clang-analyzer-*,
bugprone-*,
readability-*,
modernize-*,
performance-*,
misc-*,
cppcoreguidelines-*,
# Checks to include
clang-diagnostic-*,
clang-analyzer-*,
bugprone-*,
readability-*,
modernize-*,
performance-*,
misc-*,
cppcoreguidelines-*,
# Checks to exclude
-*,
-clang-analyzer-osx.*,
-clang-analyzer-fuchsia.*,
-clang-analyzer-optin.osx.*,
-bugprone-easily-swappable-parameters,
-bugprone-narrowing-conversions,
-modernize-use-trailing-return-type,
-modernize-use-nodiscard,
-readability-identifier-length,
-readability-implicit-bool-conversion,
-readability-uppercase-literal-suffix,
-readability-magic-numbers,
-readability-isolate-declaration,
-misc-const-correctness,
-misc-include-cleaner,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-narrowing-conversions,
-cppcoreguidelines-init-variables,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-do-while,
-cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-special-member-functions,
-cppcoreguidelines-macro-usage,
# Checks to exclude
-*,
-clang-analyzer-osx.*,
-clang-analyzer-fuchsia.*,
-clang-analyzer-optin.osx.*,
-bugprone-easily-swappable-parameters,
-bugprone-narrowing-conversions,
-modernize-use-trailing-return-type,
-modernize-use-nodiscard,
-readability-identifier-length,
-readability-implicit-bool-conversion,
-readability-uppercase-literal-suffix,
-readability-magic-numbers,
-readability-isolate-declaration,
-misc-const-correctness,
-misc-include-cleaner,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-narrowing-conversions,
-cppcoreguidelines-init-variables,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-do-while,
-cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-special-member-functions,
-cppcoreguidelines-macro-usage,
CheckOptions:
- key: readability-function-cognitive-complexity.IgnoreMacros
value: true
- key: readability-function-cognitive-complexity.IgnoreMacros
value: true
FormatStyle: LLVM
WarningsAsErrors: "*"
WarningsAsErrors: '*'
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
- package-ecosystem: github-actions
directory: /
schedule:
interval: "weekly"
interval: weekly
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
is_main: true

env:
VCPKG_ROOT: "vcpkg"
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
VCPKG_ROOT: vcpkg
VCPKG_BINARY_SOURCES: clear;x-gha,readwrite

# Update when there is a new version of gcc available
LATEST_GCC_VERSION: 13
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
with:
build_dir: out/build/linux-debug
config_file: .clang-tidy
lgtm_comment_body: ""
lgtm_comment_body: ''

# Uploads an artefact containing clang_fixes.json
- uses: ZedThree/clang-tidy-review/[email protected]
Expand All @@ -98,12 +98,12 @@ jobs:

- uses: ammaraskar/gcc-problem-matcher@master
- name: Build HealthGPS (debug)
if: "!cancelled()" # Run this step, even if the previous one fails
if: '!cancelled()' # Run this step, even if the previous one fails
run: |
cmake --build --preset=debug-build-${{ matrix.platform }} --target=install
- name: Build HealthGPS (release)
if: "!cancelled()" # Run this step, even if the previous one fails
if: '!cancelled()' # Run this step, even if the previous one fails
run: |
# Build documentation so we can show Doxygen warnings
cmake --preset=${{ matrix.platform }}-release -DWARNINGS_AS_ERRORS=ON -DBUILD_DOC=ON
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ permissions:
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
group: pages
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-22.04
env:
VCPKG_ROOT: "vcpkg"
VCPKG_BINARY_SOURCES: "clear;nuget,GitHub,readwrite"
VCPKG_ROOT: vcpkg
VCPKG_BINARY_SOURCES: clear;nuget,GitHub,readwrite
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
19 changes: 11 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,35 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: fix-byte-order-marker
- id: check-merge-conflict
- id: check-json
- id: check-yaml
- id: trailing-whitespace
- id: end-of-file-fixer
- id: pretty-format-json
args: [--autofix, --indent, '4', --no-sort]
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.14.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '2', --offset, '2']
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.1
hooks:
- id: check-github-workflows
- id: check-metaschema
files: "schemas/.*"
files: schemas/.*
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.8
hooks:
- id: clang-format
files: '.*\.(h|cpp)'
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
files: '(.*\.(json|yaml|yml)|\.clang-tidy)$'
files: .*\.(h|cpp)
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.41.0
hooks:
- id: markdownlint
args: ["--disable", "MD013", "MD041", "--"]
args: [--disable, MD013, MD041, --]
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
Expand Down
5 changes: 4 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"recommendations": ["ms-vscode.cpptools", "davidanson.vscode-markdownlint"]
"recommendations": [
"ms-vscode.cpptools",
"davidanson.vscode-markdownlint"
]
}
10 changes: 7 additions & 3 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
{
"version": 2,
"configurePresets": [
{
Expand All @@ -25,7 +25,9 @@
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": ["Linux"]
"hostOS": [
"Linux"
]
},
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}"
Expand Down Expand Up @@ -60,7 +62,9 @@
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": ["Windows"]
"hostOS": [
"Windows"
]
}
}
},
Expand Down
Loading

0 comments on commit 4cfa3c2

Please sign in to comment.