AL-Go
AL-Go copied to clipboard
Whitespaces in system files
We're using pre-commit hooks to ensure more consistency for our code, but the AL-Go System files cause trouble now and then because they often have trailing whitespaces and missing newlines at eof. This normally wouldn't be a big deal, but since the action "Update AL-Go System Files" doesn't ignore whitespaces, correcting the files means the workflow thinks the files need to be updated again, and it's a constant back and forth between the two. Blacklisting the workflows from the hook is an option, but I'd rather not skip files, and it would make maintenance more of a headache.
You could update the action to ignore whitespaces like git diff can be configured to, but I'd recommend setting up automated validation and formatting like pre-commit as well since it helps adhere to guidelines and ensures updates to the system files don't have to be amended with hooks that are standard in almost all fields of development.
I don't know in what capacity a pre-commit config file would be available in the templates, but upkeep would be much easier if at the very least the repository was kept formatted.
If you are new to pre-commits, you can read up on them here. Additionally, here's the config we use for our projects:
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-json
- id: check-xml
- id: check-yaml
- id: check-merge-conflict
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
- id: sort-simple-yaml
Sounds like something we should support and enable. Currently we are running the PS Script Analyzer, but I am all for enabling more stuff to ensure consistency.
I've created PR #955 to add a pre-commit config file with a few basic hooks.