Skip to content

Commit

Permalink
Introduce EditorConfig (#66)
Browse files Browse the repository at this point in the history
* Introduce EditorConfig

* Add eclint to codestyle workflow

* Upgrade actions/checkout to version 3
  • Loading branch information
szepeviktor authored Sep 26, 2023
1 parent d902da5 commit 64ceb8d
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 21 deletions.
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# https://EditorConfig.org

root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 200
eclint_block_comment_start = /*
eclint_block_comment = *
eclint_block_comment_end = */

[*.md]
trim_trailing_whitespace = false
max_line_length = unset

[*.yml]
indent_size = 2
4 changes: 4 additions & 0 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ jobs:
run: composer install
- name: Run PHP CS Fixer
run: composer run cs
- name: Check EditorConfig configuration
run: test -f .editorconfig
- name: Check adherence to EditorConfig
uses: greut/eclint-action@v0
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<picture>
<source srcset="docs/images/banner_dark.png" media="(prefers-color-scheme: dark)">
<img src="docs/images/banner_light.png" alt="Banner">
<source srcset="docs/images/banner_dark.png" media="(prefers-color-scheme: dark)">
<img src="docs/images/banner_light.png" alt="Banner">
</picture>

# Standards
Expand Down
14 changes: 12 additions & 2 deletions dev/SpecUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ class SpecUpdater
public static function update(Event $event): void
{
$type = $event->getArguments()[0] ?? throw new InvalidArgumentException('Please specify the type with "-- --type=' . implode(',', UnitEnum::names(SpecType::class)) . '"');
$type = str_starts_with($type, '--type=') === false ? throw new InvalidArgumentException('Please specify the type with "-- --type=' . implode(',', UnitEnum::names(SpecType::class)) . '"') : substr($type, 7);
$type = str_starts_with($type, '--type=') === false
? throw new InvalidArgumentException('Please specify the type with "-- --type=' . implode(',', UnitEnum::names(SpecType::class)) . '"')
: substr($type, 7);

$sources = match (UnitEnum::tryFromKey(SpecType::class, strtoupper(str_replace('-', '_', $type)))) {
SpecType::COUNTRY => self::COUNTRY_SOURCES,
Expand Down Expand Up @@ -109,7 +111,15 @@ public static function update(Event $event): void
}

$backOffInSeconds *= $i;
echo 'Updating spec failed with throwable "' . get_class($throwable) . '" and message "' . $throwable->getMessage() . '" in file "' . $throwable->getFile() . ':' . $throwable->getLine() . '", retrying in ' . $backOffInSeconds . ' seconds' . PHP_EOL;
printf(
'Updating spec failed with throwable "%s" and message "%s" in file "%s:%d", retrying in %d seconds%s',
get_class($throwable),
$throwable->getMessage(),
$throwable->getFile(),
$throwable->getLine(),
$backOffInSeconds,
PHP_EOL
);
sleep($backOffInSeconds);
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion docs/country.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ $value = $valueNumeric->value; // '528'
$valueName = $valueNumeric->name; // 'Netherlands'
$valueAlpha2 = $valueNumeric->toISO3166_1_Alpha_2(); // ISO3166_1_Alpha_2::Netherlands
$valueAlpha3 = $valueNumeric->toISO3166_1_Alpha_3(); // ISO3166_1_Alpha_3::Netherlands
```
```
33 changes: 17 additions & 16 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
verbose="true"
forceCoversAnnotation="true"
failOnWarning="true"
failOnEmptyTestSuite="true"
failOnIncomplete="true"
failOnRisky="true"
failOnSkipped="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutChangesToGlobalState="true"
beStrictAboutResourceUsageDuringSmallTests="true"
beStrictAboutTodoAnnotatedTests="true"
convertDeprecationsToExceptions="true"
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
verbose="true"
forceCoversAnnotation="true"
failOnWarning="true"
failOnEmptyTestSuite="true"
failOnIncomplete="true"
failOnRisky="true"
failOnSkipped="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutChangesToGlobalState="true"
beStrictAboutResourceUsageDuringSmallTests="true"
beStrictAboutTodoAnnotatedTests="true"
convertDeprecationsToExceptions="true"
>
<testsuites>
<testsuite name="Unit">
Expand Down

0 comments on commit 64ceb8d

Please sign in to comment.