apply code inspection results

This commit is contained in:
Laszlo Nagy
2019-04-09 18:59:47 +10:00
parent 919dcf91d7
commit f554e7f824
7 changed files with 12 additions and 8 deletions

View File

@@ -15,7 +15,7 @@ import contextlib
import logging
import subprocess
__all__ = ['build_libear']
__all__ = ['build_libear', 'temporary_directory']
def build_libear(compiler, dst_dir):

View File

@@ -159,8 +159,8 @@ def wrapper_entry_point(function):
The :param function: will receive the following arguments:
:param result: the exit code of the compilation.
:param execution: the command executed by the wrapper. """
:result: the exit code of the compilation.
:execution: the command executed by the wrapper. """
def is_cxx_wrapper():
# type: () -> bool

View File

@@ -100,7 +100,7 @@ def need_analyzer(args):
when compiler wrappers are used. That's the moment when build setup
check the compiler and capture the location for the build process. """
return len(args) > 0 and not re.search('configure|autogen', args[0])
return len(args) > 0 and not re.search(r'configure|autogen', args[0])
def analyze_parameters(args):
@@ -579,7 +579,7 @@ def exclude(opts, continuation=classify_parameters):
relative = os.path.relpath(entry, directory).split(os.sep)
return len(relative) > 0 and relative[0] != os.pardir
if any(contains(dir, opts['source']) for dir in opts['excludes']):
if any(contains(entry, opts['source']) for entry in opts['excludes']):
logging.debug('skip analysis, file requested to exclude')
return dict()
return continuation(opts)

View File

@@ -13,6 +13,8 @@ It also implements basic validation methods, related to the command.
Validations are mostly calling specific help methods, or mangling values.
"""
from __future__ import absolute_import, division, print_function
import os
import sys
import argparse

View File

@@ -22,7 +22,7 @@ import datetime
import getpass
import socket
import argparse # noqa: ignore=F401
from typing import Dict, List, Tuple, Callable, Any, Set, Generator, Iterator, Optional # noqa: ignore=F401
from typing import Dict, List, Tuple, Any, Set, Generator, Iterator, Optional # noqa: ignore=F401
from libscanbuild.clang import get_version
__all__ = ['document']

View File

@@ -14,9 +14,9 @@ def main():
parser.add_argument('input', type=argparse.FileType('r'))
args = parser.parse_args()
# file is open, parse the json content
input = json.load(args.input)
entries = json.load(args.input)
# just get file names
result = set([os.path.basename(entry['file']) for entry in input])
result = set([os.path.basename(entry['file']) for entry in entries])
return 0 if result == EXPECTED else 1

View File

@@ -5,6 +5,8 @@
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
from __future__ import print_function
import argparse
import json
import os.path