Skip to content

Fix linter pre-submit #333

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

Merged

Conversation

ianlewis
Copy link
Member

@ianlewis ianlewis commented Jun 17, 2022

Fixes #283

Needs:

This fixes linter pre-submit issues and ensures that linters cause pre-submits to fail when there are errors.

reviewdog was abandoned for now because it seems to have issues where it returns a 0 error code even if the linter produces errors. It also uses of the Github API in a way that requires more permissions than we would like to give to PR code.

Instead, this PR runs the linters manually and has them output GitHub Actions commands to output check errors.

Pros:

  • Can run in a PR from a forked repo without any special permissions
  • Produces comments on PR code so it's easy to see where the violation is

Cons:

  • Runs on the whole repo and will match errors in files not on the PR

For now you can check out the files tab and scroll to the bottom to see examples of what the linter violations look like.

@ianlewis ianlewis marked this pull request as ready for review June 17, 2022 09:26
@ianlewis
Copy link
Member Author

@laurentsimon Can you give this a look when you get a chance?

Copy link
Collaborator

@laurentsimon laurentsimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks. Mabye we should follow-up on what contributors need to install on their machine do run the checks locally before sending a PR?

@ianlewis
Copy link
Member Author

LGTM, thanks. Mabye we should follow-up on what contributors need to install on their machine do run the checks locally before sending a PR?

I added some docs to the README

@ianlewis ianlewis merged commit 1a55da8 into slsa-framework:main Jul 22, 2022
@ianlewis ianlewis deleted the 283-linter-pre-submits-dont-actually-fail branch July 27, 2022 01:23
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.

linter pre-submits don't actually fail
3 participants