diff --git a/.pylintrc b/.pylintrc index 0b948ab..1e5150c 100644 --- a/.pylintrc +++ b/.pylintrc @@ -3,7 +3,7 @@ include-ids=yes comment=yes [MESSAGES CONTROL] -disable=C0111,R0801,W0232,W0603,W0622,W0702 +disable=C0111,R0801,W0232,W0603,W0622,W0702,W0141 [DESIGN] diff --git a/gitinspector/basedir.py b/gitinspector/basedir.py index 91b62db..39e0094 100644 --- a/gitinspector/basedir.py +++ b/gitinspector/basedir.py @@ -1,6 +1,6 @@ # coding: utf-8 # -# Copyright © 2012-2014 Ejwa Software. All rights reserved. +# Copyright © 2012-2015 Ejwa Software. All rights reserved. # # This file is part of gitinspector. # @@ -40,7 +40,7 @@ def get_basedir_git(): if sp.returncode != 0: sys.exit(_("Error processing git repository at \"%s\"." % os.getcwd())) isbare = (isbare[0].decode("utf-8", "replace").strip() == "true") - absolute_path = "" + absolute_path = None if isbare: absolute_path = subprocess.Popen(["git", "rev-parse", "--git-dir"], bufsize=1, stdout=subprocess.PIPE).stdout diff --git a/gitinspector/blame.py b/gitinspector/blame.py index 82231c5..595d79c 100644 --- a/gitinspector/blame.py +++ b/gitinspector/blame.py @@ -23,7 +23,6 @@ from localization import N_ from outputable import Outputable from changes import FileDiff import comment -import changes import datetime import filtering import format @@ -107,6 +106,7 @@ class BlameThread(threading.Thread): self.__clear_blamechunk_info__() + #pylint: disable=W0201 for j in range(0, len(rows)): row = rows[j].decode("utf-8", "replace").strip() keyval = row.split(" ", 2) @@ -210,13 +210,13 @@ BLAME_INFO_TEXT = N_("Below are the number of rows from each author that have su "intact in the current revision") class BlameOutput(Outputable): - def __init__(self, hard, useweeks): + def __init__(self, changes, hard, useweeks): if format.is_interactive_format(): print("") + self.changes = changes self.hard = hard self.useweeks = useweeks - self.changes = changes.get(hard) get(self.hard, self.useweeks, self.changes) Outputable.__init__(self) diff --git a/gitinspector/changes.py b/gitinspector/changes.py index c264769..073150f 100644 --- a/gitinspector/changes.py +++ b/gitinspector/changes.py @@ -21,7 +21,6 @@ from __future__ import print_function from __future__ import unicode_literals from localization import N_ from outputable import Outputable -import codecs import datetime import extensions import filtering @@ -31,7 +30,6 @@ import interval import json import multiprocessing import os -import re import subprocess import terminal import textwrap @@ -127,8 +125,9 @@ class ChangesThread(threading.Thread): thread.start() def run(self): - git_log_r = subprocess.Popen(filter(None, ["git", "log", "--reverse", "--pretty=%cd|%H|%aN|%aE", "--stat=100000,8192", "--no-merges", "-w", - interval.get_since(), interval.get_until(), "--date=short"] + (["-C", "-C", "-M"] if self.hard else []) + + git_log_r = subprocess.Popen(filter(None, ["git", "log", "--reverse", "--pretty=%cd|%H|%aN|%aE", + "--stat=100000,8192", "--no-merges", "-w", interval.get_since(), + interval.get_until(), "--date=short"] + (["-C", "-C", "-M"] if self.hard else []) + [self.first_hash + self.second_hash]), bufsize=1, stdout=subprocess.PIPE).stdout lines = git_log_r.readlines() git_log_r.close() @@ -225,7 +224,8 @@ class Changes: def get_commits(self): return self.commits - def modify_authorinfo(self, authors, key, commit): + @staticmethod + def modify_authorinfo(authors, key, commit): if authors.get(key, None) == None: authors[key] = AuthorInfo() @@ -239,14 +239,14 @@ class Changes: def get_authorinfo_list(self): if not self.authors: for i in self.commits: - self.modify_authorinfo(self.authors, i.author, i) + Changes.modify_authorinfo(self.authors, i.author, i) return self.authors def get_authordateinfo_list(self): if not self.authors_dateinfo: for i in self.commits: - self.modify_authorinfo(self.authors_dateinfo, (i.date, i.author), i) + Changes.modify_authorinfo(self.authors_dateinfo, (i.date, i.author), i) return self.authors_dateinfo diff --git a/gitinspector/filtering.py b/gitinspector/filtering.py index ee4b93e..22f8079 100644 --- a/gitinspector/filtering.py +++ b/gitinspector/filtering.py @@ -26,7 +26,8 @@ import subprocess import terminal import textwrap -__filters__ = {"file": [set(), set()], "author": [set(), set()], "email": [set(), set()], "revision": [set(), set()], "message" : [set(), None]} +__filters__ = {"file": [set(), set()], "author": [set(), set()], "email": [set(), set()], "revision": [set(), set()], + "message" : [set(), None]} class InvalidRegExpError(ValueError): def __init__(self, msg): diff --git a/gitinspector/format.py b/gitinspector/format.py index d3e9391..b9e887f 100644 --- a/gitinspector/format.py +++ b/gitinspector/format.py @@ -67,7 +67,8 @@ def output_header(): if __selected_format__ == "html" or __selected_format__ == "htmlembedded": base = basedir.get_basedir() html_header = __output_html_template__(base + "/html/html.header") - tablesorter_js = __get_zip_file_content__("jquery.tablesorter.min.js", "/html/jquery.tablesorter.min.js.zip").encode("latin-1", "replace") + tablesorter_js = __get_zip_file_content__("jquery.tablesorter.min.js", + "/html/jquery.tablesorter.min.js.zip").encode("latin-1", "replace") tablesorter_js = tablesorter_js.decode("utf-8", "ignore") flot_js = __get_zip_file_content__("jquery.flot.js") pie_js = __get_zip_file_content__("jquery.flot.pie.js") diff --git a/gitinspector/gitinspector.py b/gitinspector/gitinspector.py index 0ec4433..199fa92 100755 --- a/gitinspector/gitinspector.py +++ b/gitinspector/gitinspector.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # coding: utf-8 # -# Copyright © 2012-2014 Ejwa Software. All rights reserved. +# Copyright © 2012-2015 Ejwa Software. All rights reserved. # # This file is part of gitinspector. # @@ -73,7 +73,7 @@ class Runner: outputable.output(changes.ChangesOutput(self.hard)) if changes.get(self.hard).get_commits(): - outputable.output(blame.BlameOutput(self.hard, self.useweeks)) + outputable.output(blame.BlameOutput(changes.get(self.hard), self.hard, self.useweeks)) if self.timeline: outputable.output(timeline.Timeline(changes.get(self.hard), self.useweeks)) diff --git a/gitinspector/interval.py b/gitinspector/interval.py index 136fb7e..2300807 100644 --- a/gitinspector/interval.py +++ b/gitinspector/interval.py @@ -1,6 +1,6 @@ # coding: utf-8 # -# Copyright © 2012-2013 Ejwa Software. All rights reserved. +# Copyright © 2012-2015 Ejwa Software. All rights reserved. # # This file is part of gitinspector. # diff --git a/gitinspector/terminal.py b/gitinspector/terminal.py index 55b8b99..f51acfa 100644 --- a/gitinspector/terminal.py +++ b/gitinspector/terminal.py @@ -1,6 +1,6 @@ # coding: utf-8 # -# Copyright © 2012-2014 Ejwa Software. All rights reserved. +# Copyright © 2012-2015 Ejwa Software. All rights reserved. # # This file is part of gitinspector. # @@ -134,9 +134,9 @@ def get_excess_column_count(string): width_mapping = {'F': 2, 'H': 1, 'W': 2, 'Na': 1, 'N': 1, 'A': 1} result = 0 - for c in string: - w = unicodedata.east_asian_width(c) - result += width_mapping[w] + for i in string: + width = unicodedata.east_asian_width(i) + result += width_mapping[width] return result - len(string)