def __init__(self): self.project_name = None self.cpp_header_map = {} self.cpp_src_map = {} self.python_map = {} pylint_disable = [ 'superfluous-parens', 'too-many-instance-attributes', 'too-few-public-methods' ] # setup pylint self.pylint_opts = [ '--extension-pkg-whitelist=numpy', '--disable=' + ','.join(pylint_disable) ] self.pylint_cats = set(['error', 'warning', 'convention', 'refactor']) # setup cpp lint cpplint_args = ['.', '--extensions=' + (','.join(CXX_SUFFIX))] _ = cpplint.ParseArguments(cpplint_args) cpplint._SetFilters(','.join([ '-build/c++11', '-build/namespaces', '-build/include,', '+build/include_what_you_use', '+build/include_order' ])) cpplint._SetCountingStyle('toplevel') cpplint._line_length = 100
def __init__(self): self.project_name = None self.cpp_header_map = {} self.cpp_src_map = {} self.python_map = {} pylint_disable = ["superfluous-parens", "too-many-instance-attributes", "too-few-public-methods"] # setup pylint self.pylint_opts = ["--extension-pkg-whitelist=numpy", "--disable=" + ",".join(pylint_disable)] self.pylint_cats = set(["error", "warning", "convention", "refactor"]) # setup cpp lint cpplint_args = [".", "--extensions=" + (",".join(CXX_SUFFIX))] _ = cpplint.ParseArguments(cpplint_args) cpplint._SetFilters( ",".join( [ "-build/c++11", "-build/namespaces", "-build/include,", "+build/include_what_you_use", "+build/include_order", ] ) ) cpplint._SetCountingStyle("toplevel") cpplint._line_length = 100
def __init__(self): self.project_name = None self.cpp_header_map = {} self.cpp_src_map = {} self.python_map = {} # setup pylint self.pylint_opts = ['--extension-pkg-whitelist=numpy', '-d', 'superfluous-parens'] self.pylint_cats = set(['error', 'warning', 'convention']) # setup cpp lint cpplint_args = ['.', '--extensions=' + (','.join(CXX_SUFFIX))] _ = cpplint.ParseArguments(cpplint_args) cpplint._SetFilters(','.join(['-build/c++11', '-build/namespaces', '-build/include,', '+build/include_what_you_use', '+build/include_order'])) cpplint._SetCountingStyle('toplevel') cpplint._line_length = 100
def __init__(self): self.project_name = None self.cpp_header_map = {} self.cpp_src_map = {} self.python_map = {} pylint_disable = ['superfluous-parens', 'too-many-instance-attributes', 'too-few-public-methods'] # setup pylint self.pylint_opts = ['--extension-pkg-whitelist=numpy', '--disable=' + ','.join(pylint_disable)] self.pylint_cats = set(['error', 'warning', 'convention', 'refactor']) # setup cpp lint cpplint_args = ['.', '--extensions=' + (','.join(CXX_SUFFIX))] _ = cpplint.ParseArguments(cpplint_args) cpplint._SetFilters(','.join(['-build/c++11', '-build/namespaces', '-build/include', '-build/header_guard', '+build/include_what_you_use', '+build/include_order'])) cpplint._SetCountingStyle('toplevel') cpplint._line_length = 100
def __init__(self): self.cpp_header_map = {} self.cpp_src_map = {} self.python_map = {} # setup pylint self.pylint_opts = ["--extension-pkg-whitelist=numpy", "-d", "superfluous-parens"] self.pylint_cats = set(["error", "warning", "convention"]) # setup cpp lint cpplint_args = ["."] _ = cpplint.ParseArguments(cpplint_args) cpplint._SetFilters( ",".join( [ "-build/header_guard", "-build/c++11", "-build/namespaces", "-build/include,", "+build/include_what_you_use", "+build/include_order", ] ) ) cpplint._SetCountingStyle("toplevel") cpplint._line_length = 100
def ParseArguments(args): """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. """ try: (opts, filenames) = getopt.getopt(args, '', [ 'help', 'output=', 'verbose=', 'v=', 'version', 'counting=', 'filter=', 'cfg=', 'third-rule-path=', 'root=', 'repository=', 'linelength=', 'extensions=', 'exclude=', 'recursive', 'headers=', 'quiet' ]) except getopt.GetoptError: cpplint.PrintUsage('Invalid arguments.') verbosity = cpplint._VerboseLevel() output_format = cpplint._OutputFormat() filters = '' quiet = cpplint._Quiet() counting_style = '' recursive = False for (opt, val) in opts: if opt == '--help': cpplint.PrintUsage(None) if opt == '--version': cpplint.PrintVersion() elif opt == '--output': if val not in ('emacs', 'vs7', 'eclipse', 'junit', 'codecc'): cpplint.PrintUsage( 'The only allowed output formats are emacs, vs7, eclipse, codecc ' 'and junit.') output_format = val elif opt == '--quiet': quiet = True elif opt == '--verbose' or opt == '--v': verbosity = int(val) elif opt == '--filter': filters = val if not filters: cpplint.PrintCategories() elif opt == '--cfg': filters = config_fliter(val) if not filters: cpplint.PrintCategories() elif opt == '--third-rule-path': global thirdRuleSet thirdRuleSet = third_rules_set(val) elif opt == '--counting': if val not in ('total', 'toplevel', 'detailed'): cpplint.PrintUsage( 'Valid counting options are total, toplevel, and detailed') counting_style = val elif opt == '--root': cpplint._root = val elif opt == '--repository': cpplint._repository = val elif opt == '--linelength': try: cpplint._line_length = int(val) except ValueError: cpplint.PrintUsage('Line length must be digits.') elif opt == '--exclude': if not cpplint._excludes: cpplint._excludes = set() cpplint._excludes.update(glob.glob(val)) elif opt == '--extensions': try: cpplint._valid_extensions = set(val.split(',')) except ValueError: cpplint.PrintUsage('Extensions must be comma seperated list.') elif opt == '--headers': cpplint.ProcessHppHeadersOption(val) elif opt == '--recursive': recursive = True if not filenames: cpplint.PrintUsage('No files were specified.') if recursive: filenames = cpplint._ExpandDirectories(filenames) if cpplint._excludes: filenames = cpplint._FilterExcludedFiles(filenames) cpplint._SetOutputFormat(output_format) cpplint._SetQuiet(quiet) cpplint._SetVerboseLevel(verbosity) cpplint._SetFilters(filters) cpplint._SetCountingStyle(counting_style) return filenames