From ffbf4c3e90ee1987ac95ab1eea2f9cbab376c0db Mon Sep 17 00:00:00 2001 From: Adam Waldenberg <adam.waldenberg@ejwa.se> Date: Wed, 16 May 2012 05:04:55 +0200 Subject: [PATCH] Analyzed extensions are now marked when the -l switch is used. This is extremely useful and shows exactly what files are actually used when gitinspector generates the statistics. --- extensions.py | 15 +++++++++++++-- gitinspector.py | 6 +----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/extensions.py b/extensions.py index 86b7d06..a986e95 100644 --- a/extensions.py +++ b/extensions.py @@ -17,6 +17,9 @@ # You should have received a copy of the GNU General Public License # along with gitinspector. If not, see <http://www.gnu.org/licenses/>. +import changes +import terminal + __default_extensions__ = ["java", "c", "cpp", "h", "hpp", "py", "glsl", "rb", "js", "sql"] __extensions__ = __default_extensions__ __located_extensions__ = set() @@ -32,5 +35,13 @@ def add_located(string): if len(string) > 0: __located_extensions__.add(string) -def get_located(): - return __located_extensions__ +def output(): + if __located_extensions__: + print "\nThe extensions below were found in the repository history" + print "(extensions used during statistical analysis are marked):" + + for i in __located_extensions__: + if i in __extensions__: + print "[" + terminal.__bold__ + i + terminal.__normal__ + "]", + else: + print i, diff --git a/gitinspector.py b/gitinspector.py index 44c4dc3..c34cf67 100755 --- a/gitinspector.py +++ b/gitinspector.py @@ -56,11 +56,7 @@ class Runner: missing.output() if self.list_file_types: - ex = extensions.get_located() - if (ex): - print "\nThe extensions below were found in the repository history:" - for i in extensions.get_located(): - print i, + extensions.output() if __name__ == "__main__": __run__ = Runner()