diff --git a/.github/workflows/markdown-naming-check.yml b/.github/workflows/markdown-naming-check.yml index 309c88a7..9e17fe90 100644 --- a/.github/workflows/markdown-naming-check.yml +++ b/.github/workflows/markdown-naming-check.yml @@ -7,13 +7,13 @@ on: - main - develop paths: - - 'MarkdownPages/**.md' + - 'markdownpages/**.md' pull_request: branches: - main - develop paths: - - 'MarkdownPages/**.md' + - 'markdownpages/**.md' # Allow manual triggering workflow_dispatch: @@ -60,7 +60,13 @@ jobs: id: validation run: | echo "Starting markdown file naming validation..." - python scripts/markdown-naming-check.py --root-path MarkdownPages + # Check if markdownpages directory exists + if [ -d "markdownpages" ]; then + python scripts/markdown-naming-check.py --root-path markdownpages + else + echo "No markdownpages directory found!" + exit 1 + fi shell: bash continue-on-error: true @@ -73,7 +79,15 @@ jobs: # Run the validation and capture both exit code and output set +e # Temporarily disable exit on error - python scripts/markdown-naming-check.py --root-path MarkdownPages --json > validation-report.json + + # Check which directory exists and run validation accordingly + if [ -d "markdownpages" ]; then + python scripts/markdown-naming-check.py --root-path markdownpages --json > validation-report.json + else + echo '{"error": "No markdownpages directory found", "success": false, "total_files_checked": 0, "violations_found": 0, "violations": []}' > validation-report.json + validation_exit_code=1 + fi + validation_exit_code=$? set -e # Re-enable exit on error @@ -107,7 +121,7 @@ jobs: if: steps.report.outputs.validation_status == 'failure' run: | echo "❌ Markdown naming validation failed!" - echo "Please check the validation report and rename files to start with a capital letter." + echo "Please check the validation report and rename files to follow kebab-case convention." exit 1 shell: bash @@ -150,7 +164,7 @@ jobs: if [ "$violations" -gt "0" ]; then echo "" >> $GITHUB_STEP_SUMMARY echo "### Action Required" >> $GITHUB_STEP_SUMMARY - echo "Please rename the files listed in the validation report to start with a capital letter." >> $GITHUB_STEP_SUMMARY + echo "Please rename the files listed in the validation report to follow kebab-case convention." >> $GITHUB_STEP_SUMMARY fi else echo "- **Status:** ❌ Validation report not found" >> $GITHUB_STEP_SUMMARY diff --git a/markdownpages/endpoint/en/KnOrganisation_post.md b/markdownpages/endpoint/en/KnOrganisation_post.md deleted file mode 100644 index e69de29b..00000000 diff --git a/markdownpages/endpoint/en/KnPerson_post.md b/markdownpages/endpoint/en/KnPerson_post.md deleted file mode 100644 index e69de29b..00000000 diff --git a/markdownpages/endpoint/endpoint-markdown-files.json b/markdownpages/endpoint/endpoint-markdown-files.json index d61fe185..81217b5d 100644 --- a/markdownpages/endpoint/endpoint-markdown-files.json +++ b/markdownpages/endpoint/endpoint-markdown-files.json @@ -11,6 +11,7 @@ "hrrelative_post.md", "knaddress_post.md", "knemployee_post.md", + "knorganization_post.md", "knperson_post.md", "knsubject_post.md", "profit_debtor_invoices_get.md", diff --git a/markdownpages/endpoint/endpoint_markdown_files.json b/markdownpages/endpoint/endpoint_markdown_files.json deleted file mode 100644 index e69de29b..00000000 diff --git a/markdownpages/profit/en/AppConnectorAuditorPartner.md b/markdownpages/profit/en/AppConnectorAuditorPartner.md index 54936ac1..c4f188b9 100644 --- a/markdownpages/profit/en/AppConnectorAuditorPartner.md +++ b/markdownpages/profit/en/AppConnectorAuditorPartner.md @@ -103,7 +103,7 @@ Many GetConnectors only show data that has been allowed by the end user in the a #### Both EnSe and DvSn are used. -In short: AFAS Profit knows 2 different numbers that indicate the employment. If you use them mixed up, you risk hard-to-trace errors. [Therefore read this article carefully](./Howto-bi.md#employees-and-employment). Don't hesitate to discuss this during an appointment with a SystemIntegrator. +In short: AFAS Profit knows 2 different numbers that indicate the employment. If you use them mixed up, you risk hard-to-trace errors. [Therefore read this article carefully](./howto-bi#employees-and-employment). Don't hesitate to discuss this during an appointment with a SystemIntegrator. #### Financial mutations are retrieved, but **Changed booking days** is not used. @@ -165,11 +165,11 @@ You can display a field differently in a GetConnector; for example a date/time a #### The integration uses data per employment, but this GetConnector retrieves fields from Current data per employment relationship. -Current data per employment relationship only shows data from the main employment. Since your integration retrieves data per employment elsewhere, this GetConnector might show incorrect data. This can cause hard-to-trace errors. [Therefore read this article carefully](./Howto-bi.md#employees-and-employment). Don't hesitate to consult with a SystemIntegrator. +Current data per employment relationship only shows data from the main employment. Since your integration retrieves data per employment elsewhere, this GetConnector might show incorrect data. This can cause hard-to-trace errors. [Therefore read this article carefully](./howto-bi#employees-and-employment). Don't hesitate to consult with a SystemIntegrator. #### This GetConnector retrieves fields from a table with data per employment, but nowhere in the integration is Employment number retrieved. -If an employee has multiple employments, this can result in duplicate rows. [Read this article carefully](./Howto-bi.md#employees-and-employment) for more information about multiple employments. Feel free to schedule a consultation with a SystemIntegrator. +If an employee has multiple employments, this can result in duplicate rows. [Read this article carefully](./howto-bi#employees-and-employment) for more information about multiple employments. Feel free to schedule a consultation with a SystemIntegrator. #### Field **name** or **description** is retrieved from a higher level. diff --git a/markdownpages/profit/nl/AppConnectorAuditorPartner.md b/markdownpages/profit/nl/AppConnectorAuditorPartner.md index a0c498cd..1a1f853d 100644 --- a/markdownpages/profit/nl/AppConnectorAuditorPartner.md +++ b/markdownpages/profit/nl/AppConnectorAuditorPartner.md @@ -104,11 +104,11 @@ Veel GetConnectoren tonen alleen gegevens die door de eindgebruiker in de autori #### EnSe en DvSn worden beide gebruikt. -Kort gezegd: AFAS Profit kent 2 verschillende nummers die het dienstverband aanduiden. Als je die door elkaar heen gebruikt, heb je kans op lastig te traceren fouten. [Lees daarom dit artikel goed door](./howto%20BI.md#medewerkers-en-dienstverband). Schroom niet om dit te overleggen tijdens een afspraak met een SystemIntegrator. +Kort gezegd: AFAS Profit kent 2 verschillende nummers die het dienstverband aanduiden. Als je die door elkaar heen gebruikt, heb je kans op lastig te traceren fouten. [Lees daarom dit artikel goed door](./howto-bi#medewerkers-en-dienstverband). Schroom niet om dit te overleggen tijdens een afspraak met een SystemIntegrator. #### Er worden Financiële mutaties opgehaald, maar **Gewijzigde boekingsdagen** wordt niet gebruikt. -Haal je veel Financiële mutatie op? Gebruik dan ook de GetConnector `Gewijzigde boekingsdagen`. [Lees dit artikel goed door]([./howto%20BI.md#financiële-mutaties](https://help.afas.nl/help/NL/SE/App_Cnnct_View_Audit.htm#o79118)). +Haal je veel Financiële mutatie op? Gebruik dan ook de GetConnector `Gewijzigde boekingsdagen`. [Lees dit artikel goed door](https://help.afas.nl/help/NL/SE/App_Cnnct_View_Audit.htm#o79118). Mogelijk ben je ook geïnteresseerd in het ophalen van verwijderde mutaties. [Lees daarvoor dit artikel](https://help.afas.nl/help/NL/SE/App_Cnnct_Deleted_Data.htm#o124753). @@ -166,11 +166,11 @@ Je kan in een GetConnector een veld op een andere manier weergeven; bijvoorbeeld #### De integratie gebruikt gegevens per dienstverband, maar deze GetConnector haalt velden uit Actuele gegevens per arbeidsverhouding. -Actuele gegevens per arbeidsverhouding toont enkel gegevens uit het hoofddienstverband. Aangezien jouw integratie op andere plekken gegevens per dienstverband ophaalt, kan het zijn dat deze GetConnector de verkeerde gegevens toont. Dit kan lastig te traceren fouten veroorzaken. [Lees daarom dit artikel goed door](./howto%20BI.md#medewerkers-en-dienstverband). Schroom niet om te overleggen met een SystemIntegrator. +Actuele gegevens per arbeidsverhouding toont enkel gegevens uit het hoofddienstverband. Aangezien jouw integratie op andere plekken gegevens per dienstverband ophaalt, kan het zijn dat deze GetConnector de verkeerde gegevens toont. Dit kan lastig te traceren fouten veroorzaken. [Lees daarom dit artikel goed door](./howto-bi#medewerkers-en-dienstverband). Schroom niet om te overleggen met een SystemIntegrator. #### Deze GetConnector haalt velden uit een tabel met gegevens per dienstverband, maar nergens in de integratie wordt Dienstverbandnummer opgehaald. -Als een medewerker meerdere dienstverbanden heeft, kan dit dubbele regels tot gevolg hebben. [Lees dit artikel goed door](./howto%20BI.md#medewerkers-en-dienstverband) voor meer informatie over meerdere dienstverbanden. Plan ook gerust een overleg in met een SystemIntegrator. +Als een medewerker meerdere dienstverbanden heeft, kan dit dubbele regels tot gevolg hebben. [Lees dit artikel goed door](./howto-bi#medewerkers-en-dienstverband) voor meer informatie over meerdere dienstverbanden. Plan ook gerust een overleg in met een SystemIntegrator. #### Veld **naam** of **omschrijving** wordt opgehaald uit een hoger niveau. diff --git a/markdownpages/profit/nl/app-connector-auditor-partner.md b/markdownpages/profit/nl/app-connector-auditor-partner.md index 539f5759..c3096343 100644 --- a/markdownpages/profit/nl/app-connector-auditor-partner.md +++ b/markdownpages/profit/nl/app-connector-auditor-partner.md @@ -170,7 +170,7 @@ Actuele gegevens per arbeidsverhouding toont enkel gegevens uit het hoofddienstv #### Deze GetConnector haalt velden uit een tabel met gegevens per dienstverband, maar nergens in de integratie wordt Dienstverbandnummer opgehaald. -Als een medewerker meerdere dienstverbanden heeft, kan dit dubbele regels tot gevolg hebben. [Lees dit artikel goed door](./howto-bi.md#medewerkers-en-dienstverband) voor meer informatie over meerdere dienstverbanden. Plan ook gerust een overleg in met een SystemIntegrator. +Als een medewerker meerdere dienstverbanden heeft, kan dit dubbele regels tot gevolg hebben. [Lees dit artikel goed door](./howto-bi#medewerkers-en-dienstverband) voor meer informatie over meerdere dienstverbanden. Plan ook gerust een overleg in met een SystemIntegrator. #### Veld **naam** of **omschrijving** wordt opgehaald uit een hoger niveau. diff --git a/scripts/README.md b/scripts/README.md index 9d20def1..fbd5056b 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -4,9 +4,35 @@ This directory contains scripts for validating markdown file naming conventions ## Files -- `markdown-naming-check.py` - Main validation script that checks if markdown files start with a capital letter +- `markdown-naming-check.py` - Main validation script that checks if markdown files follow kebab-case naming convention. The script will provide suggested names for any violations found. + - `README.md` - This documentation file +## Naming Convention + +All markdown files must follow **kebab-case** naming convention: +- All lowercase letters +- Use hyphens (-) to separate words +- Numbers are allowed +- No spaces, underscores, or capital letters +- No consecutive hyphens + +### Examples +✅ **Good examples:** +- `howto-quickstart.md` +- `custom-fields.md` +- `authentication.md` +- `news-profit3.md` + +❌ **Bad examples:** +- `Howto-quickstart.md` (capital letter) +- `custom_fields.md` (underscore) +- `How to quickstart.md` (spaces) +- `howto--quickstart.md` (consecutive hyphens) + +### Exceptions +- `AppConnectorAuditor*.md` files are temporarily exempt from this naming convention + ## Usage ### Basic Usage @@ -20,7 +46,7 @@ python markdown-naming-check.py python markdown-naming-check.py --root-path ./docs # Focus on specific content folders -python markdown-naming-check.py --root-path MarkdownPages +python markdown-naming-check.py --root-path markdownpages # Exclude specific patterns (if needed) python markdown-naming-check.py --exclude ".github/*" "temp/*" "draft_*.md" @@ -32,6 +58,17 @@ python markdown-naming-check.py --json python markdown-naming-check.py --help ``` +## Validation Methods + +### Automatic Validation +1. **GitHub Actions**: Runs on push/pull requests to main branches +2. **Pre-commit Hook**: Runs before each commit (installed in .git/hooks/pre-commit) + +### Bypassing Validation +```bash +git commit --no-verify # Skip pre-commit validation (not recommended) +``` + ## Exit Codes - `0` - All files follow naming conventions (success) @@ -45,17 +82,52 @@ The script is automatically run by the GitHub Actions workflow defined in `.gith - Pull requests to main/develop branches (when MarkdownPages/*.md files are changed) - Manual workflow dispatch -The validation focuses specifically on the `MarkdownPages` folder to ensure content files follow naming conventions. +The validation focuses specifically on the `markdownPages` folder to ensure content files follow naming conventions. -## Naming Convention +## Troubleshooting + +### Python Not Available Locally + +If you don't have Python installed on your local machine: + +1. **The pre-commit hook will automatically skip validation** and show a warning +2. **Validation will still run in GitHub Actions** when you push your changes +3. **To install Python**: Visit https://www.python.org/downloads/ + +### Disabling Local Validation + +If you want to completely disable the pre-commit hook: + +```bash +# On Windows (PowerShell): +.\scripts\disable-pre-commit-hook.ps1 + +# On Linux/Mac: +bash scripts/disable-pre-commit-hook.sh +``` + +### Re-enabling Local Validation + +To re-enable the pre-commit hook: + +```bash +# On Windows (PowerShell): +Move-Item .git/hooks/pre-commit.disabled .git/hooks/pre-commit + +# On Linux/Mac: +bash scripts/enable-pre-commit-hook.sh +``` + +### Common Issues -All markdown files must start with a capital letter (A-Z). Examples: +1. **Python not found**: Hook will skip with warning, validation runs in GitHub Actions +2. **Validation failing**: Check output for specific files that need renaming +3. **False positives**: Verify AppConnectorAuditor files are excluded +4. **Bypass validation**: Use `git commit --no-verify` (not recommended) -- ✅ `README.md` -- ✅ `Authentication.md` -- ✅ `How-to-guide.md` -- ❌ `readme.md` -- ❌ `authentication.md` -- ❌ `how-to-guide.md` +### Getting Help -The script will provide suggested names for any violations found. +- Check validation output for file rename suggestions +- Review naming convention examples above +- Validation always runs in GitHub Actions regardless of local setup +- Contact the development team for assistance diff --git a/scripts/disable-pre-commit-hook.ps1 b/scripts/disable-pre-commit-hook.ps1 new file mode 100644 index 00000000..67cc1ac4 --- /dev/null +++ b/scripts/disable-pre-commit-hook.ps1 @@ -0,0 +1,20 @@ +# PowerShell script to disable the pre-commit hook +# Use this if you don't have Python installed locally + +Write-Host "Disabling pre-commit hook..." -ForegroundColor Yellow + +$preCommitPath = ".git/hooks/pre-commit" +$disabledPath = ".git/hooks/pre-commit.disabled" + +if (Test-Path $preCommitPath) { + Move-Item $preCommitPath $disabledPath + Write-Host "✅ Pre-commit hook disabled successfully" -ForegroundColor Green + Write-Host " The hook has been renamed to 'pre-commit.disabled'" -ForegroundColor Gray + Write-Host " Validation will still run in GitHub Actions when you push" -ForegroundColor Gray +} else { + Write-Host "ℹ️ No pre-commit hook found to disable" -ForegroundColor Blue +} + +Write-Host "" +Write-Host "To re-enable the hook later:" -ForegroundColor Cyan +Write-Host " Move-Item .git/hooks/pre-commit.disabled .git/hooks/pre-commit" -ForegroundColor Gray diff --git a/scripts/disable-pre-commit-hook.sh b/scripts/disable-pre-commit-hook.sh new file mode 100644 index 00000000..bc4a057e --- /dev/null +++ b/scripts/disable-pre-commit-hook.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# +# This script disables the pre-commit hook by renaming it +# Use this if you don't have Python installed locally +# + +echo "Disabling pre-commit hook..." + +if [ -f ".git/hooks/pre-commit" ]; then + mv ".git/hooks/pre-commit" ".git/hooks/pre-commit.disabled" + echo "✅ Pre-commit hook disabled successfully" + echo " The hook has been renamed to 'pre-commit.disabled'" + echo " Validation will still run in GitHub Actions when you push" +else + echo "ℹ️ No pre-commit hook found to disable" +fi + +echo "" +echo "To re-enable the hook later:" +echo " mv .git/hooks/pre-commit.disabled .git/hooks/pre-commit" diff --git a/scripts/enable-pre-commit-hook.sh b/scripts/enable-pre-commit-hook.sh new file mode 100644 index 00000000..e475e6c1 --- /dev/null +++ b/scripts/enable-pre-commit-hook.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# +# This script re-enables the pre-commit hook +# + +echo "Re-enabling pre-commit hook..." + +if [ -f ".git/hooks/pre-commit.disabled" ]; then + mv ".git/hooks/pre-commit.disabled" ".git/hooks/pre-commit" + echo "✅ Pre-commit hook re-enabled successfully" + echo " The hook will now run before each commit" +else + echo "ℹ️ No disabled pre-commit hook found" + if [ -f ".git/hooks/pre-commit" ]; then + echo " Pre-commit hook is already active" + fi +fi diff --git a/scripts/markdown-naming-check.py b/scripts/markdown-naming-check.py index f9927590..ca7be11e 100644 --- a/scripts/markdown-naming-check.py +++ b/scripts/markdown-naming-check.py @@ -48,6 +48,7 @@ def is_excluded(self, file_path: Path) -> bool: True if the file should be excluded, False otherwise """ relative_path = str(file_path.relative_to(self.root_path)).replace('\\', '/') + filename = file_path.name for pattern in self.exclusions: # Convert glob pattern to regex @@ -55,15 +56,17 @@ def is_excluded(self, file_path: Path) -> bool: if regex_pattern.endswith('/'): regex_pattern = regex_pattern[:-1] + '/.*' - # Match the pattern - if re.match(regex_pattern, relative_path) or relative_path.startswith(pattern.rstrip('*')): + # Match the pattern against both relative path and filename + if (re.match(regex_pattern, relative_path) or + re.match(regex_pattern, filename) or + relative_path.startswith(pattern.rstrip('*')) or + filename.startswith(pattern.rstrip('*'))): return True return False def validate_filename(self, file_path: Path) -> Tuple[bool, str]: """ Validate that a markdown filename follows kebab-case convention. - Exception: AppConnectorAuditor* files are allowed to be named differently. Args: file_path: Path to the markdown file @@ -222,7 +225,6 @@ def main(): formatter_class=argparse.RawDescriptionHelpFormatter, epilog=""" This script validates that markdown files follow kebab-case naming convention. -Exception: AppConnectorAuditor* files are allowed to be named differently. Examples: python markdown-naming-check.py