diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index a4436ce..435833c 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -14,33 +14,32 @@ on: # yamllint disable-line rule:truthy workflow_dispatch: jobs: + phplinter: + name: 'PHP-Linter' + strategy: + fail-fast: false + matrix: + php-version: ['8.1', '8.2', '8.3', '8.4'] + + uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.9.2 + with: + php-version: ${{ matrix.php-version }} + linter: - name: Linter - runs-on: ['ubuntu-latest'] + name: 'Linter' + strategy: + fail-fast: false - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Lint Code Base - uses: super-linter/super-linter/slim@v7 - env: - SAVE_SUPER_LINTER_OUTPUT: false - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - LINTER_RULES_PATH: 'tools/linters' - LOG_LEVEL: NOTICE - VALIDATE_ALL_CODEBASE: true - VALIDATE_CSS: true - VALIDATE_JAVASCRIPT_ES: true - VALIDATE_JSON: true - VALIDATE_PHP_BUILTIN: true - VALIDATE_YAML: true - VALIDATE_XML: true - VALIDATE_GITHUB_ACTIONS: true + uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1.9.2 + with: + enable_eslinter: true + enable_jsonlinter: true + enable_stylelinter: false + enable_yamllinter: true quality: name: Quality control + needs: [unit-tests-linux] runs-on: [ubuntu-latest] steps: @@ -109,7 +108,9 @@ jobs: security: name: Security checks + needs: [unit-tests-linux] runs-on: [ubuntu-latest] + steps: - name: Setup PHP, with composer and extensions # https://github.com/shivammathur/setup-php @@ -151,7 +152,7 @@ jobs: unit-tests-linux: name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}" runs-on: ${{ matrix.operating-system }} - needs: [linter, quality, security] + needs: [phplinter, linter] strategy: fail-fast: false matrix: @@ -216,7 +217,7 @@ jobs: unit-tests-windows: name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}" runs-on: ${{ matrix.operating-system }} - needs: [linter, quality, security] + needs: [phplinter, linter] strategy: fail-fast: true matrix: diff --git a/codecov.yml b/codecov.yml index d01dd7d..ef60591 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,3 +1,5 @@ +--- + coverage: status: project: diff --git a/routing/routes/routes.yaml b/routing/routes/routes.yaml index 85d3ff7..6631100 100644 --- a/routing/routes/routes.yaml +++ b/routing/routes/routes.yaml @@ -1,29 +1,43 @@ +--- + negotiate-auth: - path: /auth - defaults: { _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::auth' } - methods: [GET] + path: /auth + defaults: { + _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::auth' + } + methods: [GET] negotiate-error: - path: /error - defaults: { _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::error' } - methods: [GET] + path: /error + defaults: { + _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::error' + } + methods: [GET] negotiate-enable: - path: /enable - defaults: { _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::enable' } - methods: [GET] + path: /enable + defaults: { + _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::enable' + } + methods: [GET] negotiate-disable: - path: /disable - defaults: { _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::disable' } - methods: [GET] + path: /disable + defaults: { + _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::disable' + } + methods: [GET] negotiate-retry: - path: /retry - defaults: { _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::retry' } - methods: [GET] + path: /retry + defaults: { + _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::retry' + } + methods: [GET] negotiate-fallback: - path: /fallback - defaults: { _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::fallback' } - methods: [GET] + path: /fallback + defaults: { + _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::fallback' + } + methods: [GET] diff --git a/tests/src/Controller/NegotiateControllerTest.php b/tests/src/Controller/NegotiateControllerTest.php index 2865b69..07bf8d5 100644 --- a/tests/src/Controller/NegotiateControllerTest.php +++ b/tests/src/Controller/NegotiateControllerTest.php @@ -18,12 +18,9 @@ * * @package SimpleSAML\Test */ -class NegotiateControllerTest extends TestCase +final class NegotiateControllerTest extends TestCase { - /** @var \SimpleSAML\Configuration */ protected Configuration $config; - - /** @var \SimpleSAML\Session */ protected Session $session; /** @@ -125,8 +122,6 @@ public function testErrorInvalidState(): void public function testEnable(): void { $c = new Controller\NegotiateController($this->config, $this->session); - - /** @var \SimpleSAML\XHTML\Template $response */ $response = $c->enable(); // Validate response @@ -157,8 +152,6 @@ public function testEnable(): void public function testDisable(): void { $c = new Controller\NegotiateController($this->config, $this->session); - - /** @var \SimpleSAML\XHTML\Template $response */ $response = $c->disable(); // Validate response diff --git a/tools/linters/.yaml-lint.yml b/tools/linters/.yaml-lint.yml new file mode 100644 index 0000000..630095a --- /dev/null +++ b/tools/linters/.yaml-lint.yml @@ -0,0 +1,7 @@ +--- + +extends: default + +rules: + line-length: + max: 120 diff --git a/tools/linters/eslint.config.js b/tools/linters/eslint.config.js new file mode 100644 index 0000000..3fed36d --- /dev/null +++ b/tools/linters/eslint.config.js @@ -0,0 +1,14 @@ +// eslint.config.js +const { defineConfig } = require("eslint/config"); + +module.exports = defineConfig([ + { + languageOptions: { + ecmaVersion: 2015, + sourceType: "module" + }, + files: [ + "**.js" + ], + } +]);