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 #59

Open
evaherrada opened this issue Jun 21, 2022 · 1 comment
Open

Code fails duplicate-code check, consider refactor #59

evaherrada opened this issue Jun 21, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@evaherrada
Copy link
Collaborator

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

@evaherrada evaherrada 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

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.

@tekktrik tekktrik added the enhancement New feature or request label Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants