Skip to content

Commit

Permalink
DX: lint PRs with @compwa/commitlint-config
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Oct 5, 2023
1 parent 6dbe292 commit 2da4caf
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 22 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/pr-linting.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# cspell:ignore agilepathway commitlint kode

name: PR linting
on:
pull_request:
Expand All @@ -16,7 +14,7 @@ jobs:
name: Check labels
runs-on: ubuntu-20.04
steps:
- uses: docker://agilepathway/pull-request-label-checker:latest
- uses: docker://agilepathway/pull-request-label-checker:latest # cspell:ignore agilepathway
with:
any_of: >-
🐛 Bug,✨ Feature,⚙️ Enhancement,⚠️ Interface,❗ Behavior,📝 Docs,🔨 Maintenance,🖱️ DX
Expand All @@ -28,5 +26,8 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- run: npm install @commitlint/config-conventional
- uses: JulienKode/[email protected]
- run: npm install @compwa/commitlint-config
- name: Create commitlint config
run: |
echo "module.exports = {extends: ['@compwa/commitlint-config']}" > commitlint.config.js
- uses: JulienKode/[email protected] # cspell:ignore kode
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*.xml
*.yaml
*.yml
commitlint.config.js

# Build files
*.egg-info/
Expand Down
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@
"src/repoma/.template/.cspell.json": true,
"src/repoma/.template/.gitpod.yml": true,
"src/repoma/.template/.prettierrc": true,
"src/repoma/.template/.taplo.toml": true,
"src/repoma/.template/commitlint.config.js": true
"src/repoma/.template/.taplo.toml": true
},
"yaml.schemas": {
"https://citation-file-format.github.io/1.2.0/schema.json": "CITATION.cff",
Expand Down
11 changes: 0 additions & 11 deletions commitlint.config.js

This file was deleted.

16 changes: 13 additions & 3 deletions src/repoma/check_dev_files/commitlint.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
"""Check :file:`commitlint.config.js` config file."""
from repoma.utilities import CONFIG_PATH, update_file
"""Remove :file:`commitlint.config.js` config file.
See https://github.com/ComPWA/repo-maintenance/issues/177.
"""
import os

from repoma.errors import PrecommitError


def main() -> None:
update_file(CONFIG_PATH.commitlint, in_template_folder=True)
path = "commitlint.config.js"

Check warning on line 11 in src/repoma/check_dev_files/commitlint.py

View check run for this annotation

Codecov / codecov/patch

src/repoma/check_dev_files/commitlint.py#L11

Added line #L11 was not covered by tests
if not os.path.exists(path):
return
os.remove(path)
msg = f"Remove outdated {path}"
raise PrecommitError(msg)

Check warning on line 16 in src/repoma/check_dev_files/commitlint.py

View check run for this annotation

Codecov / codecov/patch

src/repoma/check_dev_files/commitlint.py#L13-L16

Added lines #L13 - L16 were not covered by tests
1 change: 0 additions & 1 deletion src/repoma/utilities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
class _ConfigFilePaths(NamedTuple):
citation: Path = Path("CITATION.cff")
codecov: Path = Path("codecov.yml")
commitlint: Path = Path("commitlint.config.js")
cspell: Path = Path(".cspell.json")
editorconfig: Path = Path(".editorconfig")
github_workflow_dir: Path = Path(".github/workflows")
Expand Down

0 comments on commit 2da4caf

Please sign in to comment.