Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#415 linter preventing prs #417

Merged
merged 9 commits into from
May 18, 2024
Merged

Conversation

grimley517
Copy link
Contributor

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.

@grimley517
Copy link
Contributor Author

addresses issue #415

@grimley517
Copy link
Contributor Author

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

@grimley517
Copy link
Contributor Author

Multiline string fails as generates blank lines.

Extract lengthy call to variable - works better anyway as breaks up cognitive load of line

@grimley517
Copy link
Contributor Author

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 ==============================================================================================

@grimley517
Copy link
Contributor Author

grimley517 commented May 12, 2024

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.

@grimley517
Copy link
Contributor Author

Raised #418 for first failing test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not massively convinced this is the right name.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, any proposals?

@grimley517
Copy link
Contributor Author

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.

@grimley517
Copy link
Contributor Author

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.

@faif faif merged commit 81e78fe into faif:master May 18, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants