From d87f441d9db19c6d71a41d4c5cb19915f4d14383 Mon Sep 17 00:00:00 2001
From: "Kenneth M. Elf Sternberg"
Date: Wed, 5 Oct 2016 14:58:53 -0700
Subject: [PATCH] Documenting code re-org.
---
genindex.html | 34 +--------------
git_lint.html | 33 --------------
modules/git_lint/git_lint.html | 75 ++++++++++++++++----------------
modules/git_lint/reporters.html | 35 ++++++++-------
objects.inv | Bin 741 -> 701 bytes
searchindex.js | 2 +-
6 files changed, 57 insertions(+), 122 deletions(-)
diff --git a/genindex.html b/genindex.html
index bb1790b..c332df6 100644
--- a/genindex.html
+++ b/genindex.html
@@ -49,11 +49,9 @@
Index
-
B
- |
C
+
C
|
D
|
E
- |
F
|
G
|
L
|
M
@@ -63,16 +61,6 @@
|
W
-B
-
-
C
-F
-
-
G
diff --git a/git_lint.html b/git_lint.html
index 83d180f..3a2e986 100644
--- a/git_lint.html
+++ b/git_lint.html
@@ -110,24 +110,6 @@ return code and the output of the lint process.
git_lint.git_lint.
executable_exists
(script, label)[source]
-
--
-
git_lint.git_lint.
find_config_file
(options, base)[source]
-Returns the configuration file from a prioritized list of locations.
-
-- Locations are prioritized as:
-
-- From the command line. Fail if specified but not found
-- The repository’s root directory, as the file .git-lint
-- The repository’s root directory, as the file .git-lint/config
-- The user’s home directory, as file .git-lint
-- The user’s home directory, as the file .git-lint/config
-
-
-
-If no configuration file is found, this is an error.
-
-
-
git_lint.git_lint.
get_filelist
(options, extras)[source]
@@ -164,11 +146,6 @@ return code and the output of the lint process.
git_lint.git_lint.
get_shell_response
(fullcmd)[source]
-
--
-
git_lint.git_lint.
get_working_linter_names
(config)[source]
-
-
-
git_lint.git_lint.
load_config
(options, base)[source]
@@ -221,16 +198,6 @@ Help text, list of (long) options superseded by this one.
git_lint.reporters module
-
--
-
git_lint.reporters.
base_file_cleaner
(files)[source]
-
-
-
--
-
git_lint.reporters.
group_by
(iterable, field_id)[source]
-
-
-
git_lint.reporters.
print_help
(options, name)[source]
diff --git a/modules/git_lint/git_lint.html b/modules/git_lint/git_lint.html
index 79bc789..51dc8bc 100644
--- a/modules/git_lint/git_lint.html
+++ b/modules/git_lint/git_lint.html
@@ -73,39 +73,6 @@
# |___/
-[docs]def find_config_file(options, base):
-
""" Returns the configuration file from a prioritized list of locations.
-
-
Locations are prioritized as:
-
1. From the command line. Fail if specified but not found
-
2. The repository's root directory, as the file .git-lint
-
3. The repository's root directory, as the file .git-lint/config
-
4. The user's home directory, as file .git-lint
-
5. The user's home directory, as the file .git-lint/config
-
-
If no configuration file is found, this is an error.
-
"""
-
-
if 'config' in options:
-
config = options['config']
-
configpath = os.path.abspath(config)
-
if not os.path.isfile(configpath):
-
sys.exit(_('Configuration file not found: {}\n').format(config))
-
return configpath
-
-
home = os.environ.get('HOME', None)
-
possibles = [os.path.join(base, '.git-lint'),
-
os.path.join(base, '.git-lint/config')] + ((home and [
-
os.path.join(home, '.git-lint'),
-
os.path.join(home, '.git-lint/config')]) or [])
-
-
matches = [p for p in possibles if os.path.isfile(p)]
-
if len(matches) == 0:
-
sys.exit(_('No configuration file found, tried: {}').format(':'.join(possibles)))
-
-
return matches[0]
-
-
# (commandLineDictionary, repositoryLocation) -> (configurationDictionary | exit)
[docs]def load_config(options, base):
"""Loads the git-lint configuration file.
@@ -119,6 +86,38 @@
files for specific linters.
"""
+
def find_config_file(options, base):
+
""" Returns the configuration file from a prioritized list of locations.
+
+
Locations are prioritized as:
+
1. From the command line. Fail if specified but not found
+
2. The repository's root directory, as the file .git-lint
+
3. The repository's root directory, as the file .git-lint/config
+
4. The user's home directory, as file .git-lint
+
5. The user's home directory, as the file .git-lint/config
+
+
If no configuration file is found, this is an error.
+
"""
+
+
if 'config' in options:
+
config = options['config']
+
configpath = os.path.abspath(config)
+
if not os.path.isfile(configpath):
+
sys.exit(_('Configuration file not found: {}\n').format(config))
+
return configpath
+
+
home = os.environ.get('HOME', None)
+
possibles = [os.path.join(base, '.git-lint'),
+
os.path.join(base, '.git-lint/config')] + ((home and [
+
os.path.join(home, '.git-lint'),
+
os.path.join(home, '.git-lint/config')]) or [])
+
+
matches = [p for p in possibles if os.path.isfile(p)]
+
if len(matches) == 0:
+
sys.exit(_('No configuration file found, tried: {}').format(':'.join(possibles)))
+
+
return matches[0]
+
Linter = namedtuple('Linter', ['name', 'linter'])
path = find_config_file(options, base)
configloader = configparser.SafeConfigParser()
@@ -242,12 +241,12 @@
return (len(possibles) and possibles.pop(0)) or False
-[docs]def get_working_linter_names(config):
-
return [i.name for i in config
-
if executable_exists(i.linter['command'], i.name)]
-
-
[docs]def get_linter_status(config):
+
+
def get_working_linter_names(config):
+
return [i.name for i in config
+
if executable_exists(i.linter['command'], i.name)]
+
working_linter_names = get_working_linter_names(config)
broken_linter_names = (set([i.name for i in config]) - set(working_linter_names))
return working_linter_names, broken_linter_names
diff --git a/modules/git_lint/reporters.html b/modules/git_lint/reporters.html
index dd34eab..b97dc43 100644
--- a/modules/git_lint/reporters.html
+++ b/modules/git_lint/reporters.html
@@ -54,26 +54,25 @@
_ = 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
-
-
[docs]def print_report(results, unlintable_filenames, cant_lint_filenames,
broken_linter_names, unfindable_filenames, options={'bylinter': True}):
+
+
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 = []
+
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
+
sort_position = 1
grouping = _('Linter: {}')
if 'byfile' in options:
diff --git a/objects.inv b/objects.inv
index 0d1f93b533e171e6d9bfcdd5d9841450cb02ad06..39ab2d95d9781c010c0af34d8a64798befce4016 100644
GIT binary patch
delta 588
zcmV-S0<-<)1-%83e1DcrkJB&^hVT9rmf!$~M)X=CBm~QcL?yH<#L=4C)5NM{NB)5A
zzsHW#CaG4iakxaD*YixqV|$WXdZwiIv^(!wBZ5NuhSq~vHNI6Zvb=doH{?1|ufwWu
z@qyMQoGWmSZg1$nVwJFG8+8A2^o
d9=jpDQ(Jk(Ox_d)CBiTyP8wqQ$9SR_2S`(fhmiANO~}Az0qbGs#*89`gM6RAuKac&z0-
ajZqzlt4%`s(VF`9LU#L+hU5?8?${;r#WS}6
delta 628
zcmV-)0*n2<1?2^he1BF=kJ}&+z4I%O+CzJY)m)>hQq^uhq(-WCRrQDno?sLV7T|93
z?>m4U+pDTwlU^+5F>iQ`nE|N+)5-+eU3RUldkyprl>=Bcq17)kym?7CvZSqt8C34ck84?HMQ6chC@IOEW8
zoo2xOhltj|ZNc_Dh~|^hLxeTSo>8lopMbRyV8?`Hqgd8M;8GcR-y5@D*iY+DzT*PQ
z=x_$n2Y%3iKTP?M{`|2wA}DK~8RMu-&4e{aC1XOMAcTaFs2U{{(xY+U9&VsF!0Q|6
z4t!_LO$x>k%zyF6!Z5i)SUiWlFN~3!!HxTQ#FL4~dK6@M3nhBA<>TopV8^}@4Po1s
zo4PQ9o;vhOw(qnmJsq}-KCD6AI#>3J+hs|vga&T4wJs&P5+|HqmEkSqX?A7PyX@G2(^M8NgFp~ZifIHc@V6grBQ15Ch
z=w?f=VDh7Hjio^a4eto=@p^Mh=L}`n4-RS-Ji)RJP96GyePHf9#|Op?ArcH;DR52{
z%@3d>X+$&OYaCuTJ`cXw9i1L$T%7P}LmIqdth>w^1C$A0vOy*VgV${F&nnRPGC?Qo
zvs&|%*lmUHgpYbBgkUS`xt