Skip to content

Instantly share code, notes, and snippets.

@nqn
Created October 3, 2013 18:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nqn/6814621 to your computer and use it in GitHub Desktop.
Save nqn/6814621 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Style checker using Google's cpplint
# http://google-styleguide.googlecode.com/svn/trunk/cpplint/cpplint.py
#
#
# Build active rules from list:
#
# build/class
# build/deprecated
# build/endif_comment
# build/explicit_make_pair
# build/forward_decl
# build/header_guard
# build/include
# build/include_alpha
# build/include_order
# build/include_what_you_use
# build/namespaces
# build/printf_format
# build/storage_class
# legal/copyright
# readability/alt_tokens
# readability/braces
# readability/casting
# readability/check
# readability/constructors
# readability/fn_size
# readability/function
# readability/multiline_comment
# readability/multiline_string
# readability/namespace
# readability/nolint
# readability/streams
# readability/todo
# readability/utf8
# runtime/arrays
# runtime/casting
# runtime/explicit
# runtime/int
# runtime/init
# runtime/invalid_increment
# runtime/member_string_references
# runtime/memset
# runtime/operator
# runtime/printf
# runtime/printf_format
# runtime/references
# runtime/rtti
# runtime/sizeof
# runtime/string
# runtime/threadsafe_fn
# whitespace/blank_line
# whitespace/braces
# whitespace/comma
# whitespace/comments
# whitespace/empty_loop_body
# whitespace/end_of_line
# whitespace/ending_newline
# whitespace/forcolon
# whitespace/indent
# whitespace/labels
# whitespace/line_length
# whitespace/newline
# whitespace/operators
# whitespace/parens
# whitespace/semicolon
# whitespace/tab
# whitespace/todo
#
# Some of these rules makes sense to add; for example runtime/int,
# runtime/references,
# readability/casting,
# build/include_order,
# whitespace/empty_loop_body
#
include_list="+build,-build/include_order,-build/namespaces,-build/include_what_you_use,-build/include_alpha,-build/storage_class"
include_list="${include_list},+readability,-readability/namespace,-readability/streams,-readability/check,-readability/todo,-readability/casting"
include_list="${include_list},+runtime,-runtime/string,-runtime/int,-runtime/explicit,-runtime/threadsafe_fn,-runtime/references"
include_list="${include_list},+whitespace,-whitespace/labels,-whitespace/comments,-whitespace/braces,-whitespace/parens,-whitespace/comma"
include_list="${include_list},-whitespace/empty_loop_body"
#
# Avoid checking machine generated code
#
exclude_files="-e jni -e jvm -e python -e protobuf\-2\.4\.1 -e gmock\-1\.6\.0"
#
# Build file list
#
find ./|grep -e cpp -e hpp|grep -v ${exclude_files}|xargs python cpplint.py --filter=-,${include_list} 2>&1 | grep -e ":" -e "Total"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment