diff options
author | Gil <mcg@google.com> | 2018-03-07 09:59:38 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-07 09:59:38 -0800 |
commit | b7750b588c1d7ae9ea3891a254a39de5d3b3c572 (patch) | |
tree | f90e211a858839ceb497e55b3edc475bf4b286f1 /scripts/lint.sh | |
parent | 5930ad2feebc6628cbaec89b8f6a6146ed6afe5d (diff) |
Speed up source checks in Travis (#885)
* Factor out a whitespace checking script
* Factor out a copyright checking script
* Rewrite lint.sh to honor revision ranges
* Only restyle files that are part of the PR
* Run C++ lint before builds to fail faster
* Git grep doesn't operate on revision ranges
* style.sh accepts clang-format 6 or 7
Diffstat (limited to 'scripts/lint.sh')
-rwxr-xr-x | scripts/lint.sh | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/scripts/lint.sh b/scripts/lint.sh index 442f7f8..d0f82b1 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -12,7 +12,23 @@ # See the License for the specific language governing permissions and # limitations under the License. -find Firestore/core \( \ - -name \*.h -o \ - -name \*.cc \) -print0 \ +# Lints C++ files for conformance with the Google C++ style guide + +options=( + -z # \0 terminate output +) + +if [[ $# -gt 0 ]]; then + # Interpret any command-line argument as a revision range + command=(git diff --name-only) + options+=("$@") + +else + # Default to operating on all files that match the pattern + command=(git ls-files) +fi + + +"${command[@]}" "${options[@]}" \ + -- 'Firestore/core/**/*.'{h,cc} \ | xargs -0 python scripts/cpplint.py --quiet |