Closed grimley517 closed 3 months ago
addresses issue #415
In relation to patterns/behavioral/strategy.py
On adding the additional spaces required for flake linter to work, the line became too long.
$ flake8 . --count --show-source --statistics
./patterns/behavioral/strategy.py:59:121: E501 line too long (121 > 120 characters)
return f"<Order price: {self.price} with discount strategy: {getattr(self.discount_strategy, '__name__', None)}>"
^
1 E501 line too long (121 > 120 characters)
Hence changed to multiline comment
Multiline string fails as generates blank lines.
Extract lengthy call to variable - works better anyway as breaks up cognitive load of line
The last commit isn't really within the scope of the issue.
By extracting the linting and testing to an external script it is easier for developers to run this prior to deployment and see issues.
The linting and testing is still incomplete.
4 tests still fail. But these are beyond simple linting and should be discussed separately.
FAILED patterns/creational/abstract_factory.py::patterns.creational.abstract_factory.main
FAILED patterns/dependency_injection.py::patterns.dependency_injection.main
FAILED patterns/fundamental/delegation_pattern.py::patterns.fundamental.delegation_pattern.Delegator
FAILED patterns/other/blackboard.py::patterns.other.blackboard.main
============================================================================================== 4 failed, 98 passed in 0.29s ==============================================================================================
Willing to convert lint script to powershell or remove if requested.
I'll also write up the remaining test failures into new issues through the week.
Raised #418 for first failing test.
Issue #418 is addressed here.
Its addressed here rather than in its own PR as the pipeline is unblocked. Raising in its own PR would require this branch to be pulled with a failing pipieline.
FAILED patterns/dependency_injection.py::patterns.dependency_injection.main
This is due to a method being called which isn't there. Much more straightforward than the factory pattern error.
A collection of small changes to comply with lining rules.
Also added folders - dist and build to the .gitignore. These are generated in the CI pipeline. adding to gitignore prevents a user from accidentally committing these whilst working through pipeline.