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

Split file contents in the lines only once #157

Closed
popzxc opened this issue Jan 3, 2020 · 0 comments
Closed

Split file contents in the lines only once #157

popzxc opened this issue Jan 3, 2020 · 0 comments
Labels
enhancement New feature or request refactoring

Comments

@popzxc
Copy link
Collaborator

popzxc commented Jan 3, 2020

It is inefficient that ModifiedFile content is split into lines by each lint separately, since the expensive operation is repeated many times while it can be done only once.

One more thing is that List may not be the most efficient structure to store lines, since some lints (e.g. NoNewlineAtFileEnd) don't need to process all the lines, but instead need one concrete line (e.g. last). Thus Vector may be a better choice.

As a conclusion, the proposed solution is to add a field like mfLines to the ModifiedFile type, and perform splitting once in Hint.hs (but the raw content should be available as well, no need to remove mfContent).

For details see a discussion at #156.

@vrom911 vrom911 added enhancement New feature or request refactoring labels Jan 3, 2020
popzxc added a commit to popzxc/hintman that referenced this issue Jan 5, 2020
popzxc added a commit to popzxc/hintman that referenced this issue Jan 5, 2020
popzxc added a commit to popzxc/hintman that referenced this issue Jan 5, 2020
popzxc added a commit to popzxc/hintman that referenced this issue Jan 5, 2020
popzxc added a commit to popzxc/hintman that referenced this issue Jan 10, 2020
Co-Authored-By: Veronika Romashkina <vrom911@gmail.com>
popzxc added a commit to popzxc/hintman that referenced this issue Jan 10, 2020
chshersh pushed a commit that referenced this issue Jan 11, 2020
* [#157] Split file into lines outside of lints

* [#157] Use strict types

* [#157] Update src/Hintman/Hint/TrailingNewlines.hs

Co-Authored-By: Veronika Romashkina <vrom911@gmail.com>

* [#157] Move predicate into filesForReview function

Co-authored-by: Veronika Romashkina <vrom911@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactoring
Projects
None yet
Development

No branches or pull requests

3 participants