Skip to content

Commit

Permalink
Merge pull request #479 from CPS-IT/task/linting
Browse files Browse the repository at this point in the history
[TASK] Add linting scripts for configuration schema
  • Loading branch information
eliashaeussler authored Feb 26, 2024
2 parents 5bee1bc + f6785da commit f567da2
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/cgl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ jobs:
run: composer lint:composer
- name: Lint Editorconfig
run: composer lint:editorconfig
- name: Lint JSON
run: composer lint:json
- name: Lint PHP
run: composer lint:php -- --format=checkstyle | cs2pr

Expand All @@ -56,3 +58,7 @@ jobs:
# Migration
- name: Rector migration
run: composer migration:rector -- --dry-run

# Schema
- name: Validate configuration schema
run: composer validate-schema
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ composer lint
# Specific linters
composer lint:composer
composer lint:editorconfig
composer lint:json
composer lint:php

# Fix all CGL issues
Expand All @@ -37,6 +38,7 @@ composer fix
# Fix specific CGL issues
composer fix:composer
composer fix:editorconfig
composer fix:json
composer fix:php
```

Expand All @@ -50,6 +52,14 @@ composer sca
composer sca:php
```

## Validate configuration schema

```bash
composer validate-schema
```

💡 You need a local Docker installation for this command.

## Run tests

```bash
Expand Down
10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"phpstan/phpstan-symfony": "^1.1",
"phpstan/phpstan-webmozart-assert": "^1.2",
"phpunit/phpunit": "^10.1 || ^11.0",
"rector/rector": "^1.0.0"
"rector/rector": "^1.0.0",
"seld/jsonlint": "^1.10"
},
"suggest": {
"gmostafa/php-graphql-client": "Used to perform GraphQL requests within GithubVcsProvider (^1.13)"
Expand Down Expand Up @@ -79,18 +80,22 @@
"fix": [
"@fix:composer",
"@fix:editorconfig",
"@fix:json",
"@fix:php"
],
"fix:composer": "@composer normalize",
"fix:editorconfig": "@lint:editorconfig --fix",
"fix:json": "@lint:json",
"fix:php": "php-cs-fixer fix",
"lint": [
"@lint:composer",
"@lint:editorconfig",
"@lint:json",
"@lint:php"
],
"lint:composer": "@fix:composer --dry-run",
"lint:editorconfig": "ec",
"lint:json": "jsonlint resources/configuration.schema.json",
"lint:php": "@fix:php --dry-run",
"migration": [
"@migration:rector"
Expand All @@ -104,6 +109,7 @@
"phpstan analyse -c phpstan.neon"
],
"test": "@test:coverage --no-coverage",
"test:coverage": "phpunit -c phpunit.xml"
"test:coverage": "phpunit -c phpunit.xml",
"validate-schema": "docker run --rm -v \"$(pwd)\":/code swaggest/json-cli json-cli validate-schema resources/configuration.schema.json"
}
}
66 changes: 65 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f567da2

Please sign in to comment.