David Hendricks has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/44095 )
Change subject: git-hooks: Use check-style in pre-commit hook ......................................................................
git-hooks: Use check-style in pre-commit hook
This adds the check-style script to the pre-commit hook and makes some minor changes to warnings printed by the script. Errors are be non-fatal for now.
Change-Id: I58b9e64f825de0ca222277a7d16c3904368edfe6 Signed-off-by: David Hendricks david.hendricks@gmail.com --- M util/git-hooks/pre-commit M util/lint/check-style 2 files changed, 22 insertions(+), 13 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/95/44095/1
diff --git a/util/git-hooks/pre-commit b/util/git-hooks/pre-commit index dbccb9e..db6b256 100755 --- a/util/git-hooks/pre-commit +++ b/util/git-hooks/pre-commit @@ -1,9 +1,22 @@ #!/bin/sh + # -# A hook script to verify what is about to be committed. -# Called by "git commit" with no arguments. The hook should -# exit with non-zero status after issuing an appropriate message if -# it wants to stop the commit. +# This file is part of the flashrom project. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# + +set -e # -o errexit +set -u # -o nounset
# Check for whitespace errors -git diff-index --check --cached HEAD -- || exit 1 +git diff-index --check --cached HEAD -- + +util/lint/check-style diff --git a/util/lint/check-style b/util/lint/check-style index 91ed197..06ced0b 100755 --- a/util/lint/check-style +++ b/util/lint/check-style @@ -89,6 +89,7 @@ printf "Warning: clang-format executable not found.\n" printf "Set the correct path in $(canonicalize_filename "$0").\n" printf "Skipping clang-format style check test.\n" + printf "Changes that violate style guidelines will not be accepted upstream.\n" # exit 1 exit 0 fi @@ -133,12 +134,7 @@ printf "and the clang-format rules:\n\n" cat "$patch"
-printf "\nYou can apply these changes with:\n git apply $patch\n" -printf "(may need to be called from the root directory of your repository)\n" - -# FIXME: clang-format is currently unusable, so don't abort the commit. -# printf "Aborting commit. Apply changes and commit again or skip checking with" -# printf " --no-verify (not recommended).\n" -# exit 1 - +printf "\nApply these changes using:\n" +printf " git apply $patch\n" +printf "Changes that violate style guidelines will not be accepted upstream.\n" exit 0
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/44095
to look at the new patch set (#2).
Change subject: git-hooks: Use check-style in pre-commit hook ......................................................................
git-hooks: Use check-style in pre-commit hook
This adds the check-style script to the pre-commit hook and makes some minor changes to warnings printed by the script. Errors are non-fatal for now.
Change-Id: I58b9e64f825de0ca222277a7d16c3904368edfe6 Signed-off-by: David Hendricks david.hendricks@gmail.com --- M util/git-hooks/pre-commit M util/lint/check-style 2 files changed, 22 insertions(+), 13 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/95/44095/2
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/44095
to look at the new patch set (#3).
Change subject: git-hooks: Add .clang-format and use check-style in pre-commit hook ......................................................................
git-hooks: Add .clang-format and use check-style in pre-commit hook
This patch does the following: - Add .clang-format from CB:38673 - Invoke check-style from the pre-commit hook - Make some small changes to check-style output.
Style errors are considered non-fatal for now.
Change-Id: I58b9e64f825de0ca222277a7d16c3904368edfe6 Signed-off-by: David Hendricks david.hendricks@gmail.com --- A .clang-format M util/git-hooks/pre-commit M util/lint/check-style 3 files changed, 62 insertions(+), 13 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/95/44095/3
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/44095 )
Change subject: git-hooks: Add .clang-format and use check-style in pre-commit hook ......................................................................
Patch Set 3:
(2 comments)
https://review.coreboot.org/c/flashrom/+/44095/3//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/flashrom/+/44095/3//COMMIT_MSG@10 PS3, Line 10: CB:38673 stale?
https://review.coreboot.org/c/flashrom/+/44095/3//COMMIT_MSG@14 PS3, Line 14: Style errors are considered non-fatal for now. Will this not result in the entire tree suddently becoming highly non-conformant?
Should the style changes be done in stages instead? It makes each logical chunk both easier to review and easier to evaluate if it makes sense.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/44095 )
Change subject: git-hooks: Add .clang-format and use check-style in pre-commit hook ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/flashrom/+/44095/3//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/flashrom/+/44095/3//COMMIT_MSG@10 PS3, Line 10: - Add .clang-format from CB:38673 Didn’t you have a “better” alternative to clang-format?
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/44095 )
Change subject: git-hooks: Add .clang-format and use check-style in pre-commit hook ......................................................................
Patch Set 3: Code-Review+1
Didn't uncrustify behave better?