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

Speed up semgrep on pre-commit #11927

Merged
merged 1 commit into from
May 4, 2024
Merged

Conversation

gasman
Copy link
Collaborator

@gasman gasman commented May 3, 2024

Semgrep is quite slow compared to our other pre-commit hooks, taking around 2 seconds to complete on my machine. Try to improve this a bit by:

  • only running it on *.py files
  • skipping the version check (saves about 300ms)

We're currently only using semgrep to enforce old-style string formatting on translation strings, which comes up infrequently enough that we might want to consider leaving this out of pre-commit and just relying on CircleCI to catch it instead. Will see how this improvement pans out first, though...

Skip version check, and only run on Python files
Copy link

squash-labs bot commented May 3, 2024

Manage this branch in Squash

Test this branch here: https://gasmanadminspeed-up-semgrep-a9ieh.squash.io

Copy link
Member

@loicteixeira loicteixeira left a comment

Choose a reason for hiding this comment

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

Yeah, we use semgrep at work too, and it can be quite slow (but we do have many rules). Hopefully that helps.

If not, I agreed, this could run in the CI. The feedback loop would be a bit slower, but as you said, it's infrequent enough.

@gasman gasman merged commit 4f78cce into wagtail:main May 4, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants