From a9ad0554e575d2fa1b61808d88901a55749f8dea Mon Sep 17 00:00:00 2001 From: Jordan Brauer <18744334+jordanbrauer@users.noreply.github.com> Date: Tue, 16 Feb 2021 00:26:31 -0600 Subject: [PATCH] auto format & lint the composer manifest (#2) * 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 --- .editorconfig | 4 ++++ .github/workflows/ci.yml | 6 +++--- .php_cs | 2 -- Makefile | 6 ++++++ composer.json | 39 ++++++++++++++++++++------------------- 5 files changed, 33 insertions(+), 24 deletions(-) diff --git a/.editorconfig b/.editorconfig index 0fa24df..7b1b4e1 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d514085..e74fd79 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 diff --git a/.php_cs b/.php_cs index 6937b80..449db35 100644 --- a/.php_cs +++ b/.php_cs @@ -9,8 +9,6 @@ $finder = PhpCsFixer\Finder::create() 'bin', 'docs', 'vendor', - 'node_modules', - 'bower_components', ]) ->in([ "{$root}/src", diff --git a/Makefile b/Makefile index 039ddbf..f10257b 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/composer.json b/composer.json index 6d9e978..ef5f0f1 100755 --- a/composer.json +++ b/composer.json @@ -1,13 +1,6 @@ { "name": "jordanbrauer/runes", "description": "A low-level string character analysis library for PHP.", - "license": "MIT", - "authors": [ - { - "name": "Jordan Brauer", - "email": "18744334+jordanbrauer@users.noreply.github.com" - } - ], "keywords": [ "string", "security", @@ -17,6 +10,24 @@ "utf-32", "analysis" ], + "license": "MIT", + "authors": [ + { + "name": "Jordan Brauer", + "email": "18744334+jordanbrauer@users.noreply.github.com" + } + ], + "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/" @@ -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" } }