Skip to content

Commit 0228c1a

Browse files
commandline option for report sort added
1 parent 045a420 commit 0228c1a

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

coverage/cmdline.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ class Opts(object):
8585
"which isn't done by default."
8686
),
8787
)
88+
sort = optparse.make_option(
89+
'--sort', action='store', metavar='COLUMN',
90+
help="Sort the report by the named column"
91+
)
8892
show_missing = optparse.make_option(
8993
'-m', '--show-missing', action='store_true',
9094
help="Show line numbers of statements in each module that weren't executed.",
@@ -405,6 +409,7 @@ def get_prog_name(self):
405409
Opts.include,
406410
Opts.omit,
407411
Opts.precision,
412+
Opts.sort,
408413
Opts.show_missing,
409414
Opts.skip_covered,
410415
Opts.skip_empty,
@@ -579,6 +584,7 @@ def command_line(self, argv):
579584
omit=omit,
580585
include=include,
581586
contexts=contexts,
587+
sort=options.sort
582588
)
583589

584590
# We need to be able to import from the current directory, because

coverage/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ def __init__(self):
211211
self.show_missing = False
212212
self.skip_covered = False
213213
self.skip_empty = False
214+
self.sort = None
214215

215216
# Defaults for [html]
216217
self.extra_css = None

coverage/control.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ def _get_file_reporters(self, morfs=None):
831831
def report(
832832
self, morfs=None, show_missing=None, ignore_errors=None,
833833
file=None, omit=None, include=None, skip_covered=None,
834-
contexts=None, skip_empty=None, precision=None,
834+
contexts=None, skip_empty=None, precision=None, sort=None
835835
):
836836
"""Write a textual summary report to `file`.
837837
@@ -882,6 +882,7 @@ def report(
882882
ignore_errors=ignore_errors, report_omit=omit, report_include=include,
883883
show_missing=show_missing, skip_covered=skip_covered,
884884
report_contexts=contexts, skip_empty=skip_empty, precision=precision,
885+
sort=sort
885886
):
886887
reporter = SummaryReporter(self)
887888
return reporter.report(morfs, outfile=file)

0 commit comments

Comments
 (0)