Minor doc updates; updating python 2 references to python 3 and updating grammar

This commit is contained in:
Joe Farebrother
2025-07-15 13:26:46 +01:00
parent 7a7db0efe8
commit 909f57261c
11 changed files with 20 additions and 20 deletions

View File

@@ -45,10 +45,10 @@ leaving <code>KeyboardInterrupt</code> to propagate.
</example>
<references>
<li>Python Language Reference: <a href="http://docs.python.org/2.7/reference/compound_stmts.html#try">The try statement</a>,
<a href="http://docs.python.org/2.7/reference/executionmodel.html#exceptions">Exceptions</a>.</li>
<li>Python Language Reference: <a href="http://docs.python.org/3/reference/compound_stmts.html#try">The try statement</a>,
<a href="http://docs.python.org/3/reference/executionmodel.html#exceptions">Exceptions</a>.</li>
<li>M. Lutz, Learning Python, Section 35.3: Exception Design Tips and Gotchas, O'Reilly Media, 2013.</li>
<li>Python Tutorial: <a href="https://docs.python.org/2/tutorial/errors.html">Errors and Exceptions</a>.</li>
<li>Python Tutorial: <a href="https://docs.python.org/3/tutorial/errors.html">Errors and Exceptions</a>.</li>
</references>

View File

@@ -7,7 +7,7 @@
The loss of information can lead to hard to debug errors and incomplete log files.
It is even possible that ignoring an exception can cause a security vulnerability.
An empty <code>except</code> block may be an indication that the programmer intended to
handle the exception but never wrote the code to do so.</p>
handle the exception, but never wrote the code to do so.</p>
</overview>
<recommendation>
@@ -15,7 +15,7 @@ handle the exception but never wrote the code to do so.</p>
</recommendation>
<example>
<p>In this example the program keeps running with the same privileges if it fails to drop to lower
<p>In this example, the program keeps running with the same privileges if it fails to drop to lower
privileges.</p>
<sample src="EmptyExcept.py" />

View File

@@ -24,7 +24,7 @@ However, this may result in incorrect object initialization if the enclosing cla
</recommendation>
<example>
<p>
In this example the call to <code>super(Vehicle, self)</code> in <code>Car.__init__</code> is incorrect as it
In this example, the call to <code>super(Vehicle, self)</code> in <code>Car.__init__</code> is incorrect, as it
passes <code>Vehicle</code> rather than <code>Car</code> as the first argument to <code>super</code>.
As a result, <code>super(SportsCar, self).__init__()</code> in the <code>SportsCar.__init__</code> method will not call
all <code>__init__()</code> methods because the call to <code>super(Vehicle, self).__init__()</code>
@@ -37,7 +37,7 @@ skips <code>StatusSymbol.__init__()</code>.
</example>
<references>
<li>Python Standard Library: <a href="https://docs.python.org/2/library/functions.html#super">super</a>.</li>
<li>Python Standard Library: <a href="https://docs.python.org/3/library/functions.html#super">super</a>.</li>
<li>Artima Developer: <a href="http://www.artima.com/weblogs/viewpost.jsp?thread=236275">Things to Know About Python Super</a>.</li>

View File

@@ -17,7 +17,7 @@ wrap the use of the object in a <code>with</code> statement.
</recommendation>
<example>
<p>In the first example, rather than close the zip file in a conventional manner the programmer has called <code>__del__</code>.
<p>In the first example, rather than close the zip file in a conventional manner, the programmer has called <code>__del__</code>.
A safer alternative is shown in the second example.
</p>

View File

@@ -37,7 +37,7 @@ either of the alternatives below.
</example>
<references>
<li>Python Standard Library: <a href="http://docs.python.org/2/library/stdtypes.html#comparisons">Comparisons</a>.</li>
<li>Python Standard Library: <a href="http://docs.python.org/3/library/stdtypes.html#comparisons">Comparisons</a>.</li>
</references>
</qhelp>

