diff options
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 |