Skip to content

Commit

Permalink
Removed the longest checks from pre-commit hook (#5529)
Browse files Browse the repository at this point in the history
* Removed the longest checks from pre-commit hook

so that it is more reasonable to always have enabled

* Added new check mode that doesn't do a full rebuild

and commented out running tests also on commit

* Update submodule

* Switch arguments around
  • Loading branch information
hhyyrylainen authored Sep 23, 2024
1 parent 098ed3b commit b36a9a3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
21 changes: 17 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,26 @@ repos:
hooks:
- id: check_formatting
name: Run check formatting
entry: dotnet run --project Scripts -- check --pre-commit --disable-colour
entry: dotnet run --project Scripts -- check --pre-commit --disable-colour --no-rebuild files rewrite compile steam-build cleanupcode
language: system
verbose: true
pass_filenames: false
- id: run_simple_tests
name: Run simple tests
entry: dotnet test test/code_tests
- id: locales_up_to_date
name: Check that translations are up to date
entry: dotnet run --project Scripts -- check --pre-commit --disable-colour localization
language: system
verbose: true
pass_filenames: false
# Uncomment this and comment the above if you prefer more full checks for each commit
# - id: check_formatting_full
# name: Run check formatting (full)
# entry: dotnet run --project Scripts -- check --pre-commit --disable-colour
# language: system
# verbose: true
# pass_filenames: false
# - id: run_simple_tests
# name: Run simple tests
# entry: dotnet test test/code_tests
# language: system
# verbose: true
# pass_filenames: false
2 changes: 1 addition & 1 deletion Scripts/CodeChecks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public CodeChecks(Program.CheckOptions opts,
},
})
},
{ "compile", new CompileCheck() },
{ "compile", new CompileCheck(!opts.NoExtraRebuild) },
{ "inspectcode", inspectCode },
{ "cleanupcode", new CleanupCode() },
{ "localization", new LocalizationCheck(runLocalizationTool) },
Expand Down
7 changes: 5 additions & 2 deletions doc/setup_instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -588,9 +588,12 @@ recommended as it is easier to use.
Pre-commit hook
---------------

You can enable a pre-commit hook to automatically run the
You can enable a pre-commit hook to automatically run some of the
formatting checks before each commit to avoid accidentally committing
code with formatting issues.
code with formatting issues. The reason these don't run all of the
checks for each commit is that that takes a really long time. Though,
if you prefer that you can edit the `.pre-commit-config.yaml` file to
switch out which variant of the formatting script is commented out.

To install pre-commit run `pip install pre-commit`. On Linux you can
optionally install it with `sudo` or with the `--user` flag as was
Expand Down

0 comments on commit b36a9a3

Please sign in to comment.