Source code for git_lint.reporters

from __future__ import print_function
from .git_lint import load_config, run_linters, git_base
import operator
import gettext
_ = gettext.gettext


[docs]def base_file_cleaner(files): return [file.replace(git_base + '/', '', 1) for file in files] # ICK. Mutation, references, and hidden assignment.
[docs]def group_by(iterable, field_id): results = [] keys = {} for obj in iterable: key = obj[field_id] if key in keys: keys[key].append(obj) continue keys[key] = [obj] results.append((key, keys[key])) return results