From a538d3dff6d202d485469bac9d40737298a2b280 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Tue, 29 Apr 2025 12:57:55 +0200 Subject: [PATCH 1/3] Cleaned up code --- .github/workflows/pr.yml | 45 +++---- .gitignore | 2 - .markdownlint.jsonc | 13 ++ .markdownlintignore | 2 + .markdownlintrc | 18 --- CHANGELOG.md | 2 + README.md | 25 ++-- composer.json | 113 +++++++++--------- modules/os2forms_attachment/README.md | 14 ++- modules/os2forms_autocomplete/README.md | 9 +- modules/os2forms_dawa/README.md | 7 +- .../DataLookup/DatafordelerDataLookup.php | 10 +- modules/os2forms_fasit/README.md | 24 ++-- modules/os2forms_fasit/docs/BENYTTELSE.md | 10 +- modules/os2forms_forloeb/CHANGELOG.md | 9 +- modules/os2forms_forloeb/README.md | 16 +-- modules/os2forms_nemid/README.md | 5 +- .../os2forms_permissions_by_term/README.md | 7 +- modules/os2forms_sbsys/README.md | 1 + modules/os2forms_webform_maps/README.md | 3 + package.json | 13 -- 21 files changed, 164 insertions(+), 184 deletions(-) create mode 100644 .markdownlint.jsonc create mode 100644 .markdownlintignore delete mode 100644 .markdownlintrc delete mode 100644 package.json diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 69766ce..fcc49f4 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -23,10 +23,10 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: [ '8.1' ] + php-versions: [ '8.3' ] dependency-version: [ prefer-lowest, prefer-stable ] steps: - - uses: actions/checkout@master + - uses: actions/checkout@v4 - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@v2 with: @@ -47,18 +47,23 @@ jobs: - name: Validate composer files run: | composer config --no-plugins allow-plugins.mglaman/composer-drupal-lenient true - composer validate --strict composer.json + # The --strict flag on validate has been removed due to the package drupal/config_entity_revisions 2.0.x-dev + # being considered a version cf. https://getcomposer.org/doc/articles/versions.md#branches + composer validate composer.json # Check that dependencies resolve. composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction + - name: Check that composer file is normalized + run: | + composer normalize --dry-run php-coding-standards: name: PHP coding standards runs-on: ubuntu-latest strategy: matrix: - php-versions: [ '8.1' ] + php-versions: [ '8.3' ] steps: - - uses: actions/checkout@master + - uses: actions/checkout@v4 - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@v2 with: @@ -89,9 +94,9 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: [ '8.1' ] + php-versions: [ '8.3' ] steps: - - uses: actions/checkout@master + - uses: actions/checkout@v4 - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@v2 with: @@ -113,27 +118,13 @@ jobs: run: | ./scripts/code-analysis - markdownlint: + coding-standards-markdown: + name: Markdown coding standards runs-on: ubuntu-latest - name: markdownlint steps: - name: Checkout uses: actions/checkout@v4 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - name: Cache yarn packages - uses: actions/cache@v4 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - name: Yarn install - uses: actions/setup-node@v2 - with: - node-version: '20' - - run: yarn install - - name: markdownlint - run: yarn coding-standards-check/markdownlint + + - name: Coding standards + run: | + docker run --rm --volume $PWD:/md peterdavehello/markdownlint markdownlint '**/*.md' diff --git a/.gitignore b/.gitignore index 1cc8643..1a6c252 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,3 @@ composer.lock vendor -node_modules/ -yarn.lock diff --git a/.markdownlint.jsonc b/.markdownlint.jsonc new file mode 100644 index 0000000..a28c580 --- /dev/null +++ b/.markdownlint.jsonc @@ -0,0 +1,13 @@ +{ + "default": true, + // https://github.com/DavidAnson/markdownlint/blob/main/doc/md013.md + "line-length": { + "line_length": 120, + "code_blocks": false, + "tables": false + }, + // https://github.com/DavidAnson/markdownlint/blob/main/doc/md024.md + "no-duplicate-heading": { + "siblings_only": true + } +} diff --git a/.markdownlintignore b/.markdownlintignore new file mode 100644 index 0000000..6772bd6 --- /dev/null +++ b/.markdownlintignore @@ -0,0 +1,2 @@ +# https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#ignoring-files +vendor/ diff --git a/.markdownlintrc b/.markdownlintrc deleted file mode 100644 index 7563715..0000000 --- a/.markdownlintrc +++ /dev/null @@ -1,18 +0,0 @@ -{ - // @see https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.jsonc - // https://github.com/DavidAnson/markdownlint/blob/main/doc/md013.md - "MD013": { - // Exclude code blocks - "code_blocks": false - }, - - // Prevent complaining on duplicated headings in CHANGELOG.md - // https://github.com/DavidAnson/markdownlint/blob/main/doc/md024.md - "MD024": { - "siblings_only": true - } -} - -// Local Variables: -// mode: json -// End: diff --git a/CHANGELOG.md b/CHANGELOG.md index 7175253..5ecaa8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ before starting to add changes. Use example [placed in the end of the page](#exa ## [Unreleased] +- [PR-168](https://github.com/OS2Forms/os2forms/pull/168) + Cleaned up code - [PR-166](https://github.com/OS2Forms/os2forms/pull/166) - Fix digital post commands - Updated versions in GitHub Actions `uses` steps diff --git a/README.md b/README.md index 12e4ad0..fb6ed42 100644 --- a/README.md +++ b/README.md @@ -121,30 +121,29 @@ run the checks locally. ### PHP ```sh -docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.1-fpm composer install -docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.1-fpm composer coding-standards-check - +docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.3-fpm composer install # Fix (some) coding standards issues. -docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.1-fpm composer coding-standards-apply +docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.3-fpm composer coding-standards-apply +docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.3-fpm composer coding-standards-check ``` ### Markdown ```sh -docker run --rm --volume ${PWD}:/app --workdir /app node:20 yarn install -docker run --rm --volume ${PWD}:/app --workdir /app node:20 yarn coding-standards-check/markdownlint - -# Fix (some) coding standards issues. -docker run --rm --volume ${PWD}:/app --workdir /app node:20 yarn coding-standards-apply/markdownlint +docker pull peterdavehello/markdownlint +docker run --rm --volume $PWD:/md peterdavehello/markdownlint markdownlint '**/*.md' --fix +docker run --rm --volume $PWD:/md peterdavehello/markdownlint markdownlint '**/*.md' ``` ## Code analysis We use [PHPStan](https://phpstan.org/) for static code analysis. -Running statis code analysis on a standalone Drupal module is a bit tricky, so -we use a helper script to run the analysis: +Running statis code analysis on a standalone Drupal module is a bit tricky, so we use a helper script to run the +analysis: -```sh -./scripts/code-analysis +```shell +docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.3-fpm ./scripts/code-analysis ``` + +**Note**: Currently the code analysis is only run on the `os2forms_digital_post` sub-module (cf. [`phpstan.neon`](./phpstan.neon)). diff --git a/composer.json b/composer.json index 11ffd68..ae72ae5 100644 --- a/composer.json +++ b/composer.json @@ -1,20 +1,8 @@ { "name": "os2forms/os2forms", - "type": "drupal-module", "description": "Drupal 8 OS2Form module provides advanced webform functionality for Danish Municipalities", - "minimum-stability": "dev", - "prefer-stable": true, "license": "EUPL-1.2", - "repositories": { - "drupal": { - "type": "composer", - "url": "https://packages.drupal.org/8" - }, - "assets": { - "type": "composer", - "url": "https://asset-packagist.org" - } - }, + "type": "drupal-module", "require": { "php": "^8.1", "ext-dom": "*", @@ -23,10 +11,10 @@ "dompdf/dompdf": "^2.0", "drupal/admin_toolbar": "^3.0", "drupal/advancedqueue": "^1.0", - "drupal/cache_control_override": "^1.1|^2.0", + "drupal/cache_control_override": "^1.1 || ^2.0", "drupal/clientside_validation": "^4.0", "drupal/coc_forms_auto_export": "^2.0@alpha", - "drupal/config_entity_revisions": "dev-2.0.x", + "drupal/config_entity_revisions": "2.0.x-dev", "drupal/diff": "^1.0", "drupal/embed": "^1.4", "drupal/entity_print": "^2.1", @@ -42,7 +30,7 @@ "drupal/mailsystem": "^4.1", "drupal/masquerade": "^2.0@RC", "drupal/pathauto": "^1.5", - "drupal/permissions_by_term": "^3.1 || ^2.25", + "drupal/permissions_by_term": "^2.25 || ^3.1", "drupal/queue_mail": "^1.4", "drupal/r4032login": "^2.1", "drupal/redirect": "^1.4", @@ -68,6 +56,7 @@ "http-interop/http-factory-guzzle": "^1.0.0", "itk-dev/beskedfordeler-drupal": "^1.0", "itk-dev/serviceplatformen": "^1.5", + "mglaman/composer-drupal-lenient": "^1.0", "os2web/os2web_audit": "^1.0", "os2web/os2web_datalookup": "^2.0", "os2web/os2web_nemlogin": "^1.0", @@ -77,22 +66,58 @@ "symfony/options-resolver": "^5.4 || ^6.0", "webmozart/path-util": "^2.3", "wsdltophp/packagebase": "^5.0", - "zaporylie/composer-drupal-optimizations": "^1.2", - "mglaman/composer-drupal-lenient": "^1.0" + "zaporylie/composer-drupal-optimizations": "^1.2" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", "drupal/coder": "^8.3", + "ergebnis/composer-normalize": "^2.47", "mglaman/phpstan-drupal": "^1.1", "phpstan/extension-installer": "^1.3", "phpstan/phpstan-deprecation-rules": "^1.1", "phpunit/phpunit": "^9.5", "wsdltophp/packagegenerator": "^4.0" }, - "extra" : { + "repositories": { + "drupal": { + "type": "composer", + "url": "https://packages.drupal.org/8" + }, + "assets": { + "type": "composer", + "url": "https://asset-packagist.org" + } + }, + "minimum-stability": "dev", + "prefer-stable": true, + "config": { + "allow-plugins": { + "cweagans/composer-patches": true, + "dealerdirect/phpcodesniffer-composer-installer": true, + "ergebnis/composer-normalize": true, + "mglaman/composer-drupal-lenient": true, + "phpstan/extension-installer": true, + "simplesamlphp/composer-module-installer": true, + "vaimo/composer-patches": true, + "zaporylie/composer-drupal-optimizations": true + }, + "sort-packages": true + }, + "extra": { "composer-exit-on-patch-failure": false, - "enable-patching" : true, + "drupal-lenient": { + "allowed-list": [ + "drupal/coc_forms_auto_export", + "drupal/webform_node_element" + ] + }, + "enable-patching": true, "patches": { + "drupal/coc_forms_auto_export": { + "3240592 - Problem with phpseclib requirement in 2.x (https://www.drupal.org/project/coc_forms_auto_export/issues/3240592)": "https://www.drupal.org/files/issues/2021-10-04/requirement-namespace-3240592-1.patch", + "3286562 - Automated Drupal 10 compatibility fixes": "https://www.drupal.org/files/issues/2022-06-15/coc_forms_auto_export.2.0.x-dev.rector.patch", + "3259009 - PHP Warnings/Notices on Download Page": "https://git.drupalcode.org/project/coc_forms_auto_export/-/merge_requests/1.diff" + }, "drupal/entity_print": { "2733781 - Add Export to Word Support": "https://www.drupal.org/files/issues/2019-11-22/2733781-47.patch" }, @@ -100,58 +125,34 @@ "Unlock possibility of using Entity print module export to Word": "https://www.drupal.org/files/issues/2020-02-29/3096552-6.patch", "Webform computed element post save alter": "https://www.drupal.org/files/issues/2024-06-25/webform_computed_post_save_field_alter.patch", "Add custom hook (hook_webform_post_load_data) for audit logging": "https://gist.githubusercontent.com/cableman/d26898fc8f65ee0a31001bf391583b59/raw/6189dc4c2ceaabb19d25cc4b98b0b3028a6b0e1e/gistfile1.txt" - - }, - "drupal/coc_forms_auto_export": { - "3240592 - Problem with phpseclib requirement in 2.x (https://www.drupal.org/project/coc_forms_auto_export/issues/3240592)": "https://www.drupal.org/files/issues/2021-10-04/requirement-namespace-3240592-1.patch", - "3286562 - Automated Drupal 10 compatibility fixes" : "https://www.drupal.org/files/issues/2022-06-15/coc_forms_auto_export.2.0.x-dev.rector.patch", - "3259009 - PHP Warnings/Notices on Download Page" : "https://git.drupalcode.org/project/coc_forms_auto_export/-/merge_requests/1.diff" - }, - "drupal/webform_node_element": { - "3290637 - Automated Drupal 10 compatibility fixes": "https://www.drupal.org/files/issues/2023-05-12/webform_node_element_d10-3290637-11.patch" }, "drupal/webform_encrypt": { "Ensure data is base64 encoded (https://www.drupal.org/project/webform_encrypt/issues/3399414)": "https://git.drupalcode.org/project/webform_encrypt/-/merge_requests/4.patch", "PHP Warning if unserialize fails (https://www.drupal.org/project/webform_encrypt/issues/3292305)": "https://www.drupal.org/files/issues/2022-06-23/unserialize-php-notice.patch" + }, + "drupal/webform_node_element": { + "3290637 - Automated Drupal 10 compatibility fixes": "https://www.drupal.org/files/issues/2023-05-12/webform_node_element_d10-3290637-11.patch" } - }, - "drupal-lenient": { - "allowed-list": [ - "drupal/coc_forms_auto_export", - "drupal/webform_node_element" - ] } }, "scripts": { - "code-analysis/phpstan": [ - "phpstan analyse" - ], "code-analysis": [ "@code-analysis/phpstan" ], - "coding-standards-check/phpcs": [ - "phpcs --standard=phpcs.xml.dist" + "code-analysis/phpstan": [ + "phpstan analyse" ], - "coding-standards-check": [ - "@coding-standards-check/phpcs" + "coding-standards-apply": [ + "@coding-standards-apply/phpcs" ], "coding-standards-apply/phpcs": [ "phpcbf --standard=phpcs.xml.dist" ], - "coding-standards-apply": [ - "@coding-standards-apply/phpcs" + "coding-standards-check": [ + "@coding-standards-check/phpcs" + ], + "coding-standards-check/phpcs": [ + "phpcs --standard=phpcs.xml.dist" ] - }, - "config": { - "sort-packages": true, - "allow-plugins": { - "cweagans/composer-patches": true, - "dealerdirect/phpcodesniffer-composer-installer": true, - "phpstan/extension-installer": true, - "simplesamlphp/composer-module-installer": true, - "vaimo/composer-patches": true, - "zaporylie/composer-drupal-optimizations": true, - "mglaman/composer-drupal-lenient": true - } } } diff --git a/modules/os2forms_attachment/README.md b/modules/os2forms_attachment/README.md index f732ad2..5b1c750 100644 --- a/modules/os2forms_attachment/README.md +++ b/modules/os2forms_attachment/README.md @@ -1,20 +1,22 @@ # OS2Forms Attachment Drupal module -# Module purpose +## Module purpose The aim of this module is to provide an OS2forms attachment element for adding PDF/HTML attachment. It also supports creation of reusable headers/footers components which are used when rendering the attachments. -# How does it work +## How does it work -To add custom headers/footer ```admin/structure/webform/config/os2forms_attachment_component``` +To add custom headers/footer `admin/structure/webform/config/os2forms_attachment_component` -To specify headers/footers that will override the default ones on a global level (**Third party settings** -> **Entity print** section): ```admin/structure/webform/config``` +To specify headers/footers that will override the default ones on a global level (**Third party settings** -> **Entity +print** section): `admin/structure/webform/config` -To specify headers/footers that will override the default ones on a form level (**Third party settings** -> **Entity print** section): ```/admin/structure/webform/manage/[webform]/settings``` +To specify headers/footers that will override the default ones on a form level (**Third party settings** -> **Entity +print** section): ```/admin/structure/webform/manage/[webform]/settings``` -# Overwriting templates +## Overwriting templates With some setups it might be necessary to overwrite templates in order to access stylesheets or images. diff --git a/modules/os2forms_autocomplete/README.md b/modules/os2forms_autocomplete/README.md index d590238..2294d45 100644 --- a/modules/os2forms_autocomplete/README.md +++ b/modules/os2forms_autocomplete/README.md @@ -1,15 +1,16 @@ # OS2Forms Autocomplete Drupal module -# Module purpose +## Module purpose -The aim of this module is to provide a genetic OS2Forms Autocomplete element which can return options from an external webservice. +The aim of this module is to provide a genetic OS2Forms Autocomplete element which can return options from an external +webservice. -# How does it work +## How does it work Module exposes OS2Forms Autocomplete component that are available in the webform build process. Build page: -``` +```url admin/structure/webform/manage/[webform] ``` diff --git a/modules/os2forms_dawa/README.md b/modules/os2forms_dawa/README.md index 53876ba..ae242ad 100644 --- a/modules/os2forms_dawa/README.md +++ b/modules/os2forms_dawa/README.md @@ -1,10 +1,11 @@ # OS2Forms DAWA Drupal module -# Module purpose +## Module purpose -The aim of this module is to provide integration with Danish Addresses Web API (DAWA https://dawa.aws.dk) and provider address autocomplete fields. +The aim of this module is to provide integration with Danish Addresses Web API (DAWA ) and provider +address autocomplete fields. -# How does it work +## How does it work Module exposes couple of new Autocomplete components that are available in the webform build process. diff --git a/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php b/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php index 920804b..a9acd08 100644 --- a/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php +++ b/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php @@ -21,13 +21,6 @@ */ class DatafordelerDataLookup extends DataLookupBase implements DatafordelerDataLookupInterface, ContainerFactoryPluginInterface { - /** - * The HTTP client to fetch the feed data with. - * - * @var \GuzzleHttp\ClientInterface - */ - protected $httpClient; - /** * {@inheritdoc} */ @@ -35,10 +28,9 @@ public function __construct( array $configuration, $plugin_id, $plugin_definition, - ClientInterface $httpClient, + protected ClientInterface $httpClient, Logger $auditLogger, ) { - $this->httpClient = $httpClient; parent::__construct($configuration, $plugin_id, $plugin_definition, $auditLogger); } diff --git a/modules/os2forms_fasit/README.md b/modules/os2forms_fasit/README.md index 6a697c2..e7faac0 100644 --- a/modules/os2forms_fasit/README.md +++ b/modules/os2forms_fasit/README.md @@ -1,36 +1,32 @@ # OS2Forms Fasit -Adds [Fasit Schultz](https://schultz.dk/loesninger/schultz-fasit/) -handler for archiving purposes. +Adds [Fasit Schultz](https://schultz.dk/loesninger/schultz-fasit/) handler for archiving purposes. For usage in danish, see [BENYTTELSE](docs/BENYTTELSE.md). ## Installation -```sh +```shell drush pm:enable os2forms_fasit ``` ## Settings -Configure Fasit API `base url` and a way of getting -certificate on `/admin/os2forms_fasit/settings`. +Go to `/admin/os2forms_fasit/settings` and configure the module. ### Certificate -The certificate must be in `pem` or `cer` format and -must be whitelisted by Fasit Schultz. -For this the certificate thumbprint, -in lowercase and without colons, is needed. +The certificate must be in `pem` or `cer` format and must be whitelisted by Fasit Schultz. For this the certificate +thumbprint, in lowercase and without colons, is needed. To get the thumbprint in the correct format from the command line run -```sh +```shell openssl x509 -in SOME_CERTIFICATE.pem -noout -fingerprint | cut -d= -f2 | sed 's/://g' | tr '[:upper:]' '[:lower:]' ``` -Example output +Example output: -```sh +```shell 6acb261f393172d87fa3997cec86569759a8528a ``` @@ -42,13 +38,13 @@ called `fasit_queue`. The queue should be processed with `drush`: -```sh +```shell drush advancedqueue:queue:process fasit_queue ``` List the queue (and all other queues) with -```sh +```shell drush advancedqueue:queue:list ``` diff --git a/modules/os2forms_fasit/docs/BENYTTELSE.md b/modules/os2forms_fasit/docs/BENYTTELSE.md index 63cc361..cb8c958 100644 --- a/modules/os2forms_fasit/docs/BENYTTELSE.md +++ b/modules/os2forms_fasit/docs/BENYTTELSE.md @@ -10,7 +10,7 @@ aftale hvilke certifikater der anvendes. Disse certifikater skal være OCES-3, f.eks. FOCES-3, og skal bruges i pem- eller cer-format. Dernæst oplyses det anvendte certifikats thumbprint eller public-key til Fasit, -som derefter aktiverer snitfladen. Se evt. +som derefter aktiverer snitfladen. Se evt. [README#certificate](../README.md#certificate) for hvordan et certifikats thumbprint kan findes gennem kommandolinjen. @@ -22,7 +22,7 @@ Her skal følgende sættes op: * Fasit API base url * Basis url’en til Fasit. Denne specificeres af Fasit. - * Eksempel: https://webservices.fasit.dk/ + * Eksempel: * Fasit API tenant * Fasit tenant. Denne specificeres af Fasit. * Eksempel: aarhus @@ -30,14 +30,14 @@ Her skal følgende sættes op: * Hvilken version af af API’et der skal bruges. Her er mulighederne ’v1’ eller ’v2’. Der bør altid bruges ’v2’. * Eksempel: v2 * Certificate - * Her kan angives detaljer til et azure key vault hvori certifikatet ligges (Azure key vault) eller en sti direkte til certifikatet (Filsystem) + * Her kan angives detaljer til et azure key vault hvori certifikatet ligges (Azure key vault) eller en sti direkte til + certifikatet (Filsystem) * Passphrase * Passphrase til certifikatet, hvis sådan et eksisterer. - Se evt. Fasit Scultz dokumentationen for flere detaljer på opbygningen af endpoint url’er. -Det er desuden muligt at teste om os2forms kan få fat i certifikatet på samme konfigurations-side. +Det er desuden muligt at teste om os2forms kan få fat i certifikatet på samme konfigurations-side. ## Handler diff --git a/modules/os2forms_forloeb/CHANGELOG.md b/modules/os2forms_forloeb/CHANGELOG.md index 3338d10..6d56982 100644 --- a/modules/os2forms_forloeb/CHANGELOG.md +++ b/modules/os2forms_forloeb/CHANGELOG.md @@ -1,4 +1,5 @@ # OS2Forms Forløb Change Log + All notable changes to this project should be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) @@ -17,9 +18,11 @@ before starting to add changes. ## 2.5.2 - 27.03.2023 ### Updated + - Bumped drupal/ultimate_cron version fixing [Deprecated function: Implicit conversion from float-string](https://www.drupal.org/project/ultimate_cron/issues/3256142). ## 2.5.1 - 10.03.2023 + - Added github action for checking changelog changes when creating pull requests - Added os2forms/os2forms dependency - Changed composer patching configuration @@ -30,18 +33,20 @@ before starting to add changes. ## 2.5.0 - 11.10.2022 ### Added + - retry task controller action - Added support for inheriting values without creating a submission ## 2.4.0 ### Added + - Github CI action for checking Drupal Coding standards with PHP Code Sniffer - Fixed coding standards issues - ## Example of change log record -``` + +```markdown ## [x.x.x] Release name ### Added - Description on added functionality. diff --git a/modules/os2forms_forloeb/README.md b/modules/os2forms_forloeb/README.md index 7cf0618..11d1b07 100644 --- a/modules/os2forms_forloeb/README.md +++ b/modules/os2forms_forloeb/README.md @@ -4,11 +4,13 @@ Adds a Maestro workflow engine and advanced workflow functionality to OS2forms. ## Installing OS2forms 2.1 med Forløb -This module requires the codebase from the [OS2forms core project](https://github.com/OS2Forms/os2forms8) installed per the documentation and by selecting the os2forms_forloeb_profile at installation. After succesful installation you should have the OS2forms med Forløb Module available for install via gui. +This module requires the codebase from the [OS2forms core project](https://github.com/OS2Forms/os2forms8) installed per +the documentation and by selecting the os2forms_forloeb_profile at installation. After succesful installation you should +have the OS2forms med Forløb Module available for install via gui. You can also install the module by using Drush: -``` +```shell ./vendor/bin/drush pm:enable os2forms_forloeb ``` @@ -32,20 +34,18 @@ Settings for OS2Forms forløb are defined on `/admin/config/system/os2forms_forl #### Known anonymous roles -In order to make the notifications work, Maestro workflow tasks must be assigned -to a *known anonymous role* and these roles are defined under *Known anonymous -roles*. +In order to make the notifications work, Maestro workflow tasks must be assigned to a *known anonymous role* and these +roles are defined under *Known anonymous roles*. #### Processing -A notification is not sent to a user immediately, but added to a queue which -must be processed asynchronously. Specify the queue handling notification jobs. +A notification is not sent to a user immediately, but added to a queue which must be processed asynchronously. Specify +the queue handling notification jobs. #### Templates Define templates for emails and digital post (PDF). - To reference assets, e.g. stylesheet or images, in your templates, you can use the `base_url` Twig variable to get the base URL: diff --git a/modules/os2forms_nemid/README.md b/modules/os2forms_nemid/README.md index 98ec553..ec7c793 100644 --- a/modules/os2forms_nemid/README.md +++ b/modules/os2forms_nemid/README.md @@ -1,10 +1,10 @@ # OS2Forms Nemid Drupal module -# Module purpose +## Module purpose The aim of this module is to provide custom NemId field and integration with OS2Web Nemlogin module. -# How does it work +## How does it work Module exposes dozen of new NemID components that are available in the webform build process. @@ -17,4 +17,3 @@ Besides this module adds a special settings to the Third Party Webform settings: - Hide form if under address protection Settings: admin/structure/webform/manage/[webform]/settings - diff --git a/modules/os2forms_permissions_by_term/README.md b/modules/os2forms_permissions_by_term/README.md index 2c57293..33ac936 100644 --- a/modules/os2forms_permissions_by_term/README.md +++ b/modules/os2forms_permissions_by_term/README.md @@ -1,10 +1,13 @@ # OS2Forms permission by term module + This module implements permission by term access restrictions on several lists and entity displays related to webform and maestro. ## Setup configuration + Add to your settings.php or local.settings.php -``` + +```php $config['permissions_by_term.settings'] = [ 'permissions_mode' => FALSE, 'require_all_terms_granted' => FALSE, @@ -12,6 +15,7 @@ $config['permissions_by_term.settings'] = [ 'target_bundles' => ['user_affiliation'] ] ``` + Alternative change your site configuration on admin/permissions-by-term/settings to match the above. !note This is the recommended configuration of the permissions_by_term module. Using different values for @@ -19,6 +23,7 @@ Alternative change your site configuration on admin/permissions-by-term/settings be thoroughly tested. ## Usage + - The user affiliation taxonomy is added to webform config form and Maestro workflow forms. - The Permissions by Term module adds a form element to the user form. - When a user visits an entity of the above mentioned this module checks for match between the entity and the users diff --git a/modules/os2forms_sbsys/README.md b/modules/os2forms_sbsys/README.md index b554eeb..8e1129f 100644 --- a/modules/os2forms_sbsys/README.md +++ b/modules/os2forms_sbsys/README.md @@ -1,6 +1,7 @@ # OS2forms SBSYS integration Drupal module ## Module purpose + The aim of this module is to provide integration with SBSYS ESDH provider. ## How does it work diff --git a/modules/os2forms_webform_maps/README.md b/modules/os2forms_webform_maps/README.md index e6d0874..c36b901 100644 --- a/modules/os2forms_webform_maps/README.md +++ b/modules/os2forms_webform_maps/README.md @@ -1,13 +1,16 @@ # OS2Forms Webform Maps module for Drupal 9 ## Module description + Provides integration with Leaflet maps and provides map element for webform. ## How does it work + The module provides a new element type for webform. The element type is called "OS2Forms Kort". The element type is based on the Leaflet library. The element type provides a map with a marker that can be moved around on the map. The element type also provides ways of changing layers on the map. The data can be exported to PDF. ## Installation + The module can be installed using the standard Drupal installation procedure. diff --git a/package.json b/package.json deleted file mode 100644 index 52fcd34..0000000 --- a/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "license": "UNLICENSED", - "private": true, - "devDependencies": { - "markdownlint-cli": "^0.32.2" - }, - "scripts": { - "coding-standards-check/markdownlint": "yarn markdownlint --ignore LICENSE.md --ignore vendor --ignore node_modules '*.md' 'modules/os2forms_digital_post/**/*.md'", - "coding-standards-check": "yarn coding-standards-check/markdownlint", - "coding-standards-apply/markdownlint": "yarn markdownlint --ignore LICENSE.md --ignore vendor --ignore node_modules '*.md' 'modules/os2forms_digital_post/**/*.md' --fix", - "coding-standards-apply": "yarn coding-standards-apply/markdownlint" - } -} From d4abb309dbaa97dc3bb0c84db521065de36bd2c7 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Tue, 29 Apr 2025 14:43:47 +0200 Subject: [PATCH 2/3] Update .github/workflows/pr.yml Co-authored-by: Jeppe Kuhlmann Andersen <78410897+jekuaitk@users.noreply.github.com> --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index fcc49f4..5416efc 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -127,4 +127,4 @@ jobs: - name: Coding standards run: | - docker run --rm --volume $PWD:/md peterdavehello/markdownlint markdownlint '**/*.md' + docker run --rm --volume $PWD:/md itkdev/markdownlint markdownlint '**/*.md' From c5d676308e7c422b92ceb1662acf15069a773cdb Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Wed, 30 Apr 2025 11:53:21 +0200 Subject: [PATCH 3/3] Added docker compose setup --- .github/workflows/pr.yml | 98 ++++++++++------------------------------ README.md | 23 +++++++--- compose.yaml | 17 +++++++ composer.json | 1 + 4 files changed, 59 insertions(+), 80 deletions(-) create mode 100644 compose.yaml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 5416efc..194b59f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -18,102 +18,54 @@ jobs: - name: Check that changelog has been updated. run: git diff --exit-code origin/${{ github.base_ref }} -- CHANGELOG.md && exit 1 || exit 0 - test-composer-files: + validate-composer-files: name: Validate composer runs-on: ubuntu-latest - strategy: - matrix: - php-versions: [ '8.3' ] - dependency-version: [ prefer-lowest, prefer-stable ] steps: - uses: actions/checkout@v4 - - name: Setup PHP, with composer and extensions - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - extensions: json - coverage: none - tools: composer:v2 - # https://github.com/shivammathur/setup-php#cache-composer-dependencies - - name: Get composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Cache dependencies - uses: actions/cache@v4 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- - name: Validate composer files run: | - composer config --no-plugins allow-plugins.mglaman/composer-drupal-lenient true - # The --strict flag on validate has been removed due to the package drupal/config_entity_revisions 2.0.x-dev - # being considered a version cf. https://getcomposer.org/doc/articles/versions.md#branches - composer validate composer.json - # Check that dependencies resolve. - composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction + # Note that we don't use the --strict flag on validate due to the + # package drupal/config_entity_revisions 2.0.x-dev being considered a + # version cf. + # https://getcomposer.org/doc/articles/versions.md#branches + docker compose run --rm php composer validate composer.json - name: Check that composer file is normalized run: | - composer normalize --dry-run + docker compose run --rm php composer install + docker compose run --rm php composer normalize --dry-run - php-coding-standards: - name: PHP coding standards + test-composer-files: + name: Test composer files runs-on: ubuntu-latest strategy: matrix: - php-versions: [ '8.3' ] + dependency-version: [ prefer-lowest, prefer-stable ] + steps: + - uses: actions/checkout@v4 + - name: Check that dependencies resolve. + run: | + # Clean up before update (cf. https://www.drupal.org/project/simplesamlphp_auth/issues/3350773) + rm -fr vendor/ + docker compose run --rm php composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction + + php-coding-standards: + name: PHP coding standards + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Setup PHP, with composer and extensions - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - extensions: json - coverage: none - tools: composer:v2 - # https://github.com/shivammathur/setup-php#cache-composer-dependencies - - name: Get composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Cache dependencies - uses: actions/cache@v4 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- - name: Install Dependencies run: | - composer config --no-plugins allow-plugins.mglaman/composer-drupal-lenient true - composer install --no-interaction --no-progress + docker compose run --rm php composer install - name: PHPCS run: | - composer coding-standards-check/phpcs + docker compose run --rm php composer coding-standards-check/phpcs php-code-analysis: name: PHP code analysis runs-on: ubuntu-latest - strategy: - matrix: - php-versions: [ '8.3' ] steps: - uses: actions/checkout@v4 - - name: Setup PHP, with composer and extensions - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - extensions: json - coverage: none - tools: composer:v2 - # https://github.com/shivammathur/setup-php#cache-composer-dependencies - - name: Get composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Cache dependencies - uses: actions/cache@v4 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- - name: Code analysis run: | ./scripts/code-analysis @@ -127,4 +79,4 @@ jobs: - name: Coding standards run: | - docker run --rm --volume $PWD:/md itkdev/markdownlint markdownlint '**/*.md' + docker compose run --rm markdownlint markdownlint '**/*.md' diff --git a/README.md b/README.md index fb6ed42..f4a52e2 100644 --- a/README.md +++ b/README.md @@ -121,18 +121,27 @@ run the checks locally. ### PHP ```sh -docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.3-fpm composer install +docker compose pull +docker compose run --rm php composer install # Fix (some) coding standards issues. -docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.3-fpm composer coding-standards-apply -docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.3-fpm composer coding-standards-check +docker compose run --rm php composer coding-standards-apply +docker compose run --rm php composer coding-standards-check ``` +> [!TIP] +> If the `composer install` commands fails with +> +> > Unable to install module simplesamlphp/simplesamlphp-assets-base, package name must be on the form "VENDOR/simplesamlphp-module-MODULENAME". +> +> you can remove the `vendor` folder and rerun the `composer install` command (cf. +> ). + ### Markdown ```sh -docker pull peterdavehello/markdownlint -docker run --rm --volume $PWD:/md peterdavehello/markdownlint markdownlint '**/*.md' --fix -docker run --rm --volume $PWD:/md peterdavehello/markdownlint markdownlint '**/*.md' +docker compose pull +docker compose run --rm markdownlint markdownlint '**/*.md' --fix +docker compose run --rm markdownlint markdownlint '**/*.md' ``` ## Code analysis @@ -143,7 +152,7 @@ Running statis code analysis on a standalone Drupal module is a bit tricky, so w analysis: ```shell -docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.3-fpm ./scripts/code-analysis +docker compose run --rm php ./scripts/code-analysis ``` **Note**: Currently the code analysis is only run on the `os2forms_digital_post` sub-module (cf. [`phpstan.neon`](./phpstan.neon)). diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..d606c09 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,17 @@ +# https://hub.docker.com/r/ddev/ddev-php-base + +services: + php: + image: ddev/ddev-php-base + profiles: + - dev + working_dir: /app + volumes: + - ./:/app + + markdownlint: + image: itkdev/markdownlint + # The default working dir is `/md` + working_dir: /app + volumes: + - ./:/app diff --git a/composer.json b/composer.json index ae72ae5..d553917 100644 --- a/composer.json +++ b/composer.json @@ -98,6 +98,7 @@ "mglaman/composer-drupal-lenient": true, "phpstan/extension-installer": true, "simplesamlphp/composer-module-installer": true, + "simplesamlphp/composer-xmlprovider-installer": true, "vaimo/composer-patches": true, "zaporylie/composer-drupal-optimizations": true },