Skip to content

Commit

Permalink
MNT: add pre-commit hooks for clang-format and other checks
Browse files Browse the repository at this point in the history
Upgrade CI clang-format to v16
  • Loading branch information
JJL772 committed Aug 15, 2023
1 parent 8134694 commit c99ce62
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-scripts-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: clang-format check
uses: jidicula/clang-format-action@v4.8.0
uses: jidicula/clang-format-action@v4.11.0
with:
clang-format-version: '14'
clang-format-version: '16'
check-path: 'ek9000App'
exclude-regex: 'terminals.h'

Expand Down
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: no-commit-to-branch
- id: check-merge-conflict
- id: check-json
- id: check-symlinks
- id: fix-byte-order-marker
- id: check-ast
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
hooks:
- id: clang-format
types_or: [c++, c]
2 changes: 1 addition & 1 deletion ek9000App/src/devEK9000.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include <dbStaticLib.h>

/* Modbus or asyn includes */
//#include <drvModbusAsyn.h>
// #include <drvModbusAsyn.h>
#include <drvAsynIPPort.h>
#include <modbusInterpose.h>

Expand Down
10 changes: 7 additions & 3 deletions ek9000App/src/ekUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,15 @@ namespace util
#if __cplusplus >= 201103L
using std::is_same;
#else
template <class T, class U> struct is_same { static bool value; };
template <class T, class U> struct is_same {
static bool value;
};

template <class T, class U> bool is_same<T, U>::value = false;

template <class T> struct is_same<T, T> { static bool value; };
template <class T> struct is_same<T, T> {
static bool value;
};

template <class T> bool is_same<T, T>::value = true;
#endif
Expand Down Expand Up @@ -200,7 +204,7 @@ concept INPUT_RECORD = requires(T a) {
} // namespace detail

template <typename T>
concept RECORD_TYPE = detail::BASE_RECORD<T> &&(detail::INPUT_RECORD<T> || detail::OUTPUT_RECORD<T>);
concept RECORD_TYPE = detail::BASE_RECORD<T> && (detail::INPUT_RECORD<T> || detail::OUTPUT_RECORD<T>);

template <typename T>
concept NUMERIC_TYPE = std::same_as<T, epicsInt32> || std::same_as<T, epicsUInt32> || std::same_as<T, epicsInt16> ||
Expand Down

0 comments on commit c99ce62

Please sign in to comment.