Skip to content

Commit d0360af

Browse files
committed
fix: add clang-tidy
1 parent d0b2dba commit d0360af

File tree

5 files changed

+26
-11
lines changed

5 files changed

+26
-11
lines changed

.clang-format

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
Language: Cpp
33
# BasedOnStyle: Google
44
AccessModifierOffset: -4
5-
AlignAfterOpenBracket: false
6-
AlignConsecutiveAssignments: false
5+
AlignAfterOpenBracket: "DontAlign"
6+
AlignConsecutiveAssignments: "None"
77
AlignEscapedNewlinesLeft: false
8-
AlignOperands: false
8+
AlignOperands: "DontAlign"
99
AlignTrailingComments: false
1010
AllowAllParametersOfDeclarationOnNextLine: true
11-
AllowShortBlocksOnASingleLine: false
11+
AllowShortBlocksOnASingleLine: "Never"
1212
AllowShortCaseLabelsOnASingleLine: false
1313
AllowShortFunctionsOnASingleLine: Empty
14-
AllowShortIfStatementsOnASingleLine: true
14+
AllowShortIfStatementsOnASingleLine: "AllIfsAndElse"
1515
AllowShortLoopsOnASingleLine: true
1616
AlwaysBreakAfterDefinitionReturnType: None
1717
AlwaysBreakBeforeMultilineStrings: true
18-
AlwaysBreakTemplateDeclarations: true
18+
AlwaysBreakTemplateDeclarations: "Yes"
1919
BinPackArguments: true
2020
BinPackParameters: true
2121
BreakBeforeBinaryOperators: NonAssignment
@@ -64,6 +64,7 @@ SpacesInSquareBrackets: false
6464
Standard: Auto
6565
TabWidth: 4
6666
UseTab: Never
67+
RemoveSemicolon: true
6768

6869
IncludeBlocks: Regroup
6970
IncludeCategories:

.clang-tidy

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
Checks: "*, -abseil-*, -altera-*, -android-*, -fuchsia-*, google-*,
3+
-google-runtime-int, -llvm*, -modernize-use-trailing-return-type, -zircon-*,
4+
readability-else-after-return, readability-static-accessed-through-instance,
5+
readability-avoid-const-params-in-decls,
6+
cppcoreguidelines-non-private-member-variables-in-classes,
7+
misc-non-private-member-variables-in-classes, -*-non-private-member-variables-in-classes,-misc-include-cleaner"
8+
WarningsAsErrors: ""
9+
HeaderFilterRegex: ""
10+
FormatStyle: none

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
"files.exclude": {
77
"**/.DS_Store": true,
88
"**/Thumbs.db": true,
9-
"**/.cache": true,
9+
"**/.cache": true
1010
}
1111
}

examples/v5-compat/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ const pub = zmq.socket("pub")
44
const sub = zmq.socket("sub")
55

66
pub.bind("tcp://*:3456", err => {
7-
if (err) throw err
7+
if (err) {
8+
throw err
9+
}
810

911
sub.connect("tcp://127.0.0.1:3456")
1012

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,14 @@
101101
"test": "run-s clean.temp build && mocha",
102102
"test.skip_gc_tests": "run-s clean.temp build.debug && cross-env SKIP_GC_TESTS=true mocha",
103103
"test.electron.main": "run-s clean.temp build && electron-mocha",
104-
"format": "prettier --write .",
104+
"format": "run-s format.prettier format.clang-format",
105+
"format.prettier": "prettier --write .",
106+
"format.clang-format": "clang-format -i -style=file ./src/*.cc ./src/*.h ./src/util/*.h",
105107
"test.electron.renderer": "run-s build && electron-mocha --renderer",
106-
"lint.clang-format": "clang-format -i -style=file ./src/*.cc ./src/*.h ./src/util/*.h",
107108
"lint-test.eslint": "eslint ./**/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml} --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/",
108109
"lint.eslint": "pnpm run lint-test.eslint --fix",
109-
"lint": "run-p lint.eslint lint.clang-format",
110+
"lint.clang-tidy": "git ls-files --exclude-standard | grep -E '\\.(cpp|hpp|c|cc|cxx|hxx|h|ixx)$' | xargs -n 1 -P $(nproc) clang-tidy --fix ",
111+
"lint": "run-p format lint.eslint format",
110112
"lint-test": "run-s lint-test.eslint",
111113
"bench": "node --expose-gc test/bench",
112114
"prepublishOnly": "pnpm run build.js",

0 commit comments

Comments
 (0)