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

add linter for whitespace checking #64

Merged
merged 4 commits into from
Mar 27, 2024
Merged

Conversation

katrinafyi
Copy link
Member

@katrinafyi katrinafyi commented Mar 22, 2024

This adds scripts/lint.sh to check and apply trailing whitespace trimming. This should prevent cluttering diffs with whitespace changes in future.

It can be used as lint.sh to check and lint.sh fix to apply replacements in-place.

Given the amount of pending work, it is probably a bad time to merge this PR now. It would also be good to integrate the checks with dune and/or CI checks.

Edit: The script is now lint.py and it accepts a list of files/dirs as arguments.

@katrinafyi
Copy link
Member Author

Maybe instead of a bespoke grep/sed solution, we can use Git's whitespace handling. For example, to check whitespace,

git diff-tree --check 4b825dc642cb6eb9a060e54bf8d69288fbee4904 HEAD -- ':!mra_tools' 

which excludes mra_tools and uses the magic git hash for the empty directory to check all indexed files.

However, this can vary in behaviour if core.whitespace is set locally. It is also difficult to apply changes via git (https://stackoverflow.com/a/15398512) so sed may still be needed.

@katrinafyi
Copy link
Member Author

katrinafyi commented Mar 27, 2024

I have ported the script to Python (it was inevitable) and removed the commit which applied whitespace fixes.

This makes the PR easier to merge and we can all run the linter on our own code without merge conflicts.

@katrinafyi katrinafyi marked this pull request as ready for review March 27, 2024 00:41
@katrinafyi katrinafyi changed the title add lint.sh for whitespace checking add linter for whitespace checking Mar 27, 2024
@katrinafyi katrinafyi merged commit d2910a0 into partial_eval Mar 27, 2024
1 check passed
@katrinafyi katrinafyi deleted the lint-whitespace branch March 27, 2024 03:32
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.

1 participant