aboutsummaryrefslogtreecommitdiff
path: root/tabsvsspaces/print_stats.py
diff options
context:
space:
mode:
authorRoman Gräf <romangraef@loves.dicksinhisan.us>2020-06-21 02:44:06 +0200
committerRoman Gräf <romangraef@loves.dicksinhisan.us>2020-06-21 02:44:06 +0200
commit090b44edd8bf42e3d9574680dfa2e27cae8e595e (patch)
treec04a9bd456984218d84e7e4c5bb41c44055fff42 /tabsvsspaces/print_stats.py
parenta23529ccbd1237db2e7cbf5a8075437461fb5abe (diff)
downloadtabsvsspaces-090b44edd8bf42e3d9574680dfa2e27cae8e595e.tar.gz
tabsvsspaces-090b44edd8bf42e3d9574680dfa2e27cae8e595e.tar.bz2
tabsvsspaces-090b44edd8bf42e3d9574680dfa2e27cae8e595e.zip
pypi release
Diffstat (limited to 'tabsvsspaces/print_stats.py')
-rw-r--r--tabsvsspaces/print_stats.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tabsvsspaces/print_stats.py b/tabsvsspaces/print_stats.py
new file mode 100644
index 0000000..1963744
--- /dev/null
+++ b/tabsvsspaces/print_stats.py
@@ -0,0 +1,17 @@
+from tabsvsspaces.stats import Statistics
+
+
+def print_stats(stats: Statistics, by_extension: bool):
+ print('spaces:', stats.all_spaces)
+ print('tabs:', stats.all_tabs)
+ print('mixed:', stats.all_mixed)
+ if by_extension:
+ for ext in set(stats.space_dict.keys()) | stats.tab_dict.keys() | stats.mixed_line_dict.keys():
+ print(ext + ':')
+ print(' ', 'spaces:', stats.space_dict[ext])
+ print(' ', 'tabs:', stats.tab_dict[ext])
+ print(' ', 'mixed:', stats.mixed_line_dict[ext])
+ if stats.all_mixed > 0:
+ print('files_with_mixed_lines:')
+ for file in stats.mixed_files:
+ print(' -', file)