summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMayank Singhal <17mayank.singhal@gmail.com>2021-05-01 03:46:22 +0530
committerGitHub <noreply@github.com>2021-04-30 15:16:22 -0700
commit78fa3d9db04889c1e4af445fa62b10502b063486 (patch)
tree2281f5985cf86ce7fbbb9cf9fbd1aee9d73d2daa
parent1b23b795f5507ac0b6911e3972f8b2806efefe35 (diff)
downloadpython-coveragepy-git-78fa3d9db04889c1e4af445fa62b10502b063486.tar.gz
docs: fix code comment formatting (#1153)
* docs(branch.rst): Line number comments not needed The topic `Branch Coverage Management` in this file already has a setting: :linenothreshold: 5 Using this setting, sphinx will automatically provide line numbers for code block longer than 5 lines. reference: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-option-highlight-linenothreshold * docs: Extra spaces in comment (maybe intentional) The lines edited in this commit might have been given extra indentation purposefully. As they are an instruction for coverage py and are immediately followed by another comment that is not for coveragepy. * docs: inconsistent spaces in comments Fix extra indentations or lack of indentations.
-rw-r--r--doc/branch.rst12
-rw-r--r--doc/cmd.rst2
-rw-r--r--doc/excluding.rst6
3 files changed, 10 insertions, 10 deletions
diff --git a/doc/branch.rst b/doc/branch.rst
index 3f6ba54b..f500287f 100644
--- a/doc/branch.rst
+++ b/doc/branch.rst
@@ -17,10 +17,10 @@ and flags lines that haven't visited all of their possible destinations.
For example::
- def my_partial_fn(x): # line 1
- if x: # 2
- y = 10 # 3
- return y # 4
+ def my_partial_fn(x):
+ if x:
+ y = 10
+ return y
my_partial_fn(1)
@@ -78,7 +78,7 @@ as a branch if one of its choices is excluded::
if x:
blah1()
blah2()
- else: # pragma: no cover
+ else: # pragma: no cover
# x is always true.
blah3()
@@ -108,7 +108,7 @@ tell coverage.py that you don't want them flagged by marking them with a
pragma::
i = 0
- while i < 999999999: # pragma: no branch
+ while i < 999999999: # pragma: no branch
if eventually():
break
diff --git a/doc/cmd.rst b/doc/cmd.rst
index 2b2086b1..111d1274 100644
--- a/doc/cmd.rst
+++ b/doc/cmd.rst
@@ -517,7 +517,7 @@ For example::
> def h(x):
"""Silly function."""
- - if 0: #pragma: no cover
+ - if 0: # pragma: no cover
- pass
> if x == 1:
! a = 1
diff --git a/doc/excluding.rst b/doc/excluding.rst
index b2792c87..0db7c16d 100644
--- a/doc/excluding.rst
+++ b/doc/excluding.rst
@@ -17,7 +17,7 @@ Coverage.py will look for comments marking clauses for exclusion. In this
code, the "if debug" clause is excluded from reporting::
a = my_function1()
- if debug: # pragma: no cover
+ if debug: # pragma: no cover
msg = "blah blah"
log_message(msg, a)
b = my_function2()
@@ -32,7 +32,7 @@ function is not reported as missing::
blah1()
blah2()
- def __repr__(self): # pragma: no cover
+ def __repr__(self): # pragma: no cover
return "<MyObject>"
Excluded code is executed as usual, and its execution is recorded in the
@@ -50,7 +50,7 @@ counted as a branch if one of its choices is excluded::
if x:
blah1()
blah2()
- else: # pragma: no cover
+ else: # pragma: no cover
# x is always true.
blah3()