mirror of
https://github.com/ejwa/gitinspector.git
synced 2024-11-16 08:38:26 +01:00
Implemented support for XML output in the filtering module.
This commit is contained in:
parent
5b8ce8c1e8
commit
695a2b98df
2 changed files with 20 additions and 4 deletions
22
filtering.py
22
filtering.py
|
@ -19,6 +19,7 @@
|
|||
|
||||
from __future__ import print_function
|
||||
import terminal
|
||||
import textwrap
|
||||
|
||||
__filters__ = []
|
||||
__filtered_files__ = set()
|
||||
|
@ -42,11 +43,26 @@ def set_filtered(file_name):
|
|||
return True
|
||||
return False
|
||||
|
||||
def output():
|
||||
__filtering_info_text__ = ("The following files were excluded from the statistics due to the"
|
||||
"specified exclusion patterns")
|
||||
|
||||
def output_html():
|
||||
print("HTML output not yet supported.")
|
||||
|
||||
def output_text():
|
||||
if __filtered_files__:
|
||||
print("\nThe following files were excluded from the statistics due to the")
|
||||
print("specified exclusion patterns:")
|
||||
print("\n" + textwrap.fill(__filtering_info_text__ + ":", width=terminal.get_size()[0]))
|
||||
|
||||
for i in __filtered_files__:
|
||||
(width, _) = terminal.get_size()
|
||||
print("...%s" % i[-width+3:] if len(i) > width else i)
|
||||
|
||||
def output_xml():
|
||||
if __filtered_files__:
|
||||
message_xml = "\t\t<message>" + __filtering_info_text__ + "</message>\n"
|
||||
filtering_xml = ""
|
||||
|
||||
for i in __filtered_files__:
|
||||
filtering_xml += "\t\t\t<file>" + i + "</file>\n"
|
||||
|
||||
print("\t<filering>\n" + message_xml + "\t\t<files>\n" + filtering_xml + "\t\t</files>\n\t</filtering>")
|
||||
|
|
|
@ -68,7 +68,7 @@ class Runner:
|
|||
responsibilities.output_xml, self.hard)
|
||||
|
||||
missing.output()
|
||||
filtering.output()
|
||||
format.call_output_function(filtering.output_html, filtering.output_text, filtering.output_xml)
|
||||
|
||||
if self.list_file_types:
|
||||
format.call_output_function(extensions.output_html, extensions.output_text, extensions.output_xml)
|
||||
|
|
Loading…
Reference in a new issue