From 7d0276339872b06521e445e1fcdd60ae564668aa Mon Sep 17 00:00:00 2001 From: Mohd Farhan Date: Sat, 7 Mar 2026 15:17:56 +0400 Subject: [PATCH 1/2] feat: add .editorconfig for consistent formatting across editors Covers .md, .yaml, and .feature files, aligned with existing yamllint and gherkin-lintrc configurations. Fixes #10 --- .editorconfig | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..98e7d88 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,25 @@ +# EditorConfig - https://editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +indent_style = space +indent_size = 2 +trim_trailing_whitespace = false + +[*.{yaml,yml}] +indent_style = space +indent_size = 2 + +[*.feature] +indent_style = space +indent_size = 2 + +[Makefile] +indent_style = tab From c1a7712a521d3646d71069b56fb01a560cbf9238 Mon Sep 17 00:00:00 2001 From: Mohd Farhan Date: Wed, 11 Mar 2026 22:32:20 +0400 Subject: [PATCH 2/2] introduce workspace-config/ with shared repo configuration files Move .editorconfig into workspace-config/ and add .gitattributes (LF enforcement, binary markers) and .gitignore-template. Update README with new repository structure. Fixes #10 --- README.md | 19 +++++---- .../.editorconfig | 0 workspace-config/.gitattributes | 20 ++++++++++ workspace-config/.gitignore-template | 19 +++++++++ workspace-config/README.md | 40 +++++++++++++++++++ 5 files changed, 91 insertions(+), 7 deletions(-) rename .editorconfig => workspace-config/.editorconfig (100%) create mode 100644 workspace-config/.gitattributes create mode 100644 workspace-config/.gitignore-template create mode 100644 workspace-config/README.md diff --git a/README.md b/README.md index 8f47c7c..96ee447 100644 --- a/README.md +++ b/README.md @@ -109,13 +109,18 @@ tooling/ │ └── api_review_validator_v0_6.py ├── shared-actions/ │ └── validate-release-plan/ # Composite GitHub Action (stub) -└── validation/ - ├── docs/ - ├── schemas/ # JSON/YAML schemas - │ ├── release-plan-schema.yaml - │ └── release-metadata-schema.yaml - └── scripts/ - └── validate-release-plan.py +├── validation/ +│ ├── docs/ +│ ├── schemas/ # JSON/YAML schemas +│ │ ├── release-plan-schema.yaml +│ │ └── release-metadata-schema.yaml +│ └── scripts/ +│ └── validate-release-plan.py +└── workspace-config/ # Shared root-level config files for API repos + ├── .editorconfig + ├── .gitattributes + ├── .gitignore-template + └── README.md ``` ## Release Information diff --git a/.editorconfig b/workspace-config/.editorconfig similarity index 100% rename from .editorconfig rename to workspace-config/.editorconfig diff --git a/workspace-config/.gitattributes b/workspace-config/.gitattributes new file mode 100644 index 0000000..2a4d6c1 --- /dev/null +++ b/workspace-config/.gitattributes @@ -0,0 +1,20 @@ +# Normalize all text files to LF line endings on commit. +# Contributors on Windows will still see CRLF in their working tree +# (if core.autocrlf is set), but the repository always stores LF. +* text=auto eol=lf + +# Explicitly mark binary formats so Git never attempts EOL conversion. +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.ico binary +*.pdf binary +*.zip binary +*.tar.gz binary +*.pptx binary +*.docx binary +*.xlsx binary + +# Slim down release artifacts by excluding meeting minutes. +/documentation/MeetingMinutes export-ignore diff --git a/workspace-config/.gitignore-template b/workspace-config/.gitignore-template new file mode 100644 index 0000000..88280c5 --- /dev/null +++ b/workspace-config/.gitignore-template @@ -0,0 +1,19 @@ +# OS-generated files +.DS_Store +Thumbs.db +Desktop.ini + +# Editor / IDE files +.idea/ +.vscode/ +*.swp +*.swo +*~ + +# Node (used by some linting/tooling setups) +node_modules/ + +# Python +__pycache__/ +*.pyc +.venv/ diff --git a/workspace-config/README.md b/workspace-config/README.md new file mode 100644 index 0000000..7f6c887 --- /dev/null +++ b/workspace-config/README.md @@ -0,0 +1,40 @@ +# Workspace Configuration + +Shared configuration files that should be placed in the **root** of each CAMARA API repository. + +These files standardize editor behavior, line-ending enforcement, and ignored-file patterns across all contributors, regardless of OS or IDE. + +## Files + +| File | Purpose | Placement in API repo | +|------|---------|----------------------| +| `.editorconfig` | Consistent indentation, charset, and line endings across editors ([spec](https://editorconfig.org)) | Copy as-is to repo root | +| `.gitattributes` | Enforces LF line endings at the Git layer and marks binary formats | Copy as-is to repo root | +| `.gitignore-template` | Common ignore patterns for OS, editor, and tooling artifacts | Copy to repo root **and rename** to `.gitignore` | + +> `.gitignore-template` is named with a `-template` suffix so that Git does not pick it up inside this tooling repository itself. + +## Adoption + +To adopt these configurations in an API repository: + +1. Copy `.editorconfig` and `.gitattributes` into the repository root. +2. Copy `.gitignore-template` to the repository root and rename it to `.gitignore`. Merge with any existing `.gitignore` entries the repo already has. +3. Commit and push. + +If the repository already contains files with CRLF line endings, a separate normalization PR should be created after `.gitattributes` is in place — see [#113](https://github.com/camaraproject/tooling/issues/113) for the migration approach. + +## How the files work together + +- `.editorconfig` guides editors to use the correct settings **while editing**, so contributors produce correctly formatted files from the start. +- `.gitattributes` acts as a **safety net at the Git layer** — even if an editor writes CRLF, Git normalizes to LF on commit. +- `.gitignore` keeps OS junk and editor artifacts out of version control. + +## Alignment with linting rules + +The `.editorconfig` settings are derived from the existing linting configurations in [`linting/config/`](../linting/config/): + +- **YAML** indent/whitespace rules match [`.yamllint.yaml`](../linting/config/.yamllint.yaml) +- **Gherkin** indent rules match [`.gherkin-lintrc`](../linting/config/.gherkin-lintrc) + +This keeps editor formatting and CI linting in sync, so contributors get feedback while editing rather than failing in CI.