davids5 commented on a change in pull request #2: Master pr nxstyle improvments URL: https://github.com/apache/incubator-nuttx/pull/2#discussion_r360794087
########## File path: tools/check_code_style.sh ########## @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +if [ -z "$1" ]; then + FILES=$(git diff master --name-only); +else + FILES=$1 +fi + +DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +for FILE in $FILES; do + FILENAME=$(basename $FILE) + FILE_EXT="${FILENAME#*.}" + if [ -f "$FILE" ]; then + if [ "$FILE_EXT" = "c" ] || [ "$FILE_EXT" = "h" ]; then + CHECK_FAILED=$(${DIR}/nxstyle $FILE) + # if [ -n "$CHECK_FAILED" ]; then + # ${DIR}/fix_code_style.sh --quiet < $FILE > $FILE.pretty + # + # echo + # git --no-pager diff --no-index --minimal --histogram --color=always $FILE $FILE.pretty + # rm -f $FILE.pretty Review comment: @patacongo - we can add a test for git. and address all you other concerns, that is not a problem. But I think you should think about this again over morning coffee. This does not break anyone's build.* It is a makefile helper and command line option to help them ONLY check the files they changed. They will need git installed to do this. @patacongo It is True it will not work on window util someone who works on windows make the changes. I do not work on windows so I will not do this. Because I will not be able to test it - and it will be wrong. I do not add Value there. - You could. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services