Skip to content

Commit

Permalink
commandline option for report sort added
Browse files Browse the repository at this point in the history
  • Loading branch information
jerinpetergeorge committed Jun 29, 2020
1 parent 045a420 commit 0228c1a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions coverage/cmdline.py
Expand Up @@ -85,6 +85,10 @@ class Opts(object):
"which isn't done by default."
),
)
sort = optparse.make_option(
'--sort', action='store', metavar='COLUMN',
help="Sort the report by the named column"
)
show_missing = optparse.make_option(
'-m', '--show-missing', action='store_true',
help="Show line numbers of statements in each module that weren't executed.",
Expand Down Expand Up @@ -405,6 +409,7 @@ def get_prog_name(self):
Opts.include,
Opts.omit,
Opts.precision,
Opts.sort,
Opts.show_missing,
Opts.skip_covered,
Opts.skip_empty,
Expand Down Expand Up @@ -579,6 +584,7 @@ def command_line(self, argv):
omit=omit,
include=include,
contexts=contexts,
sort=options.sort
)

# We need to be able to import from the current directory, because
Expand Down
1 change: 1 addition & 0 deletions coverage/config.py
Expand Up @@ -211,6 +211,7 @@ def __init__(self):
self.show_missing = False
self.skip_covered = False
self.skip_empty = False
self.sort = None

# Defaults for [html]
self.extra_css = None
Expand Down
3 changes: 2 additions & 1 deletion coverage/control.py
Expand Up @@ -831,7 +831,7 @@ def _get_file_reporters(self, morfs=None):
def report(
self, morfs=None, show_missing=None, ignore_errors=None,
file=None, omit=None, include=None, skip_covered=None,
contexts=None, skip_empty=None, precision=None,
contexts=None, skip_empty=None, precision=None, sort=None
):
"""Write a textual summary report to `file`.
Expand Down Expand Up @@ -882,6 +882,7 @@ def report(
ignore_errors=ignore_errors, report_omit=omit, report_include=include,
show_missing=show_missing, skip_covered=skip_covered,
report_contexts=contexts, skip_empty=skip_empty, precision=precision,
sort=sort
):
reporter = SummaryReporter(self)
return reporter.report(morfs, outfile=file)
Expand Down

0 comments on commit 0228c1a

Please sign in to comment.