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

Modularize pre_commit_linter #6024

Closed
6 of 7 tasks
brianrodri opened this issue Dec 23, 2018 · 5 comments
Closed
6 of 7 tasks

Modularize pre_commit_linter #6024

brianrodri opened this issue Dec 23, 2018 · 5 comments
Labels
code-health enhancement Label to indicate an issue is a feature/improvement

Comments

@brianrodri
Copy link
Contributor

brianrodri commented Dec 23, 2018

pre_commit_linter.py currently suffers from a lot of duplicate/complicated code. As a consequence, the file is extremely hard to optimize, and only grows harder to do so as time goes on. We'd like to split the functions into smaller modules (classes, functions, new files/modules), anything to help make the code more reasonable and easier to update and maintain.

Here are a list of starter items that could be improved:

Ideally, each of these issues should be managed by some sort of new module/class/set of functions which provides an interface that allows us to make optimizations without changing the overall behavior of the linter. Crucially, we should also be able to add tests to make that behavior provably correct moving forward.

apb7 pushed a commit that referenced this issue Jan 2, 2019
* Fix hola's multiple choice question.

* introduce utils.cache with tests

* import operator

* add trailing newline

* trailing newlines

* introduce FileCache to speed up lint checks

* remove old open

* fixes

* fix superfluous-parens

* nit fixes

* reorganization

* revert utils.cache

* remove unused import

* s/readlines/read_lines/

* use readlines on builtin file obj

* merge get_data with get_lock

* improvements to _FileCache

* make FileCache public

* avoid locking as much as possible

* access FileCache directly

* simpler naming

* remove unused import

* improve str usages

* get lock in separate method
@anmolshkl
Copy link
Contributor

@brianrodri #6023 is complete now. Are you working on the other sub-tasks?

@jacobdavis11
Copy link
Member

@brianrodri how is this going?

@jacobdavis11
Copy link
Member

De-assigning for now; please re-assign to resume work.

@kevinlee12
Copy link
Contributor

Linking #7305 since this is what we are trying to achieve

seanlip pushed a commit that referenced this issue Aug 8, 2019
* Draft refactor similar logic

* Compile regex in advance

* Doc string for _check_file_type_specific_bad_pattern
@U8NWXD U8NWXD moved this to To Do (Low Priority) in Developer Workflow Team Aug 1, 2022
@U8NWXD U8NWXD moved this from To Do (Low Priority) to Backlog in Developer Workflow Team Aug 16, 2022
@kevintab95 kevintab95 added the enhancement Label to indicate an issue is a feature/improvement label Aug 30, 2022
@U8NWXD U8NWXD moved this from Backlog to Linter in Developer Workflow Team Sep 10, 2022
@U8NWXD U8NWXD moved this from Linter to Not Started in Developer Workflow Team Sep 23, 2022
@seanlip seanlip removed the devflow label Dec 12, 2022
@seanlip
Copy link
Member

seanlip commented Dec 28, 2022

I'm going to close this as too-low priority since the linter seems to be working fine atm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-health enhancement Label to indicate an issue is a feature/improvement
Projects
Archived in project
Development

No branches or pull requests

6 participants