Conversation
| anchor: Optional[str] = None, | ||
| html_identifier: bool = False, | ||
| ): | ||
| assert 2 <= level <= 7 |
There was a problem hiding this comment.
Instead of assert here we can add a check and raise an error
There was a problem hiding this comment.
Yes, that's true. But I wanted to keep the refactoring minimal. Raising an exception basically means a new code path, which should be tested by a unit test. There is another assertion of this kind: assert alignment in ("left", "right")
I recommend to do this in a separate pull request.
The main goal of this pull request is to resolve the pylint warning too-few-public-methods. Please do the following:
- checkout main branch
- remove
too-few-public-methodsfromLine 8 in 79dfe7f
- call
make lint, and remember the output - checkout the branch
internal/use-abcof this PR, and repeat steps 2 and 3
The errors in file htmldoc.py will disappear. I should have made this clear from the beginning in the PR description. I will update it accordingly.
I removed the assert statements only as a clean-up side-task. Please approve the PR without further changes. Thank you!
The base class `Menu_Item` had a statement `assert false`, which is a code smell. In order to remove this, the class now inherits from `ABC` and the `generate` method is an abstract method.
Removed those `assert` statements which verified only the type. At the beginning of the project these assertions had been used to develop a reliable implementation in the sense of ISO 26262, but the (ongoing) tool qualification efforts allow to follow Python's duck typing philosophy again.
4a62e7e to
396b8c0
Compare
The main goal of this pull request is to resolve the pylint warning
too-few-public-methods.Please consider the following:
too-few-public-methodsfromlobster/pylint3.cfg
Line 8 in 79dfe7f
make lintand remember the outputinternal/use-abcof this PR, and repeat steps 2 and 3The errors in file
htmldoc.pywill disappear.The following changes are necessary to make pylint happy:
The base class
Menu_Itemhad a statementassert false, which is a code smell. In order to remove this, the class now inherits fromABCand thegeneratemethod is an abstract method.Also removed those
assertstatements which verified only the type. At the beginning of the project these assertions had been used to develop a reliable implementation in the sense of ISO 26262, but the (ongoing) tool qualification efforts allow to follow Python's duck typing philosophy again.