Skip to content

Commit

Permalink
style(*): Pass through code format tools
Browse files Browse the repository at this point in the history
  • Loading branch information
julienloizelet committed Oct 4, 2024
1 parent 79caacf commit b4121b9
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/doc-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ jobs:
run: |
gem install awesome_bot
cd extension
awesome_bot --files README.md --allow-dupe --allow 401 --skip-save-results --white-list ddev.site --base-url http://localhost:8080/
awesome_bot docs/*.md --skip-save-results --allow-dupe --allow 401 --white-list ddev.site,https://crowdsec,php.net/supported-versions.php --base-url http://localhost:8080/docs/
awesome_bot --files README.md --allow-dupe --allow 401,301 --skip-save-results --white-list ddev.site --base-url http://localhost:8080/
awesome_bot docs/*.md --skip-save-results --allow-dupe --allow 401,301 --white-list ddev.site,https://crowdsec,http://crowdsec,php.net/supported-versions.php --base-url http://localhost:8080/docs/
41 changes: 12 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
name: Create Release
# example: gh workflow run release.yml -f tag_name=v1.1.4 -f draft=true
# example: gh workflow run release.yml -f tag_name=v1.1.4
on:
workflow_dispatch:
branches:
- main
inputs:
tag_name:
type: string
required: true
draft:
type: boolean
description: Draft release
default: false
prerelease:
type: boolean
description: Prerelease
default: false
first-release:
type: boolean
description: First release
default: false

jobs:
prepare-release:
Expand All @@ -41,7 +27,7 @@ jobs:
echo "VERSION_NUMBER=$(echo ${{ github.event.inputs.tag_name }} | sed 's/v//g' )" >> $GITHUB_ENV
- name: Clone sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Check version ${{ env.VERSION_NUMBER }} consistency in files
# Check src/Constants.php and CHANGELOG.md
Expand Down Expand Up @@ -70,23 +56,20 @@ jobs:
fi
# Check top [_Compare with previous release_](GITHUB_URL/compare/vLAST_TAG...vVERSION_NUMBER) in CHANGELOG.md
if [[ ${{ github.event.inputs.first-release }} != "true" ]]
COMPARISON=$(grep -oP "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/compare/\K(.*)$" CHANGELOG.md | head -1)
LAST_TAG=$(curl -Ls -o /dev/null -w %{url_effective} $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/latest | grep -oP "\/tag\/\K(.*)$")
if [[ $COMPARISON == "$LAST_TAG...v${{ env.VERSION_NUMBER }})" ]]
then
COMPARISON=$(grep -oP "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/compare/\K(.*)$" CHANGELOG.md | head -1)
LAST_TAG=$(curl -Ls -o /dev/null -w %{url_effective} $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/latest | grep -oP "\/tag\/\K(.*)$")
if [[ $COMPARISON == "$LAST_TAG...v${{ env.VERSION_NUMBER }})" ]]
then
echo "VERSION COMPARISON OK"
else
echo "VERSION COMPARISON KO"
echo $COMPARISON
echo "$LAST_TAG...v${{ env.VERSION_NUMBER }})"
exit 1
fi
echo "VERSION COMPARISON OK"
else
echo "VERSION COMPARISON KO"
echo $COMPARISON
echo "$LAST_TAG...v${{ env.VERSION_NUMBER }})"
exit 1
fi
- name: Create Tag ${{ github.event.inputs.tag_name }}
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
github-token: ${{ github.token }}
script: |
Expand Down
3 changes: 3 additions & 0 deletions src/Bouncer.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ public function getRemoteIp(): string
return $_SERVER['REMOTE_ADDR'] ?? '';
}

/**
* @SuppressWarnings(PHPMD.ElseExpression)
*/
public function getRequestHeaders(): array
{
$allHeaders = [];
Expand Down
29 changes: 19 additions & 10 deletions tests/Integration/IpVerificationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -699,11 +699,16 @@ public function testAppSecFlow()
);

$originCountItem = $cache->getItem(AbstractCache::ORIGINS_COUNT)->get();
$this->assertEquals(
1,
$originCountItem['appsec'],
'The origin count for appsec should be 1'
);
if ($this->useTls) {
$this->assertArrayHasNotKey('appsec', $originCountItem, 'The origin count for appsec should not be set');
} else {
$this->assertEquals(
1,
$originCountItem['appsec'],
'The origin count for appsec should be 1'
);
}

$this->assertEquals(
1,
$originCountItem['clean'],
Expand All @@ -728,11 +733,15 @@ public function testAppSecFlow()
);

$originCountItem = $cache->getItem(AbstractCache::ORIGINS_COUNT)->get();
$this->assertEquals(
1,
$originCountItem['clean_appsec'],
'The origin count for clean_appsec should be 1'
);
if ($this->useTls) {
$this->assertArrayHasNotKey('clean_appsec', $originCountItem, 'The origin count for clean appsec should not be set');
} else {
$this->assertEquals(
1,
$originCountItem['clean_appsec'],
'The origin count for clean appsec should be 1'
);
}
$this->assertEquals(
1,
$originCountItem['clean'],
Expand Down

0 comments on commit b4121b9

Please sign in to comment.