text
stringlengths
0
828
if is_file_excluded(filename, excludes):
return None
if filename.endswith("".py""):
if kwargs.get(""pep8"", True):
errors += check_pep8(filename, **kwargs)
if kwargs.get(""pydocstyle"", True):
errors += check_pydocstyle(filename, **kwargs)
if kwargs.get(""license"", True):
errors += check_license(filename, **kwargs)
elif re.search(""\.(tpl|html)$"", filename):
errors += check_license(filename, **kwargs)
elif re.search(""\.(js|jsx|css|less)$"", filename):
errors += check_license(filename, python_style=False, **kwargs)
def try_to_int(value):
try:
return int(value.split(':', 1)[0])
except ValueError:
return 0
return sorted(errors, key=try_to_int)"
1666,"def check_author(author, **kwargs):
""""""Check the presence of the author in the AUTHORS/THANKS files.
Rules:
- the author full name and email must appear in AUTHORS file
:param authors: name of AUTHORS files
:type authors: `list`
:param path: path to the repository home
:type path: str
:return: errors
:rtype: `list`
""""""
errors = []
authors = kwargs.get(""authors"")
if not authors:
errors.append('1:A100: ' + _author_codes['A100'])
return errors
exclude_author_names = kwargs.get(""exclude_author_names"")
if exclude_author_names and author in exclude_author_names:
return []
path = kwargs.get(""path"")
if not path:
path = os.getcwd()
for afile in authors:
if not os.path.exists(path + os.sep + afile):
errors.append('1:A101: ' + _author_codes['A101'].format(afile))
if errors:
return errors
status = subprocess.Popen(['grep', '-q', author] +
[path + os.sep + afile for afile in authors],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd=path).wait()
if status:
errors.append('1:A102: ' + _author_codes['A102'].format(author))
return errors"
1667,"def get_options(config=None):
""""""Build the options from the config object.""""""
if config is None:
from . import config
config.get = lambda key, default=None: getattr(config, key, default)
base = {
""components"": config.get(""COMPONENTS""),
""signatures"": config.get(""SIGNATURES""),
""commit_msg_template"": config.get(""COMMIT_MSG_TEMPLATE""),
""commit_msg_labels"": config.get(""COMMIT_MSG_LABELS""),
""alt_signatures"": config.get(""ALT_SIGNATURES""),
""trusted"": config.get(""TRUSTED_DEVELOPERS""),
""pep8"": config.get(""CHECK_PEP8"", True),
""pydocstyle"": config.get(""CHECK_PYDOCSTYLE"", True),
""license"": config.get(""CHECK_LICENSE"", True),
""pyflakes"": config.get(""CHECK_PYFLAKES"", True),
""ignore"": config.get(""IGNORE""),
""select"": config.get(""SELECT""),
""match"": config.get(""PYDOCSTYLE_MATCH""),
""match_dir"": config.get(""PYDOCSTYLE_MATCH_DIR""),
""min_reviewers"": config.get(""MIN_REVIEWERS""),
""colors"": config.get(""COLORS"", True),
""excludes"": config.get(""EXCLUDES"", []),
""authors"": config.get(""AUTHORS""),
""exclude_author_names"": config.get(""EXCLUDE_AUTHOR_NAMES""),
}
options = {}
for k, v in base.items():
if v is not None:
options[k] = v
return options"
1668,"def run(self):