pseudo-lints source files before commit & fixes pseudo-lint errors #738
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
Adds setup script which enables a git pre-commit hook which pseudo-lints
Formats source files that weren't formatted according to the standard, using
mix commitWhy?
The pseudo-lint is run by CI, so it should be run before committing locally.
There is no git-native way to check hooks into a project.
This does add a step to setup, but other setup actions can and should be moved to the setup script over time.
CI tests that files are formatted.
How to test
scripts/setup.shmix formatdoesn't currently complain about and add spaces to the end of a lineDocumentation of functionality
README was updated with new step
Limitations
Doesn't run automated tests locally, as those are not currently working for me and we need first to understand whether the automated tests can be run on any developer machine.
Alternatives considered
Just configuring CI to fail unformatted files is a worse developer experience.
Additional details or related context
Also fails commit if any file contains non-ASCII characters. This is a new test, but existing files pass it.
Files from a number of commits were not formatted, as that wasn't enforced before.
The second commit here formats them.
This configures CI to fail lint-and-test if any file is not formatted.
If we can figure out what's going on, we should also run the automated tests before a commit.