Readability added.

This commit is contained in:
Elf M. Sternberg 2016-09-30 12:10:52 -07:00
parent 08537128bb
commit dd4aeb1cad
7 changed files with 73 additions and 58 deletions

View File

@ -63,3 +63,9 @@ match = .json
print = False
condition = error
[readability]
output = Running Text Style Check
match = .rst
command = git-lint-style
print = False
condition = error

View File

@ -46,6 +46,10 @@ def main(*args):
print(error)
return returncode
kincaid = re.search(r'Kincaid:\s*([\d\.]+)', values, re.MULTILINE)
# Assumes an uncheckable issue, like an empty RST. Not unusual.
if not kincaid:
return 0
val = float(kincaid.group(1))
msg = ""

View File

@ -31,7 +31,7 @@ project_root = os.path.dirname(cwd)
# version is used.
sys.path.insert(0, project_root)
import git_lint
import git_lint # noqa
# -- General configuration ---------------------------------------------

View File

@ -146,10 +146,6 @@ git_head = get_git_head()
# \___/ \__|_|_|_|\__|_\___/__/
#
def base_file_cleaner(files):
return [file.replace(git_base + '/', '', 1) for file in files]
class MatchFilter:
def __init__(self, config):

View File

@ -65,9 +65,11 @@ def cleanup_options(options, commandline):
if key not in excluded}
return (cleaned, excluded)
def shortoptstogo(i): return i[0] + ((i[2] and ':') or '')
def shortoptstogo(i):
return i[0] + ((i[2] and ':') or '')
def longoptstogo(i): return i[1] + ((i[2] and '=') or '')
def longoptstogo(i):
return i[1] + ((i[2] and '=') or '')
optstringsshort = ''.join([shortoptstogo(opt) for opt in options])
optstringslong = [longoptstogo(opt) for opt in options]

View File

@ -1,8 +1,13 @@
from __future__ import print_function
from .git_lint import load_config, run_linters, git_base
import gettext
_ = gettext.gettext
def base_file_cleaner(files):
return [file.replace(git_base + '/', '', 1) for file in files]
# ICK. Mutation, references, and hidden assignment.
def group_by(iterable, field_id):
results = []
@ -28,7 +33,7 @@ def print_report(results, unlintable_filenames, cant_lint_filenames,
for group in grouped_results:
print(grouping.format(group[0]))
for (filename, lintername, returncode, text) in group[1]:
print('\n'.join(text))
print('\n'.join(base_file_cleaner(text)))
print('')
if len(broken_linter_names):
print(_('These linters could not be run:'), ','.join(broken_linter_names))

View File

@ -4,6 +4,7 @@ import sys
import argparse
import os.path
def _resolve_prefix(prefix, type):
osx_system_prefix = r'^/System/Library/Frameworks/Python.framework/Versions'
matches = {'man': [(r'^/usr$', '/usr/share'),
@ -66,6 +67,7 @@ setup(
install_requires=requirements,
license="MIT",
zip_safe=False,
scripts=['bin/git-lint-style'],
keywords='git lint style syntaxt development',
entry_points={
'console_scripts': [