From 4dbe6f1ea26d2b1518915a6027a076e532c57173 Mon Sep 17 00:00:00 2001 From: Dominik Frantisek Bucik <bucik@ics.muni.cz> Date: Mon, 9 Aug 2021 14:18:09 +0200 Subject: [PATCH] chore: use semantic release and ECS --- .releaserc | 13 ++++++++ README.md | 15 +++++++-- composer.json | 3 ++ ecs.php | 40 ++++++++++++++++++++++++ themes/bbmri/consent/consentform.php | 2 ++ themes/bbmri/consent/noconsent.php | 2 ++ themes/bbmri/core/loginuserpass.php | 2 ++ themes/bbmri/default/error.php | 2 ++ themes/bbmri/default/errorreport.php | 2 ++ themes/bbmri/default/includes/footer.php | 10 +++--- themes/bbmri/default/includes/header.php | 40 +++++++++++------------- themes/bbmri/default/post.php | 2 ++ themes/bbmri/perun/disco-tpl.php | 2 ++ 13 files changed, 106 insertions(+), 29 deletions(-) create mode 100644 .releaserc create mode 100644 ecs.php diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..c14297a --- /dev/null +++ b/.releaserc @@ -0,0 +1,13 @@ +{ + "branches": ["master"], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/changelog", + "@semantic-release/github", + ["@semantic-release/git", { + "assets": ["CHANGELOG.md"], + "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" + }] + ] +} diff --git a/README.md b/README.md index 75c6306..a926a52 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,19 @@ [](https://packagist.org/packages/bbmri/simplesamlphp-module-bbmri) [](https://packagist.org/packages/bbmri/simplesamlphp-module-bbmri) -[](https://www.codefactor.io/repository/github/cesnet/bbmri-aai-proxy-idp-template) +[](https://github.com/CESNET/bbmri-aai-proxy-idp-template/build_and_check.yml) [](https://packagist.org/packages/bbmri/simplesamlphp-module-bbmri) Template for BBMRI AAI Proxy IdP component - ## Instalation - `php composer.phar require bbmri/simplesamlphp-module-bbmri` \ No newline at end of file +## Contribution + +This repository uses [Conventional Commits](https://www.npmjs.com/package/@commitlint/config-conventional). + +Any change that significantly changes behavior in a backward-incompatible way or requires a configuration change must be marked as BREAKING CHANGE. + +### Available scopes: +* theme + +## Instalation +`php composer.phar require` diff --git a/composer.json b/composer.json index 5c55010..cc94e32 100644 --- a/composer.json +++ b/composer.json @@ -17,5 +17,8 @@ ], "require": { "simplesamlphp/composer-module-installer": "~1.0" + }, + "require-dev": { + "symplify/easy-coding-standard": "^9.4" } } diff --git a/ecs.php b/ecs.php new file mode 100644 index 0000000..9acbefb --- /dev/null +++ b/ecs.php @@ -0,0 +1,40 @@ +<?php + +declare(strict_types=1); + +use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer; +use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; +use Symplify\EasyCodingStandard\ValueObject\Option; +use Symplify\EasyCodingStandard\ValueObject\Set\SetList; + +return static function (ContainerConfigurator $containerConfigurator): void { + $services = $containerConfigurator->services(); + $services->set(ArraySyntaxFixer::class) + ->call('configure', [[ + 'syntax' => 'short', + ]]) + ; + + $parameters = $containerConfigurator->parameters(); + $parameters->set(Option::PATHS, [ + __DIR__ . '/ecs.php', + __DIR__ . '/config-templates', + __DIR__ . '/dictionaries', + __DIR__ . '/lib', + __DIR__ . '/themes', + __DIR__ . '/www', + __DIR__ . '/composer.json', + ]); + + $containerConfigurator->import(SetList::CLEAN_CODE); + $containerConfigurator->import(SetList::SYMPLIFY); + $containerConfigurator->import(SetList::ARRAY); + $containerConfigurator->import(SetList::COMMON); + $containerConfigurator->import(SetList::COMMENTS); + $containerConfigurator->import(SetList::CONTROL_STRUCTURES); + $containerConfigurator->import(SetList::DOCBLOCK); + $containerConfigurator->import(SetList::NAMESPACES); + $containerConfigurator->import(SetList::PHPUNIT); + $containerConfigurator->import(SetList::SPACES); + $containerConfigurator->import(SetList::PSR_12); +}; diff --git a/themes/bbmri/consent/consentform.php b/themes/bbmri/consent/consentform.php index 16ae7d9..59c9db3 100644 --- a/themes/bbmri/consent/consentform.php +++ b/themes/bbmri/consent/consentform.php @@ -1,3 +1,5 @@ <?php +declare(strict_types=1); + include \SimpleSAML\Module::getModuleDir('perun') . '/themes/perun/consent/consentform.php'; diff --git a/themes/bbmri/consent/noconsent.php b/themes/bbmri/consent/noconsent.php index f7591fe..c11bf62 100644 --- a/themes/bbmri/consent/noconsent.php +++ b/themes/bbmri/consent/noconsent.php @@ -1,3 +1,5 @@ <?php +declare(strict_types=1); + include \SimpleSAML\Module::getModuleDir('perun') . '/themes/perun/consent/noconsent.php'; diff --git a/themes/bbmri/core/loginuserpass.php b/themes/bbmri/core/loginuserpass.php index f298450..93f4a38 100644 --- a/themes/bbmri/core/loginuserpass.php +++ b/themes/bbmri/core/loginuserpass.php @@ -1,3 +1,5 @@ <?php +declare(strict_types=1); + include \SimpleSAML\Module::getModuleDir('perun') . '/themes/perun/core/loginuserpass.php'; diff --git a/themes/bbmri/default/error.php b/themes/bbmri/default/error.php index d2244cc..af1cc1c 100644 --- a/themes/bbmri/default/error.php +++ b/themes/bbmri/default/error.php @@ -1,3 +1,5 @@ <?php +declare(strict_types=1); + include \SimpleSAML\Module::getModuleDir('perun') . '/themes/perun/default/error.php'; diff --git a/themes/bbmri/default/errorreport.php b/themes/bbmri/default/errorreport.php index e45fc93..1c8e75c 100644 --- a/themes/bbmri/default/errorreport.php +++ b/themes/bbmri/default/errorreport.php @@ -1,3 +1,5 @@ <?php +declare(strict_types=1); + include \SimpleSAML\Module::getModuleDir('perun') . '/themes/perun/default/errorreport.php'; diff --git a/themes/bbmri/default/includes/footer.php b/themes/bbmri/default/includes/footer.php index 7907ddb..2fbb56b 100644 --- a/themes/bbmri/default/includes/footer.php +++ b/themes/bbmri/default/includes/footer.php @@ -1,8 +1,8 @@ -<?php +<?php declare(strict_types=1); use SimpleSAML\Module; -if (!empty($this->data['htmlinject']['htmlContentPost'])) { +if (! empty($this->data['htmlinject']['htmlContentPost'])) { foreach ($this->data['htmlinject']['htmlContentPost'] as $c) { echo $c; } @@ -17,8 +17,8 @@ if (!empty($this->data['htmlinject']['htmlContentPost'])) { <div style="float: left;"> <img src="<?php echo Module::getModuleUrl( - 'bbmri/res/img/BBMRI-ERIC-gateway-for-health_216.png' - ) ?>"> + 'bbmri/res/img/BBMRI-ERIC-gateway-for-health_216.png' +) ?>"> </div> <div style="float: left;"> @@ -26,7 +26,7 @@ if (!empty($this->data['htmlinject']['htmlContentPost'])) { +43 316 34 99 17-0 <a href="mailto:contact@bbmri-eric.eu">contact@bbmri-eric.eu</a> </p> - <p>Copyright © BBMRI-ERIC <?php echo date("Y"); ?> </p> + <p>Copyright © BBMRI-ERIC <?php echo date('Y'); ?> </p> </div> </div> diff --git a/themes/bbmri/default/includes/header.php b/themes/bbmri/default/includes/header.php index da9744a..c6e11a8 100644 --- a/themes/bbmri/default/includes/header.php +++ b/themes/bbmri/default/includes/header.php @@ -1,4 +1,4 @@ -<?php +<?php declare(strict_types=1); use SimpleSAML\Module; @@ -22,7 +22,7 @@ if (array_key_exists('pageid', $this->data)) { 'post' => &$this->data['htmlinject']['htmlContentPost'], 'head' => &$this->data['htmlinject']['htmlContentHead'], 'jquery' => &$jquery, - 'page' => $this->data['pageid'] + 'page' => $this->data['pageid'], ]; Module::callHooks('htmlinject', $hookinfo); @@ -30,13 +30,11 @@ if (array_key_exists('pageid', $this->data)) { // - o - o - o - o - o - o - o - o - o - o - o - o - /** - * Do not allow to frame SimpleSAMLphp pages from another location. - * This prevents clickjacking attacks in modern browsers. + * Do not allow to frame SimpleSAMLphp pages from another location. This prevents clickjacking attacks in modern + * browsers. * - * If you don't want any framing at all you can even change this to - * 'DENY', or comment it out if you actually want to allow foreign - * sites to put SimpleSAMLphp in a frame. The latter is however - * probably not a good security practice. + * If you don't want any framing at all you can even change this to 'DENY', or comment it out if you actually want to + * allow foreign sites to put SimpleSAMLphp in a frame. The latter is however probably not a good security practice. */ header('X-Frame-Options: SAMEORIGIN'); @@ -49,9 +47,9 @@ header('X-Frame-Options: SAMEORIGIN'); <script type="text/javascript" src="/<?php echo $this->data['baseurlpath']; ?>resources/script.js"></script> <title><?php if (array_key_exists('header', $this->data)) { - echo $this->data['header']; + echo $this->data['header']; } else { - echo 'SimpleSAMLphp'; + echo 'SimpleSAMLphp'; } ?></title> @@ -61,26 +59,26 @@ header('X-Frame-Options: SAMEORIGIN'); <?php - if (!empty($jquery)) { + if (! empty($jquery)) { $version = '1.8'; if (array_key_exists('version', $jquery)) { $version = $jquery['version']; } - if ($version == '1.8') { + if ($version === '1.8') { if (isset($jquery['core']) && $jquery['core']) { - echo('<script type="text/javascript" src="/' . $this->data['baseurlpath'] . - 'resources/jquery-1.8.js"></script>' . "\n"); + echo '<script type="text/javascript" src="/' . $this->data['baseurlpath'] . + 'resources/jquery-1.8.js"></script>' . "\n"; } if (isset($jquery['ui']) && $jquery['ui']) { - echo('<script type="text/javascript" src="/' . $this->data['baseurlpath'] . - 'resources/jquery-ui-1.8.js"></script>' . "\n"); + echo '<script type="text/javascript" src="/' . $this->data['baseurlpath'] . + 'resources/jquery-ui-1.8.js"></script>' . "\n"; } if (isset($jquery['css']) && $jquery['css']) { - echo('<link rel="stylesheet" media="screen" type="text/css" href="/' . $this->data['baseurlpath'] . - 'resources/uitheme1.8/jquery-ui.css" />' . "\n"); + echo '<link rel="stylesheet" media="screen" type="text/css" href="/' . $this->data['baseurlpath'] . + 'resources/uitheme1.8/jquery-ui.css" />' . "\n"; } } } @@ -90,7 +88,7 @@ header('X-Frame-Options: SAMEORIGIN'); 'resources/clipboard.min.js"></script>' . "\n"; } - if (!empty($this->data['htmlinject']['htmlContentHead'])) { + if (! empty($this->data['htmlinject']['htmlContentHead'])) { foreach ($this->data['htmlinject']['htmlContentHead'] as $c) { echo $c; } @@ -139,7 +137,7 @@ if ($onLoad !== '') { alt="BBMRI-ERIC logo"> <h1> <?php - echo(isset($this->data['header']) ? $this->data['header'] : 'BBMRI-ERIC proxy IdP'); + echo isset($this->data['header']) ? $this->data['header'] : 'BBMRI-ERIC proxy IdP'; ?> </h1> </div> @@ -148,7 +146,7 @@ if ($onLoad !== '') { <?php -if (!empty($this->data['htmlinject']['htmlContentPre'])) { +if (! empty($this->data['htmlinject']['htmlContentPre'])) { foreach ($this->data['htmlinject']['htmlContentPre'] as $c) { echo $c; } diff --git a/themes/bbmri/default/post.php b/themes/bbmri/default/post.php index 7c314b7..e7e3e5a 100644 --- a/themes/bbmri/default/post.php +++ b/themes/bbmri/default/post.php @@ -1,3 +1,5 @@ <?php +declare(strict_types=1); + include \SimpleSAML\Module::getModuleDir('perun') . '/themes/perun/default/post.php'; diff --git a/themes/bbmri/perun/disco-tpl.php b/themes/bbmri/perun/disco-tpl.php index aed1107..6833b67 100644 --- a/themes/bbmri/perun/disco-tpl.php +++ b/themes/bbmri/perun/disco-tpl.php @@ -1,3 +1,5 @@ <?php +declare(strict_types=1); + include \SimpleSAML\Module::getModuleDir('perun') . '/themes/perun/perun/disco-tpl.php'; -- GitLab