mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Fix typos
This commit is contained in:
@@ -30,7 +30,7 @@ is mentioned in the documentation.
|
||||
</recommendation>
|
||||
<example>
|
||||
<p>In the following case, the <code>__init__</code> method of <code>Super</code> calls the <code>set_up</code> method that is overridden by <code>Sub</code>.
|
||||
This results in `Sun.set_up` being called with a partially initialized instance of `Super` which may be unexpected. </p>
|
||||
This results in <code>Sub.set_up</code> being called with a partially initialized instance of <code>Super</code> which may be unexpected. </p>
|
||||
<sample src="examples/InitCallsSubclassMethodBad.py" />
|
||||
<p>In the following case, the initialization methods are separate between the superclass and the subclass.</p>
|
||||
<sample src="examples/InitCallsSubclassMethodGood.py" />
|
||||
|
||||
@@ -48,7 +48,7 @@ def good3():
|
||||
class Super:
|
||||
def __init__(self, arg):
|
||||
self.a = arg
|
||||
self.set_b() # OK: Here `set_b` is used for initialisation, but does not read the partialy initialized state of `self`.
|
||||
self.set_b() # OK: Here `set_b` is used for initialization, but does not read the partially initialized state of `self`.
|
||||
self.c = 1
|
||||
|
||||
def set_b(self):
|
||||
@@ -63,7 +63,7 @@ def good4():
|
||||
def __init__(self, arg):
|
||||
self.a = arg
|
||||
# OK: Here `_set_b` is likely an internal method (as indicated by the _ prefix).
|
||||
# We assume thus that regular consumers of the library will not override it, and classes that do are internal and account for `self`'s partially initialised state.
|
||||
# We assume thus that regular consumers of the library will not override it, and classes that do are internal and account for `self`'s partially initialized state.
|
||||
self._set_b()
|
||||
self.c = 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user