Skip to content

Conversation

@mj0nez
Copy link
Contributor

@mj0nez mj0nez commented Sep 20, 2023

Closes #530

Warning

Requires merging of #529

This PR replaces the current action with a pre-commit-action to adjust this.

The output would change marginal - e.g. for a successfull run it would look like:

[Check code format with pre-commit/formatting] ⭐ Run Main pre-commit run --show-diff-on-failure --color=always --all-files
[Check code format with pre-commit/formatting]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/2-composite-3.sh] user= workdir=
| check yaml...............................................................Passed
| fix end of files.........................................................Passed
| trim trailing whitespace.................................................Passed
| black....................................................................Passed
| isort (python)...........................................................Passed
[Check code format with pre-commit/formatting]   ✅  Success - Main pre-commit run --show-diff-on-failure --color=always --all-files
[Check code format with pre-commit/formatting]   ✅  Success - Main pre-commit/action@v3.0.0

and for a faild one:

[Check code format with pre-commit/formatting] ⭐ Run Main pre-commit run --show-diff-on-failure --color=always --all-files
[Check code format with pre-commit/formatting]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/2-composite-3.sh] user= workdir=
| check yaml...............................................................Passed
| fix end of files.........................................................Passed
| trim trailing whitespace.................................................Passed
| black....................................................................Failed
| - hook id: black
| - files were modified by this hook
| 
| reformatted src/bo4e/bo/buendelvertrag.py
| 
| All done! ✨ 🍰 ✨
| 1 file reformatted, 276 files left unchanged.
| 
| isort (python)...........................................................Failed
| - hook id: isort
| - files were modified by this hook
| 
| Fixing /home/marcel/repositories/BO4E-python/src/bo4e/bo/buendelvertrag.py
| 
| pre-commit hook(s) made changes.
| If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`.
| To run `pre-commit` as part of git workflow, use `pre-commit install`.
| All changes made by hooks:
| diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml
| index 7602f46..8414edb 100644
| --- a/.github/workflows/formatting.yml
| +++ b/.github/workflows/formatting.yml
| @@ -1,4 +1,4 @@
| -name: "Check code format with black and isort"
| +name: "Check code format with pre-commit"
|  
|  on: [push, pull_request]
|  jobs:
[Check code format with pre-commit/formatting]   ❌  Failure - Main pre-commit run --show-diff-on-failure --color=always --all-files
[Check code format with pre-commit/formatting] exitcode '1': failure
[Check code format with pre-commit/formatting]   ❌  Failure - Main pre-commit/action@v3.0.0
[Check code format with pre-commit/formatting] exitcode '1': failure

Additional benefits

This change would also pin the versions of black & isort and sync them between CI and development environments (as proposed in #474).

@hf-kklein
Copy link
Contributor

Hi @hf-krechan could you please Check if this meets our requirements? Especially if we still have the Server Side Checks

@mj0nez mj0nez changed the title core: Replace formatting action with pre-commit chore: Replace formatting action with pre-commit Sep 20, 2023
@mj0nez mj0nez changed the title chore: Replace formatting action with pre-commit CI: Replace formatting action with pre-commit Sep 20, 2023
Copy link
Collaborator

@hf-krechan hf-krechan left a comment

Choose a reason for hiding this comment

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

Nice idea. Thank you very much for your support and PRs :)

@hf-krechan
Copy link
Collaborator

Hi @hf-krechan could you please Check if this meets our requirements? Especially if we still have the Server Side Checks

yes I will have a look at it

@hf-krechan hf-krechan enabled auto-merge (squash) September 25, 2023 06:18
@hf-kklein
Copy link
Contributor

@hf-krechan ich glaube du müsstest noch die branch-protection für main entsprechend anpassen

@hf-krechan hf-krechan merged commit ac7f05e into bo4e:main Sep 26, 2023
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.

CI: missing formatting checks

3 participants