Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MINIFICPP-1203 - Enable header linting in include directories and resolve linter recommendations #789

Commits on Jun 12, 2020

  1. MINIFICPP-1203 - Remove build/include suppression from linter, reorde…

    …r corresponding .cpp files
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    e41f293 View commit details
    Browse the repository at this point in the history
  2. MINIFICPP-1203 - Swap include order in OSUtils.cpp for correct Window…

    …s-specific symbol imports
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    00850d9 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c3dc81c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    7289446 View commit details
    Browse the repository at this point in the history
  5. MINIFICPP-1203 - Add comments to header guard endif according to lint…

    …er recommendations
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "endif line should be" | tr ":" " " | cut -d" " -f1,2,9-12 | xargs -n 3 sh -c 'sed -i "" "$2s;.*;$3;" $1' sh | less
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    c360e0b View commit details
    Browse the repository at this point in the history
  6. MINIFICPP-1203 - Do not mark zero-parameter constructors explicit acc…

    …ording to linter recommendations
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Zero-parameter constructors should not be marked explicit." | tr ":" " " | cut -d" " -f1,2 | xargs -n 2 sh -c 'sed -i "" "$2s/explicit //" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    24a176c View commit details
    Browse the repository at this point in the history
  7. MINIFICPP-1203 - Do not leave blank lines after visibility modifiers …

    …according to linter recommendations
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Do not leave a blank line" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2d" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    557e290 View commit details
    Browse the repository at this point in the history
  8. MINIFICPP-1203 - Add blank lines before visibility modifiers accordin…

    …g to linter recommendations
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "should be preceded by a blank line" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$(expr $2 - 1)G;" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    1b347af View commit details
    Browse the repository at this point in the history
  9. MINIFICPP-1203 - Remove blank lines from the beginning/end of code bl…

    …ocks according to linter recommendations
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Redundant blank line at the start of a code block" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2d" $1' sh
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Redundant blank line at the end of a code block" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2d" $1' sh
    
    Both these scripts were used until there were no more errors of the given type reported
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    531345a View commit details
    Browse the repository at this point in the history
  10. MINIFICPP-1203 - Remove redundant virtual specifiers on overridden fu…

    …nctions according to linter recommendations
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "\"virtual\" is redundant" | tr ":" " " | cut -d" " -f1,2 | xargs -n 2 sh -c 'sed -i "" "$2s/virtual //" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    d5178bb View commit details
    Browse the repository at this point in the history
  11. MINIFICPP-1203 - Remove whitespaces from line ends according to linte…

    …r recommendations
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Line ends in whitespace" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s/[[:blank:]]*$//" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    df5290a View commit details
    Browse the repository at this point in the history
  12. MINIFICPP-1203 - Add whitespace before { according to linter recommen…

    …dations
    
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Missing space before {" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s/{/ {/" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    1402e22 View commit details
    Browse the repository at this point in the history
  13. MINIFICPP-1203 - Remove new line before { according to linter recomme…

    …ndations
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "{ should almost always" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s/[[:blank:]]*{/{/" $1 && perl -pi -e "s/\\n/ / if $. == $2 - 1" $1' sh
    
    This was run repeatedly until no more errors were present.
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    7163a43 View commit details
    Browse the repository at this point in the history
  14. MINIFICPP-1203 - Add space between // and comments according to linte…

    …r recommendations
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Should have a space between // and comment" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s;//;// ;" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    3d7e996 View commit details
    Browse the repository at this point in the history
  15. MINIFICPP-1203 - Add missing spaces according to compiler recommendat…

    …ions
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Missing space before ( in if(" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s/if(/if (/" $1' sh
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Missing space before ( in while(" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s/while(/while (/" $1' sh
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Missing space before ( in for(" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s/for(/for (/" $1' sh
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Missing spaces around =" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s/=/ = /g" $1 && sed -i "" "$2s/  =/ =/g" $1 && sed -i "" "$2s/=  /= /g" $1 && sed -i "" "$2s/= =/==/g" $1' sh
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Missing space after ," | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s/,/, /g" $1 && sed -i "" "$2s/,  /, /g" $1' sh
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Missing space after ;" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s/;/; /" $1 && sed -i "" "$2s/;  /; /" $1 && sed -i "" "$2s/; $/;/" $1' s
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    8fee876 View commit details
    Browse the repository at this point in the history
  16. MINIFICPP-1203 - Add at least two spaces between code and comment acc…

    …ording to linter recommendations
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "At least two spaces is best between code and comments" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s;//;  //;" $1 && sed -i "" "$2s;   //;  //;" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    34721e4 View commit details
    Browse the repository at this point in the history
  17. MINIFICPP-1203 - Remove linter errors due to visibility modifiers fol…

    …lowing each other
    
    This can only be solved by removing the first visibility modifier, because otherwise either a ... followed by a blank line or a ... should be preceded by a blank line error occurs
    
    Script used (after all the aforementioned errors were cleared):
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Do not leave a blank line after" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2d" $1 && sed -i "" "$(expr $2 - 1)d" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    a704db5 View commit details
    Browse the repository at this point in the history
  18. MINIFICPP-1203 - Remove only-semicolon lines according to linter reco…

    …mmendations
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Line contains only semicolon." | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s/[[:blank:]]*;/;/" $1 && perl -pi -e "s/\\n// if $. == $2 - 1" $1&& sed -i "" "$(expr $2 - 1)s/;;$/;/" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    25d3da3 View commit details
    Browse the repository at this point in the history
  19. MINIFICPP-1203 - Remove "should be indented +1" errors according to l…

    …inter recommendations
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "should be indented +1" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s/^/ /" $1' sh
    
    Manual edit in:
    libminifi/include/core/logging/WindowsEventLogSink.h
    libminifi/include/core/repository/AtomicRepoEntries.h
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    b0c44b1 View commit details
    Browse the repository at this point in the history
  20. MINIFICPP-1203 - Remove extra space before last semicolon according t…

    …o linter recommendations
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Extra space before last semicolon" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s/ ;$/;/" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    f346cd4 View commit details
    Browse the repository at this point in the history
  21. MINIFICPP-1203 - Eliminate extra space around () according to linter …

    …recommendations
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Extra space after (" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s/( /(/g" $1' sh
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Extra space before )" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s/ )/)/g" $1' sh
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Extra space before (" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s/ (/(/g" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    0cf1e80 View commit details
    Browse the repository at this point in the history
  22. MINIFICPP-1203 - Add NOLINT rule to lines longer than 200 characters

    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "<= 200 characters long" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s;$; // NOLINT;" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    5ea1768 View commit details
    Browse the repository at this point in the history
  23. MINIFICPP-1203 - Replace tabs with spaces according to linter recomme…

    …ndations
    
    Script used (until no more errors returned):
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Tab found; better to use spaces" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'perl -pi -e "s/\t/  /g if $. == $2" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    c902cf0 View commit details
    Browse the repository at this point in the history
  24. MINIFICPP-1203 - Fix non-unix compilant line endings according to lin…

    …ter recommendation
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "(^M) found" | tr ":" " " | cut -d" " -f1 | sort | uniq | xargs dos2unix --
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    aa53ff9 View commit details
    Browse the repository at this point in the history
  25. MINIFICPP-1203 - Fix weird number of spaces in beginning of line acco…

    …rding to linter recommendations
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Weird number of spaces at line-start" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s/^ //" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    fca40bd View commit details
    Browse the repository at this point in the history
  26. MINIFICPP-1203 - Fix else statements placed on new line according to …

    …linter recommendation
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "An else should appear on the same line as the preceding }" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s/[[:blank:]]*else/else/" $1 && perl -pi -e "s/\\n/ / if $. == $2 - 1" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    9a08d3d View commit details
    Browse the repository at this point in the history
  27. MINIFICPP-1203 - Resolve namespace should be terminated with ... acco…

    …rding to linter recommendations
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Namespace should be terminated with" | tr ":" " " | tr -d '"'| cut -d" " -f1,2,12 | xargs -n 3 sh -c 'sed -i "" "$2s;$; // namespace $3;" $1 && sed -i "" "$2s;/[*] names[ap][ap]ce .*[*]/ //;//;g" $1' sh
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "Anonymous namespace should be terminated with" | tr ":" " " | cut -d" " -f1,2 | xargs -n 2 sh -c 'sed -i "" "$2s;$; // namespace;" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    07a4eb8 View commit details
    Browse the repository at this point in the history
  28. MINIFICPP-1203 - Remove redundant ";"-s according to linter recommend…

    …ations
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "You don't need a ;" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s/;$//" $1' sh
    
    Manual edits:
    libminifi/include/utils/file/FileUtils.h
    libminifi/include/agent/build_description.h
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    a955b7b View commit details
    Browse the repository at this point in the history
  29. MINIFICPP-1203 - Fix missing includes according to linter recommendat…

    …ions
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "build/include_what_you_use" | tr ":" " " | cut -d" " -f1,7 | sort -rn -k1 -k2 | uniq | xargs -n 2 sh -c 'perl -pi -e "s/#pragma once/#pragma once\n\n#include $2/" $1' sh
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "build/include_what_you_use" | tr ":" " " | cut -d" " -f1,7 | sort -rn -k1 -k2 | uniq | xargs -n 2 sh -c 'perl -pi -e "BEGIN { undef $/; } s/#ifndef (.*)\n#define \1/#ifndef \1\n#define \1\n\n#include $2/" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    14b8a14 View commit details
    Browse the repository at this point in the history
  30. MINIFICPP-1203 - Resolve include order linter recommendations

    Tool used:
    https://github.com/TheOstrichIO/cpplint/tree/nitpick-sort-includes/cpplint
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "build/include_order" | tr ":" " " | cut -d" " -f1 | sort -rn -k1 -k2 | uniq | xargs python nitpick.py style
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    d6dcdc5 View commit details
    Browse the repository at this point in the history
  31. MINIFICPP-1203 - Put at least two spaces before comments according to…

    … linter recommendations
    
    Script used:
    make linter |& egrep -v '^Done processing|^Ignoring' | grep "At least two spaces is best between code and comments" | tr ":" " " | cut -d" " -f1,2 | sort -rn -k1 -k2 | xargs -n 2 sh -c 'sed -i "" "$2s;//; //;" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    4514bed View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    199aa18 View commit details
    Browse the repository at this point in the history
  33. MINIFICPP-1203 - Remove extra empty lines between c++ headers

    Script used (ran until it performed no new changes):
    git diff --name-only master...$(git branch --show-current) | xargs perl -0777 -ne 'print "$ARGV $1\n" while /^(#include \<.*(?<!\.h)\>)\n\n(#include \<.*(?<!\.h)\>)$/mg' | xargs -n 3 sh -c 'perl -pi -e "s/$2 $3\n/$2 $3/g" $1' sh
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    19e566d View commit details
    Browse the repository at this point in the history
  34. MINIFICPP-1203 - Make comments on closing braces for namespaces consi…

    …stent
    
    Also, fix incorrect header guard closing #endifs that were not reported due linter becoming confused on /* style comments
    
    Script used:
    git diff --name-only master...$(git branch --show-current) | xargs perl -0777 -pi -e 's/^(\s*}) \/\* namespace (.*) \*\/ *$/$1  \/\/ namespace $2/mg'
    make linter |& egrep -v '^Done processing|^Ignoring' |& grep -v "Done proces" | grep "endif line should be" | tr ":" " " | cut -d" " -f1,2,9-12 | xargs -n 3 sh -c 'sed -i "" "$2s;.*;$3;" $1' sh | less
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    87f558d View commit details
    Browse the repository at this point in the history
  35. MINIFICPP-1203 - Split multiple commands on same line, remove leftove…

    …r comments, add NOLINT to non-explicit ctors mentioned by the linter
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    c52d9bb View commit details
    Browse the repository at this point in the history
  36. MINIFICPP-1203 - Fix whitespace issues, comments, redundancies and on…

    …e API breaking explicit
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    8b4a717 View commit details
    Browse the repository at this point in the history
  37. Configuration menu
    Copy the full SHA
    ab4cea9 View commit details
    Browse the repository at this point in the history
  38. Configuration menu
    Copy the full SHA
    d044e2e View commit details
    Browse the repository at this point in the history
  39. MINIFICPP-1203 - Correct newly introduced incorrect namespace comment…

    …ing, fix incorrect ctr explicitness
    hunyadi-dev committed Jun 12, 2020
    Configuration menu
    Copy the full SHA
    2be2aec View commit details
    Browse the repository at this point in the history