From b36a9a3efbcbf86aecda9e74ae7c773f2368ae31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henri=20Hyyryl=C3=A4inen?= Date: Mon, 23 Sep 2024 16:20:34 +0300 Subject: [PATCH] Removed the longest checks from pre-commit hook (#5529) * 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 --- .pre-commit-config.yaml | 21 +++++++++++++++++---- RevolutionaryGamesCommon | 2 +- Scripts/CodeChecks.cs | 2 +- doc/setup_instructions.md | 7 +++++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d9521a6c9b9..12d8edb9fb1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/RevolutionaryGamesCommon b/RevolutionaryGamesCommon index 7b6a5261995..6b811274250 160000 --- a/RevolutionaryGamesCommon +++ b/RevolutionaryGamesCommon @@ -1 +1 @@ -Subproject commit 7b6a52619957848cef81d86e8cb83047908aae51 +Subproject commit 6b8112742509920b8660ef65369440fdd94a1d18 diff --git a/Scripts/CodeChecks.cs b/Scripts/CodeChecks.cs index d72668d20db..bc02235ac3d 100644 --- a/Scripts/CodeChecks.cs +++ b/Scripts/CodeChecks.cs @@ -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) }, diff --git a/doc/setup_instructions.md b/doc/setup_instructions.md index 1043da09aac..16bdcc8d9f4 100644 --- a/doc/setup_instructions.md +++ b/doc/setup_instructions.md @@ -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