Skip to content

Commit

Permalink
tools: fix cpplint --quiet option
Browse files Browse the repository at this point in the history
Currently, the --quiet option for cpplint will generate the following
error:
$ tools/cpplint.py  --quiet src/node.cc
Traceback (most recent call last):
  File "tools/cpplint.py", line 6529, in <module>
    main()
  File "tools/cpplint.py", line 6497, in main
    filenames = ParseArguments(sys.argv[1:])
  File "tools/cpplint.py", line 6437, in ParseArguments
    logger.addHandler(logging.FileHandler(val, mode='wb'))
  File "/python2.7/logging/__init__.py", line 911, in __init__
    StreamHandler.__init__(self, self._open())
  File "/python2.7/logging/__init__.py", line 941, in _open
    stream = open(self.baseFilename, self.mode)
IOError: [Errno 21] Is a directory: '/Users/danielbevenius/work/nodejs/node

This commit moves the FileHandler that currently exists in the quiet
option to the logfile clause. It looks like this issue came about when
merging in commit fee4d3a ("tools:
merge custom cpplint with cpplint v1.3.0").

PR-URL: #23075
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
  • Loading branch information
danbev committed Oct 1, 2018
1 parent bb00eda commit b8a98a8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tools/cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -6429,11 +6429,10 @@ def ParseArguments(args):
except ValueError:
PrintUsage('Extensions must be comma seperated list.')
elif opt == '--recursive':
PrintUsage('Extensions must be comma separated list.')
elif opt == '--logfile':
recursive = True
elif opt == '--quiet':
elif opt == '--logfile':
logger.addHandler(logging.FileHandler(val, mode='wb'))
elif opt == '--quiet':
global _quiet
_quiet = True

Expand Down

0 comments on commit b8a98a8

Please sign in to comment.