MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / ParseArguments

Function ParseArguments

src/tests/coding/cpplint.py:6715–6815  ·  view source on GitHub ↗

Parses the command line arguments. This may set the output format and verbosity level as side-effects. Args: args: The command line arguments: Returns: The list of filenames to lint.

(args)

Source from the content-addressed store, hash-verified

6713
6714
6715def ParseArguments(args):
6716 """Parses the command line arguments.
6717
6718 This may set the output format and verbosity level as side-effects.
6719
6720 Args:
6721 args: The command line arguments:
6722
6723 Returns:
6724 The list of filenames to lint.
6725 """
6726 try:
6727 (opts, filenames) = getopt.getopt(args, '', ['help', 'output=', 'verbose=',
6728 'v=',
6729 'version',
6730 'counting=',
6731 'filter=',
6732 'root=',
6733 'repository=',
6734 'linelength=',
6735 'extensions=',
6736 'exclude=',
6737 'recursive',
6738 'headers=',
6739 'includeorder=',
6740 'quiet'])
6741 except getopt.GetoptError:
6742 PrintUsage('Invalid arguments.')
6743
6744 verbosity = _VerboseLevel()
6745 output_format = _OutputFormat()
6746 filters = ''
6747 quiet = _Quiet()
6748 counting_style = ''
6749 recursive = False
6750
6751 for (opt, val) in opts:
6752 if opt == '--help':
6753 PrintUsage(None)
6754 if opt == '--version':
6755 PrintVersion()
6756 elif opt == '--output':
6757 if val not in ('emacs', 'vs7', 'eclipse', 'junit', 'sed', 'gsed'):
6758 PrintUsage('The only allowed output formats are emacs, vs7, eclipse '
6759 'sed, gsed and junit.')
6760 output_format = val
6761 elif opt == '--quiet':
6762 quiet = True
6763 elif opt == '--verbose' or opt == '--v':
6764 verbosity = int(val)
6765 elif opt == '--filter':
6766 filters = val
6767 if not filters:
6768 PrintCategories()
6769 elif opt == '--counting':
6770 if val not in ('total', 'toplevel', 'detailed'):
6771 PrintUsage('Valid counting options are total, toplevel, and detailed')
6772 counting_style = val

Callers 1

mainFunction · 0.85

Calls 15

PrintUsageFunction · 0.85
_VerboseLevelFunction · 0.85
_OutputFormatFunction · 0.85
_QuietFunction · 0.85
PrintVersionFunction · 0.85
PrintCategoriesFunction · 0.85
ProcessExtensionsOptionFunction · 0.85
ProcessHppHeadersOptionFunction · 0.85
_ExpandDirectoriesFunction · 0.85
_FilterExcludedFilesFunction · 0.85
_SetOutputFormatFunction · 0.85

Tested by

no test coverage detected