Skip to content

Commit

Permalink
auto format & lint the composer manifest (#2)
Browse files Browse the repository at this point in the history
* add composer normalizer and run it

* remove unused excludes

* use tabs for makefile

* auto format composer manifest before source code

* add lint target

* add composer lint to CI workflow
  • Loading branch information
jordanbrauer authored Feb 16, 2021
1 parent 94de939 commit a9ad055
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 24 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true

[{Makefile,makefile,**.mk}]
indent_style = tab
indent_size = 4

[*.{php,json,xml}]
indent_size = 4

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ jobs:
with:
name: test-dist
- name: Unpackage Artifacts
run: tar -xvf vendor.tar
run: tar -xvf vendor.tar
- name: Validate
run: |
composer validate
# composer normalize --dry-run
composer normalize --dry-run --indent-size=4 --indent-style=space --no-update-lock --no-check-lock
- name: Lint (Codestyle)
run: composer style -- --dry-run
# - name: Static Analysis
Expand All @@ -64,6 +64,6 @@ jobs:
with:
name: test-dist
- name: Unpackage Artifacts
run: tar -xvf vendor.tar
run: tar -xvf vendor.tar
- name: Test
run: composer test
2 changes: 0 additions & 2 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ $finder = PhpCsFixer\Finder::create()
'bin',
'docs',
'vendor',
'node_modules',
'bower_components',
])
->in([
"{$root}/src",
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ test: ## Run the tests
@composer test

style: vendor ## Format the application code and configuration
@composer normalize --indent-size=4 --indent-style=space
@composer style

lint: vendor ## Lint the codebase for formatting issues
@composer validate
@composer normalize --dry-run --indent-size=4 --indent-style=space --no-update-lock --no-check-lock
@composer style -- --dry-run

vendor: composer.json composer.lock ## Install Composer vendor dependencies
@composer install --optimize-autoloader --no-suggest --no-interaction
@composer validate
39 changes: 20 additions & 19 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
{
"name": "jordanbrauer/runes",
"description": "A low-level string character analysis library for PHP.",
"license": "MIT",
"authors": [
{
"name": "Jordan Brauer",
"email": "[email protected]"
}
],
"keywords": [
"string",
"security",
Expand All @@ -17,6 +10,24 @@
"utf-32",
"analysis"
],
"license": "MIT",
"authors": [
{
"name": "Jordan Brauer",
"email": "[email protected]"
}
],
"require": {
"php": ">=7.1 || >=8.0",
"ext-intl": "*"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.13",
"friendsofphp/php-cs-fixer": "^2.18",
"pestphp/pest": "^1.0",
"phpunit/phpunit": "^9.3",
"symfony/var-dumper": "^5.2"
},
"autoload": {
"psr-4": {
"Rune\\": "src/"
Expand All @@ -27,18 +38,8 @@
"Rune\\Test\\": "tests/"
}
},
"require": {
"php": ">=7.1 || >=8.0",
"ext-intl": "*"
},
"require-dev": {
"symfony/var-dumper": "^5.2",
"phpunit/phpunit": "^9.3",
"friendsofphp/php-cs-fixer": "^2.18",
"pestphp/pest": "^1.0"
},
"scripts": {
"test": "vendor/bin/pest --configuration=./phpunit.xml --testsuite=all --color=always",
"style": "vendor/bin/php-cs-fixer fix --config=.php_cs --show-progress=dots --ansi -v"
"style": "vendor/bin/php-cs-fixer fix --config=.php_cs --show-progress=dots --ansi -v",
"test": "vendor/bin/pest --configuration=./phpunit.xml --testsuite=all --color=always"
}
}

0 comments on commit a9ad055

Please sign in to comment.