Пример #1
0
 def expand_files(self, modules):
     expanded = PyLinter.expand_files(self, modules)
     filtered = []
     for module in expanded:
         if self._files.check_module(module['path']):
             filtered.append(module)
     return filtered
Пример #2
0
def process_file(filename):
    """
    Analyze the file with pylint and write the result
    to a database
    """
    linter = PyLinter()

    checkers.initialize(linter)
    linter.read_config_file()
    linter.quiet = 1

    filemods = linter.expand_files((filename, ))
    if filemods:
        old_stats = config.load_results(filemods[0].get('basename'))
        old_score = old_stats.get('global_note', 0.0)

    linter.check(filename)
    score = eval(linter.config.evaluation, {}, linter.stats)

    # Calculate the credit for both scores
    if score < 0:
        credit = 2.0 * score
    elif score < old_score:
        credit = -1.5 * (old_score - score)
    elif score < MINIMUM_SCORE:
        credit = -1.5 * (MINIMUM_SCORE - score)
    else:
        credit = score - old_score

    return score, old_score, credit
Пример #3
0
 def expand_files(self, modules):
     expanded = PyLinter.expand_files(self, modules)
     filtered = []
     for module in expanded:
         if self._files.check_module(module['path']):
             filtered.append(module)
     return filtered
Пример #4
0
def process_file(filename):
    """
    Analyze the file with pylint and write the result
    to a database
    """
    linter = PyLinter()

    checkers.initialize(linter)
    linter.read_config_file()
    linter.quiet = 1

    filemods = linter.expand_files((filename, ))
    if filemods:
        old_stats = config.load_results(filemods[0].get('basename'))
        old_score = old_stats.get('global_note', 0.0)

    linter.check(filename)
    score = eval(linter.config.evaluation, {}, linter.stats)

    # Calculate the credit for both scores
    if score < 0:
        credit = 2.0 * score
    elif score < old_score:
        credit = -1.5 * (old_score - score)
    elif score < MINIMUM_SCORE:
        credit = -1.5 * (MINIMUM_SCORE - score)
    else:
        credit = score - old_score

    return score, old_score, credit
Пример #5
0
 def expand_files(self, modules):
     expanded = PyLinter.expand_files(self, modules)
     filtered = []
     for module in expanded:
         if any([m.search(module['path']) for m in self._ignore]):
             continue
         filtered.append(module)
     return filtered
Пример #6
0
 def expand_files(self, modules):
     expanded = PyLinter.expand_files(self, modules)
     filtered = []
     for module in expanded:
         rel_path = os.path.relpath(module['path'], self._rootpath)
         if any([m.search(rel_path) for m in self._ignore]):
             continue
         filtered.append(module)
     return filtered
Пример #7
0
 def expand_files(self, modules):
     expanded = PyLinter.expand_files(self, modules)
     filtered = []
     for module in expanded:
         rel_path = os.path.relpath(module['path'], self._rootpath)
         if any([m.search(rel_path) for m in self._ignore]):
             continue
         filtered.append(module)
     return filtered