Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Changelog
TBA
===

* Added the standard short ``-v`` option as an alias for ``--verbose`` and ``--v``. (#331)
* Use path-aware prefix checks instead of deprecated os.path.commonprefix(). (#445)
* Fixed a whitespace/newline false positive for control conditions containing lambdas. (#410)
* We now error on relative include paths (``./``, ``../``). (#432)
Expand Down
8 changes: 4 additions & 4 deletions cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
__VERSION__ = "2.0.3-dev0"

_USAGE = """
Syntax: cpplint.py [--verbose=#] [--output=emacs|eclipse|vs7|junit|sed|gsed]
Syntax: cpplint.py [--verbose=#|-v#] [--output=emacs|eclipse|vs7|junit|sed|gsed]
[--filter=-x,+y,...]
[--counting=total|toplevel|detailed] [--root=subdir]
[--repository=path]
Expand Down Expand Up @@ -115,7 +115,7 @@
format. Sed commands are written to stdout, not stderr, so you should be
able to pipe output straight to a shell to run the fixes.

verbose=#
verbose=# | -v#
Specify a number 0-5 to restrict errors to certain verbosity levels.
Errors with lower verbosity levels have lower confidence and are more
likely to be false positives.
Expand Down Expand Up @@ -7792,7 +7792,7 @@ def ParseArguments(args):
try:
(opts, filenames) = getopt.getopt(
args,
"",
"v:",
[
"help",
"output=",
Expand Down Expand Up @@ -7837,7 +7837,7 @@ def ParseArguments(args):
output_format = val
elif opt == "--quiet":
quiet = True
elif opt in {"--verbose", "--v"}:
elif opt in {"-v", "--verbose", "--v"}:
verbosity = int(val)
elif opt == "--filter":
filters = val
Expand Down
10 changes: 10 additions & 0 deletions cpplint_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4936,6 +4936,16 @@ def testParseArguments(self):
cpplint._valid_extensions = old_valid_extensions
cpplint._hpp_headers = old_headers

def testShortVerboseArgument(self):
old_verbose_level = cpplint._cpplint_state.verbose_level
try:
assert cpplint.ParseArguments(["-v", "2", "foo.cc"]) == ["foo.cc"]
assert cpplint._cpplint_state.verbose_level == 2
assert cpplint.ParseArguments(["-v3", "foo.h"]) == ["foo.h"]
assert cpplint._cpplint_state.verbose_level == 3
finally:
cpplint._cpplint_state.verbose_level = old_verbose_level

def testRecursiveArgument(self):
working_dir = os.getcwd()
temp_dir = os.path.realpath(tempfile.mkdtemp())
Expand Down
Loading