diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2022-11-05 15:35:22 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2022-11-05 15:35:22 -0400 |
commit | 3b3cc6959b3aa515915816c2159806fab570ceb9 (patch) | |
tree | 8c2964ea146ce654ea7346b1a86fc87d510f6015 /coverage | |
parent | 01d86775522ed67a246f2b17657e7a119cb6b8a1 (diff) | |
download | python-coveragepy-git-3b3cc6959b3aa515915816c2159806fab570ceb9.tar.gz |
refactor: use `format` wherever we can
Diffstat (limited to 'coverage')
-rw-r--r-- | coverage/cmdline.py | 10 | ||||
-rw-r--r-- | coverage/config.py | 4 | ||||
-rw-r--r-- | coverage/control.py | 6 | ||||
-rw-r--r-- | coverage/summary.py | 2 |
4 files changed, 11 insertions, 11 deletions
diff --git a/coverage/cmdline.py b/coverage/cmdline.py index 89b0807d..bea95993 100644 --- a/coverage/cmdline.py +++ b/coverage/cmdline.py @@ -96,8 +96,8 @@ class Opts: '', '--fail-under', action='store', metavar="MIN", type="float", help="Exit with a status of 2 if the total coverage is less than MIN.", ) - output_format = optparse.make_option( - '', '--format', action='store', metavar="FORMAT", dest="output_format", + format = optparse.make_option( + '', '--format', action='store', metavar="FORMAT", help="Output format, either text (default) or markdown", ) help = optparse.make_option( @@ -249,7 +249,7 @@ class CoverageOptionParser(optparse.OptionParser): debug=None, directory=None, fail_under=None, - output_format=None, + format=None, help=None, ignore_errors=None, include=None, @@ -487,7 +487,7 @@ COMMANDS = { Opts.contexts, Opts.input_datafile, Opts.fail_under, - Opts.output_format, + Opts.format, Opts.ignore_errors, Opts.include, Opts.omit, @@ -695,7 +695,7 @@ class CoverageScript: skip_covered=options.skip_covered, skip_empty=options.skip_empty, sort=options.sort, - output_format=options.output_format, + output_format=options.format, **report_args ) elif options.action == "annotate": diff --git a/coverage/config.py b/coverage/config.py index 1f239ea3..309f65e8 100644 --- a/coverage/config.py +++ b/coverage/config.py @@ -199,7 +199,7 @@ class CoverageConfig: # Defaults for [report] self.exclude_list = DEFAULT_EXCLUDE[:] self.fail_under = 0.0 - self.output_format = None + self.format = None self.ignore_errors = False self.report_include = None self.report_omit = None @@ -375,7 +375,7 @@ class CoverageConfig: # [report] ('exclude_list', 'report:exclude_lines', 'regexlist'), ('fail_under', 'report:fail_under', 'float'), - ('output_format', 'report:output_format', 'boolean'), + ('format', 'report:format', 'boolean'), ('ignore_errors', 'report:ignore_errors', 'boolean'), ('partial_always_list', 'report:partial_branches_always', 'regexlist'), ('partial_list', 'report:partial_branches', 'regexlist'), diff --git a/coverage/control.py b/coverage/control.py index a8cf1649..d260eeab 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -923,8 +923,8 @@ class Coverage: `file` is a file-like object, suitable for writing. - `output_format` provides options, to print eitehr as plain text, or as - markdown code + `output_format` determines the format, either "text" (the default), + or "markdown". `include` is a list of file name patterns. Files that match will be included in the report. Files matching `omit` will not be included in @@ -966,7 +966,7 @@ class Coverage: 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, output_format=output_format, + sort=sort, format=output_format, ): reporter = SummaryReporter(self) return reporter.report(morfs, outfile=file) diff --git a/coverage/summary.py b/coverage/summary.py index 77b36828..7709e4e7 100644 --- a/coverage/summary.py +++ b/coverage/summary.py @@ -224,7 +224,7 @@ class SummaryReporter: fmt_skip_empty = f"\n{self.empty_count} empty file{file_suffix} skipped." end_lines.append(fmt_skip_empty) - text_format = self.config.output_format or "text" + text_format = self.config.format or "text" if text_format == "markdown": formatter = self._report_markdown else: |