summaryrefslogtreecommitdiff
path: root/license-summary
diff options
context:
space:
mode:
Diffstat (limited to 'license-summary')
-rwxr-xr-xlicense-summary40
1 files changed, 24 insertions, 16 deletions
diff --git a/license-summary b/license-summary
index c719389..bc2494a 100755
--- a/license-summary
+++ b/license-summary
@@ -48,24 +48,32 @@ class LicenseSummary(cliapp.Application):
self.filenames = set()
def cleanup(self):
- for s in sorted(self.summaries.keys()):
- ss = sorted(self.summaries[s])
- self.output.write('%s (%d):\n' % (s, len(ss)))
- for filename in ss:
- self.output.write('\t%s\n' % filename)
- if filename in self.filenames:
- self.filenames.remove(filename)
- for pattern in self.settings['exclude']:
- remove = [x for x in self.filenames if re.search(pattern, x)]
- for filename in remove:
- self.filenames.remove(filename)
- if self.filenames:
- self.output.write('no summary (%d):\n' % len(self.filenames))
- for filename in sorted(self.filenames):
- self.output.write('\t%s\n' % filename)
+ for summary in sorted(self.summaries.keys()):
+ self.report_group(summary, self.summaries[summary])
+
+ without_summary = self.filenames_without_summary()
+ if without_summary:
+ self.report_group('no summary', without_summary)
+
+ def report_group(self, summary, filenames):
+ self.output.write('%s (%d):\n' % (summary, len(filenames)))
+ for filename in sorted(filenames):
+ self.output.write('\t%s\n' % filename)
+
+ def filenames_without_summary(self):
+ return set(self.filenames).difference(self.filenames_with_summaries())
+
+ def filenames_with_summaries(self):
+ result = set()
+ for filenames in self.summaries.values():
+ result = result.union(set(filenames))
+ return result
+
+ def process_input(self, name):
+ self.filenames.add(name)
+ return cliapp.Application.process_input(self, name)
def process_input_line(self, filename, line):
- self.filenames.add(filename)
m = self.pat.search(line)
if m:
s = m.group('summary')