View File

@@ -1,6 +1,6 @@
/**
* @name Comparison using is when operands support `__eq__`
* @description Comparison using 'is' when equivalence is not the same as identity
* @description Comparison using `is` when equivalence is not the same as identity
* @kind problem
* @tags quality
* reliability

View File

@@ -6,7 +6,7 @@
<overview>
<p>When a function contains both explicit returns (<code>return value</code>) and implicit returns
(where code falls off the end of a function) this often indicates that a return
(where code falls off the end of a function), this often indicates that a return
statement has been forgotten. It is best to return an explicit return value even when returning
<code>None</code> because this makes it easier for other developers to read your code.
</p>
@@ -29,7 +29,7 @@ return value of <code>None</code> as this equates to <code>False</code>. However
</example>
<references>
<li>Python Language Reference: <a href="http://docs.python.org/2/reference/compound_stmts.html#function">Function definitions</a>.
<li>Python Language Reference: <a href="http://docs.python.org/3/reference/compound_stmts.html#function">Function definitions</a>.
</li>

View File

@@ -1,6 +1,6 @@
/**
* @name Explicit returns mixed with implicit (fall through) returns
* @description Mixing implicit and explicit returns indicates a likely error as implicit returns always return 'None'.
* @description Mixing implicit and explicit returns indicates a likely error as implicit returns always return `None`.
* @kind problem
* @tags quality
* reliability
@@ -31,4 +31,4 @@ predicate has_implicit_return(Function func) {
from Function func
where explicitly_returns_non_none(func) and has_implicit_return(func)
select func,
"Mixing implicit and explicit returns may indicate an error as implicit returns always return None."
"Mixing implicit and explicit returns may indicate an error, as implicit returns always return None."

View File

@@ -22,7 +22,7 @@ not logical in the context of an initializer.</p>
</example>
<references>
<li>Python: <a href="http://docs.python.org/2.7/reference/datamodel.html#object.__init__">The __init__ method</a>.</li>
<li>Python: <a href="http://docs.python.org/3/reference/datamodel.html#object.__init__">The __init__ method</a>.</li>
</references>
</qhelp>

View File

@@ -37,7 +37,7 @@ function with a default of <code>default=None</code>, check if the parameter is
<references>
<li>Effbot: <a href="https://web.archive.org/web/20201112004749/http://effbot.org/zone/default-values.htm">Default Parameter Values in Python</a>.</li>
<li>Python Language Reference: <a href="http://docs.python.org/2/reference/compound_stmts.html#function-definitions">Function definitions</a>.</li>
<li>Python Language Reference: <a href="http://docs.python.org/3/reference/compound_stmts.html#function-definitions">Function definitions</a>.</li>
</references>

View File

@@ -1,4 +1,4 @@
| functions_test.py:18:1:18:11 | Function cr1 | Mixing implicit and explicit returns may indicate an error as implicit returns always return None. |
| functions_test.py:22:1:22:11 | Function cr2 | Mixing implicit and explicit returns may indicate an error as implicit returns always return None. |
| functions_test.py:336:1:336:16 | Function ok_match | Mixing implicit and explicit returns may indicate an error as implicit returns always return None. |
| functions_test.py:344:1:344:17 | Function ok_match2 | Mixing implicit and explicit returns may indicate an error as implicit returns always return None. |
| functions_test.py:18:1:18:11 | Function cr1 | Mixing implicit and explicit returns may indicate an error, as implicit returns always return None. |
| functions_test.py:22:1:22:11 | Function cr2 | Mixing implicit and explicit returns may indicate an error, as implicit returns always return None. |
| functions_test.py:336:1:336:16 | Function ok_match | Mixing implicit and explicit returns may indicate an error, as implicit returns always return None. |
| functions_test.py:344:1:344:17 | Function ok_match2 | Mixing implicit and explicit returns may indicate an error, as implicit returns always return None. |