Skip to content

Commit

Permalink
chore: fixup linter commands
Browse files Browse the repository at this point in the history
  • Loading branch information
legendecas committed Mar 19, 2021
1 parent 87b7aae commit 1e6d899
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: CLANG_FORMAT_START=refs/remotes/origin/main npm run lint
- run: CLANG_FORMAT_START=refs/remotes/origin/main npm run lint:ci
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,9 @@
"predev:incremental": "node-gyp configure build -C test --debug",
"dev:incremental": "node test",
"doc": "doxygen doc/Doxyfile",
"lint": "node tools/clang-format.js",
"lint:fix": "git-clang-format '*.h', '*.cc'"
"lint": "git-clang-format --diff '*.h' '*.cc'",
"lint:ci": "node tools/clang-format.js",
"lint:fix": "git-clang-format '*.h' '*.cc'"
},
"pre-commit": "lint",
"version": "3.1.0",
Expand Down
6 changes: 3 additions & 3 deletions tools/clang-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ function main(args) {
clangFormatOutput !== ('no modified files to format') &&
clangFormatOutput !== ('clang-format did not modify any files')) {
console.error(clangFormatOutput);
const fixCmd = '"npm run lint:fix"';
const fixCmd = 'npm run lint:fix';
console.error(`
ERROR: please run ${fixCmd} to format changes in your commit
ERROR: please run "${fixCmd}" to format changes in your commit
Note that when running the command locally, please keep your local
main branch and working branch up to date with nodejs/node-addon-api
to exclude un-related complains.
Or you can run "env CLANG_FORMAT_START=upstream/main ${fixCmd}".`);
Or you can run "env CLANG_FORMAT_START=upstream/main ${fixCmd}" to fix un-staged changes.`);
return 1;
}
}
Expand Down

0 comments on commit 1e6d899

Please sign in to comment.