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

Code fails duplicate-code check, consider refactor #58

Open
evaherrada opened this issue Jun 21, 2022 · 3 comments
Open

Code fails duplicate-code check, consider refactor #58

evaherrada opened this issue Jun 21, 2022 · 3 comments

Comments

@evaherrada
Copy link
Collaborator

evaherrada commented Jun 21, 2022

https://github.com/adafruit/Adafruit_CircuitPython_EPD/runs/6993434800?check_suite_focus=true#step:11:33

@kattni
Copy link
Contributor

kattni commented Jun 21, 2022

Assigning Tekktrik as well to look into this. We'll work together to decide what the best solution is.

@tekktrik
Copy link
Member

This looks like code that can be refactored, given how extensive the duplications are.

@tekktrik tekktrik changed the title duplicate-code check is not happy Code fails duplicate-code check, consider refactor Jun 22, 2022
@tekktrik
Copy link
Member

This library is a candidate for refactoring based on pylint warning of duplicate code. The solution for this library would be to refactor the code to not have duplicated portions of code. In most cases, this might mean making base classes/functions so code can be recycled, but in some cases it may mean removing duplicate functionality (e.g., for compatibility).

To determine the duplicate code section, allow pylint to warn against duplicated code by removing ,duplicate-code from .pre-commit-config.yaml and then running pre-commit:

- --disable=consider-using-f-string,duplicate-code

Then, refactor the duplicated code sections until it passes pre-commit. The modified .pre-commit-config.yaml file and refactored code can then be submitted as a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants