Skip to content

Commit

Permalink
fix: git-clang-format doesn't recognize no changes requested on given…
Browse files Browse the repository at this point in the history
… files (#835)
  • Loading branch information
legendecas committed Nov 20, 2020
1 parent 1427b3e commit 59c6a6a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
"predev:incremental": "node-gyp configure build -C test --debug",
"dev:incremental": "node test",
"doc": "doxygen doc/Doxyfile",
"lint": "node scripts/clang-format.js",
"lint": "node tools/clang-format.js",
"lint:fix": "git-clang-format"
},
"pre-commit": "lint",
Expand Down
8 changes: 7 additions & 1 deletion tools/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Migration Script
# Tools

## clang-format

The clang-format checking tools is designed to check changed lines of code compared to given git-refs.

## Migration Script

The migration tool is designed to reduce repetitive work in the migration process. However, the script is not aiming to convert every thing for you. There are usually some small fixes and major reconstruction required.

Expand Down
3 changes: 2 additions & 1 deletion scripts/clang-format.js → tools/clang-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ function main(args) {
}

const clangFormatOutput = result.stdout.trim();
if (clangFormatOutput !== ('no modified files to format') &&
if (clangFormatOutput !== '' &&
clangFormatOutput !== ('no modified files to format') &&
clangFormatOutput !== ('clang-format did not modify any files')) {
console.error(clangFormatOutput);
const fixCmd = '"npm run lint:fix"';
Expand Down

0 comments on commit 59c6a6a

Please sign in to comment.