From add460edb1e11c33ce63c416f909d0890ec51ce9 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Thu, 9 Jan 2025 10:16:05 +0100 Subject: [PATCH 1/5] 3534: Fixed function signature --- .../custom/hoeringsportal_data/src/Helper/GeoJsonHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/modules/custom/hoeringsportal_data/src/Helper/GeoJsonHelper.php b/web/modules/custom/hoeringsportal_data/src/Helper/GeoJsonHelper.php index 3d2b4fb8..88966cd5 100644 --- a/web/modules/custom/hoeringsportal_data/src/Helper/GeoJsonHelper.php +++ b/web/modules/custom/hoeringsportal_data/src/Helper/GeoJsonHelper.php @@ -488,7 +488,7 @@ private function getReference($entity, $field_name) { /** * Get term name. */ - private function getTermName(Term $term = NULL) { + private function getTermName(Term|bool|null $term = NULL) { return $term ? $term->get('name')->value : NULL; } From faf0c8d0b39c1cc80a2c5cd321aa375024227f1b Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Thu, 9 Jan 2025 10:22:21 +0100 Subject: [PATCH 2/5] 3534: Removed outdated projects API endpoint --- .../hoeringsportal_data.routing.yml | 8 --- .../src/Controller/Api/DefaultController.php | 1 - .../Api/GeoJSON/ProjectController.php | 39 -------------- .../src/Helper/GeoJsonHelper.php | 53 +------------------ 4 files changed, 1 insertion(+), 100 deletions(-) delete mode 100644 web/modules/custom/hoeringsportal_data/src/Controller/Api/GeoJSON/ProjectController.php diff --git a/web/modules/custom/hoeringsportal_data/hoeringsportal_data.routing.yml b/web/modules/custom/hoeringsportal_data/hoeringsportal_data.routing.yml index a80a609c..2988b902 100644 --- a/web/modules/custom/hoeringsportal_data/hoeringsportal_data.routing.yml +++ b/web/modules/custom/hoeringsportal_data/hoeringsportal_data.routing.yml @@ -30,14 +30,6 @@ hoeringsportal_data.api_controller_hearings_tickets: requirements: _permission: 'access content' -hoeringsportal_data.api_controller_geojson_projects: - path: '/api/geojson/projects' - defaults: - _controller: '\Drupal\hoeringsportal_data\Controller\Api\GeoJSON\ProjectController::index' - _title: 'Projects' - requirements: - _permission: 'access content' - hoeringsportal_data.api_controller_geojson_hearings: path: '/api/geojson/hearings' defaults: diff --git a/web/modules/custom/hoeringsportal_data/src/Controller/Api/DefaultController.php b/web/modules/custom/hoeringsportal_data/src/Controller/Api/DefaultController.php index 1476ed8b..9c47bf9b 100644 --- a/web/modules/custom/hoeringsportal_data/src/Controller/Api/DefaultController.php +++ b/web/modules/custom/hoeringsportal_data/src/Controller/Api/DefaultController.php @@ -16,7 +16,6 @@ public function index() { return new JsonResponse([ 'resources' => [ 'geojson' => [ - 'projects' => $this->generateUrl('hoeringsportal_data.api_controller_geojson_projects'), 'hearings' => $this->generateUrl('hoeringsportal_data.api_controller_geojson_hearings'), 'public_meeting_dates' => $this->generateUrl('hoeringsportal_data.api_controller_geojson_public_meeting_dates'), 'tickets' => $this->generateUrl('hoeringsportal_data.api_controller_geojson_tickets'), diff --git a/web/modules/custom/hoeringsportal_data/src/Controller/Api/GeoJSON/ProjectController.php b/web/modules/custom/hoeringsportal_data/src/Controller/Api/GeoJSON/ProjectController.php deleted file mode 100644 index d49c99c1..00000000 --- a/web/modules/custom/hoeringsportal_data/src/Controller/Api/GeoJSON/ProjectController.php +++ /dev/null @@ -1,39 +0,0 @@ -getParameter('geometry'); - - $conditions = []; - switch ($geometry) { - case GeoJsonHelper::GEOMETRY_POINT: - $conditions['field_map.type'] = [MapItem::TYPE_POINT]; - break; - - case GeoJsonHelper::GEOMETRY_LOCAL_PLAN: - $conditions['field_map.type'] = [MapItem::TYPE_LOCALPLANIDS_NODE, MapItem::TYPE_LOCALPLANIDS]; - break; - } - - $entities = $this->helper()->getProjects($conditions); - - $features = array_values(array_map([$this->helper(), 'serializeGeoJsonProject'], $entities)); - $response = $this->createGeoJsonResponse($features, 'FeatureCollection'); - - return $response; - } - -} diff --git a/web/modules/custom/hoeringsportal_data/src/Helper/GeoJsonHelper.php b/web/modules/custom/hoeringsportal_data/src/Helper/GeoJsonHelper.php index 88966cd5..6027d5e7 100644 --- a/web/modules/custom/hoeringsportal_data/src/Helper/GeoJsonHelper.php +++ b/web/modules/custom/hoeringsportal_data/src/Helper/GeoJsonHelper.php @@ -92,7 +92,7 @@ public function getPublicMeetings(array $properties = []) { public function getProjects(array $properties = []) { $properties += [ 'status' => NodeInterface::PUBLISHED, - 'type' => 'project', + 'type' => 'project_main_page', ]; $entities = $this->entityTypeManager ->getStorage('node') @@ -140,57 +140,6 @@ public function serializeHearing(Node $entity) { ]; } - /** - * Serialize Project as GeoJSON. - */ - public function serializeGeoJsonProject(NodeInterface $project) { - $areas = $project->get('field_area')->referencedEntities(); - $tags = $project->get('field_tags')->referencedEntities(); - - $lokalplaner = []; - foreach ($project->get('field_lokalplaner') as $lokalplan) { - $lokalplaner[] = $lokalplan; - } - - $geometryType = $this->getGeometryType($project); - - $data = [ - 'properties' => [ - 'project_id' => (int) $project->id(), - 'project_title' => $project->getTitle(), - 'project_teaser' => $project->get('field_teaser')->value, - 'project_description' => $project->get('field_description')->value, - 'project_start' => $this->getDateTime($project->get('field_project_start')->value), - 'project_finish' => $this->getDateTime($project->get('field_project_finish')->value), - 'project_tags' => array_map([$this, 'getTermName'], $tags), - 'project_contact' => $project->get('field_contact')->value, - 'project_phone' => $project->get('field_phone')->value, - 'project_geometry_type' => $geometryType, - 'project_url' => $this->generateUrl('entity.node.canonical', ['node' => $project->id()]), - 'project_area_list' => $this->listify(array_map(function (Term $term) { - return $term->get('field_area_id')->value; - }, $areas)), - 'project_area_ids' => array_map(function (Term $term) { - return (int) $term->get('field_area_id')->value; - }, $areas), - 'project_local_plan_list' => $this->listify(array_map(function ($lokalplan) { - return $lokalplan->id; - }, $lokalplaner)), - 'project_local_plan_ids' => array_map(function ($lokalplan) { - return (int) $lokalplan->id; - }, $lokalplaner), - ], - ]; - - $geometry = $this->getGeometry($project); - if (NULL !== $geometry) { - $data['geometry'] = $geometry['geometry']; - $data['type'] = 'Feature'; - } - - return $data; - } - /** * Serialize Hearing as GeoJSON. */ From 7ee6a64b430036eaf4ef8583bd4a9c978b7f639a Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Thu, 9 Jan 2025 11:19:15 +0100 Subject: [PATCH 3/5] 3534: Removed outdated tickets API endpoint --- .../hoeringsportal_data.routing.yml | 8 ---- .../src/Controller/Api/DefaultController.php | 1 - .../Api/GeoJSON/TicketController.php | 42 ------------------- .../src/Helper/GeoJsonHelper.php | 26 ------------ 4 files changed, 77 deletions(-) delete mode 100644 web/modules/custom/hoeringsportal_data/src/Controller/Api/GeoJSON/TicketController.php diff --git a/web/modules/custom/hoeringsportal_data/hoeringsportal_data.routing.yml b/web/modules/custom/hoeringsportal_data/hoeringsportal_data.routing.yml index 2988b902..17e97a64 100644 --- a/web/modules/custom/hoeringsportal_data/hoeringsportal_data.routing.yml +++ b/web/modules/custom/hoeringsportal_data/hoeringsportal_data.routing.yml @@ -38,14 +38,6 @@ hoeringsportal_data.api_controller_geojson_hearings: requirements: _permission: 'access content' -hoeringsportal_data.api_controller_geojson_tickets: - path: '/api/geojson/tickets' - defaults: - _controller: '\Drupal\hoeringsportal_data\Controller\Api\GeoJSON\TicketController::index' - _title: 'Tickets' - requirements: - _permission: 'access content' - hoeringsportal_data.api_controller_geojson_public_meeting_dates: path: '/api/geojson/public_meetings/dates' defaults: diff --git a/web/modules/custom/hoeringsportal_data/src/Controller/Api/DefaultController.php b/web/modules/custom/hoeringsportal_data/src/Controller/Api/DefaultController.php index 9c47bf9b..b82dd2cd 100644 --- a/web/modules/custom/hoeringsportal_data/src/Controller/Api/DefaultController.php +++ b/web/modules/custom/hoeringsportal_data/src/Controller/Api/DefaultController.php @@ -18,7 +18,6 @@ public function index() { 'geojson' => [ 'hearings' => $this->generateUrl('hoeringsportal_data.api_controller_geojson_hearings'), 'public_meeting_dates' => $this->generateUrl('hoeringsportal_data.api_controller_geojson_public_meeting_dates'), - 'tickets' => $this->generateUrl('hoeringsportal_data.api_controller_geojson_tickets'), 'v2' => [ 'hearings' => $this->generateUrl('hoeringsportal_data.api_geojson_v2_hearings'), ], diff --git a/web/modules/custom/hoeringsportal_data/src/Controller/Api/GeoJSON/TicketController.php b/web/modules/custom/hoeringsportal_data/src/Controller/Api/GeoJSON/TicketController.php deleted file mode 100644 index 0de75cfe..00000000 --- a/web/modules/custom/hoeringsportal_data/src/Controller/Api/GeoJSON/TicketController.php +++ /dev/null @@ -1,42 +0,0 @@ -getTickets(); - $features = array_values(array_map([$this->helper(), 'serializeGeoJsonTicket'], $entities)); - $response = $this->createGeoJsonResponse($features); - - return $response; - } - - /** - * Get tickets. - */ - private function getTickets() { - $hearings = $this->helper()->getHearings(); - - $tickets = []; - foreach ($hearings as $hearing) { - foreach ($this->helper()->getHearingTickets($hearing) as $ticket) { - $tickets[] = (object) [ - 'data' => $ticket, - 'hearing' => $hearing, - ]; - } - } - - return $tickets; - } - -} diff --git a/web/modules/custom/hoeringsportal_data/src/Helper/GeoJsonHelper.php b/web/modules/custom/hoeringsportal_data/src/Helper/GeoJsonHelper.php index 6027d5e7..7ff301cf 100644 --- a/web/modules/custom/hoeringsportal_data/src/Helper/GeoJsonHelper.php +++ b/web/modules/custom/hoeringsportal_data/src/Helper/GeoJsonHelper.php @@ -255,32 +255,6 @@ public function serializeGeoJsonPublicMeetingDate(object $date) { return $serialized; } - /** - * Serialize Ticket as GeoJSON. - */ - public function serializeGeoJsonTicket(object $ticket) { - $serialized = $this->serializeGeoJsonHearing($ticket->hearing); - - $properties = &$serialized['properties']; - - $data = $ticket->data; - $fields = $data->fields; - $properties = [ - 'ticket_id' => $data->id, - 'ticket_hearing_id' => (int) $ticket->hearing->id(), - 'ticket_message' => $fields->message ?? NULL, - 'ticket_person_name' => $data->person->name ?? NULL, - 'ticket_organization' => $fields->organization ?? NULL, - 'ticket_pdf_download_url' => $fields->pdf_download_url ?? NULL, - 'ticket_url' => $this->generateUrl('hoeringsportal_deskpro.hearing.ticket_view', [ - 'node' => $ticket->hearing->id(), - 'ticket' => $data->id, - ]), - ]; - - return $serialized; - } - /** * Get hearing tickets count. * From eaef2e92fcfe4f4a465cbb16957984ab53acc0c1 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Thu, 9 Jan 2025 11:39:46 +0100 Subject: [PATCH 4/5] 3534: Cleaned up and applied coding standards --- .markdownlint.jsonc | 13 ++ .markdownlintrc | 12 - CHANGELOG.md | 4 + Taskfile.yml | 67 ++++++ composer.json | 4 +- documentation/localDevelopment.md | 22 +- package.json | 18 -- playwright/citizen-proposal-support.spec.js | 6 +- playwright/citizen-proposal.spec.js | 12 +- scripts/phpcbf | 19 -- web/themes/custom/hoeringsportal/README.md | 5 +- yarn.lock | 240 -------------------- 12 files changed, 101 insertions(+), 321 deletions(-) create mode 100644 .markdownlint.jsonc delete mode 100644 .markdownlintrc delete mode 100644 package.json delete mode 100755 scripts/phpcbf delete mode 100644 yarn.lock diff --git a/.markdownlint.jsonc b/.markdownlint.jsonc new file mode 100644 index 00000000..370fd7b3 --- /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": 80, + "code_blocks": false, + "tables": false + }, + // https://github.com/DavidAnson/markdownlint/blob/main/doc/md024.md + "no-duplicate-heading": { + "siblings_only": true + } +} diff --git a/.markdownlintrc b/.markdownlintrc deleted file mode 100644 index 490ee636..00000000 --- a/.markdownlintrc +++ /dev/null @@ -1,12 +0,0 @@ -{ - // @see https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.jsonc - // MD013/line-length - Line length - "MD013": { - // Exclude code blocks - "code_blocks": false - } -} - -// Local Variables: -// mode: json -// End: \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b55fd0f1..09fcea64 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +* [PR-429](https://github.com/itk-dev/hoeringsportal/pull/429) + Removed outdated (and unused) API endpoints. Cleaned up. * [PR-427](https://github.com/itk-dev/hoeringsportal/pull/427) Updated docker compose setup. Updated composer packages. * [PR-425](https://github.com/itk-dev/hoeringsportal/pull/425) @@ -162,6 +164,8 @@ Versioning](https://semver.org/spec/v2.0.0.html). * [PR-371](https://github.com/itk-dev/hoeringsportal/pull/371) Cleaned up archiving of citizen proposals +## [3.5.1] - 2023-09-01 + ## [3.5.0] - 2023-08-30 * [PR-363](https://github.com/itk-dev/hoeringsportal/pull/363) diff --git a/Taskfile.yml b/Taskfile.yml index 33470ba3..bf7f775e 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -68,6 +68,7 @@ tasks: composer: cmds: - task compose -- exec phpfpm composer {{.CLI_ARGS}} + silent: true composer-install: cmds: @@ -129,3 +130,69 @@ tasks: sh: task compose -- exec --no-TTY --env PGPASSWORD=pretix pretix_database psql --user=pretix pretix --tuples-only --csv <<< "SELECT token FROM pretixbase_teamapitoken WHERE name = 'hoeringsportal'" cmds: - "task compose -- exec phpfpm curl --header 'Authorization: Token {{.API_TOKEN}}' {{.PRETIX_URL}}/api/v1/organizers/" + + coding-standards:apply: + desc: "Apply coding standards" + cmds: + - task: coding-standards:markdown:apply + - task: coding-standards:assets:apply + - task: coding-standards:php:apply + - task: coding-standards:twig:apply + silent: true + + coding-standards:check: + desc: "Apply coding standards" + cmds: + - task: coding-standards:markdown:check + - task: coding-standards:assets:check + - task: coding-standards:php:check + - task: coding-standards:twig:check + silent: true + + coding-standards:assets:apply: + desc: "Apply coding standards for assets" + cmds: + # Prettier does not (yet, fcf. + # https://github.com/prettier/prettier/issues/15206) have an official + # docker image. + # https://hub.docker.com/r/jauderho/prettier is good candidate (cf. https://hub.docker.com/search?q=prettier&sort=updated_at&order=desc) + - docker pull jauderho/prettier + - docker run --rm --volume "$PWD:/work" jauderho/prettier --write playwright + + coding-standards:assets:check: + desc: "Apply and check coding standards for assets" + cmds: + - task: coding-standards:assets:apply + - docker pull jauderho/prettier + - docker run --rm --volume "$PWD:/work" jauderho/prettier --check playwright + + coding-standards:markdown:apply: + desc: "Apply coding standards for Markdown" + cmds: + - docker pull peterdavehello/markdownlint + - docker run --rm --volume "$PWD:/md" peterdavehello/markdownlint markdownlint --ignore '**/node_modules/**' --ignore '**/vendor/**' '*.md' 'web/*/custom/**/*.md' 'documentation/*.md' --fix + silent: true + + coding-standards:markdown:check: + desc: "Apply and check coding standards for Markdown" + cmds: + - task: coding-standards:markdown:apply + - docker run --rm --volume "$PWD:/md" peterdavehello/markdownlint markdownlint --ignore '**/node_modules/**' --ignore '**/vendor/**' '*.md' 'web/*/custom/**/*.md' 'documentation/*.md' + silent: true + + coding-standards:php:apply: + desc: "Apply coding standards for PHP" + cmds: + - task composer -- coding-standards-apply + silent: true + + coding-standards:php:check: + desc: "Apply and check coding standards for PHP" + cmds: + - task: coding-standards:php:apply + - task composer -- coding-standards-check + silent: true + + code-analysis: + cmds: + - task composer -- code-analysis diff --git a/composer.json b/composer.json index 8826a7f5..b55731d3 100755 --- a/composer.json +++ b/composer.json @@ -269,7 +269,7 @@ "@coding-standards-apply/twig-cs-fixer" ], "coding-standards-apply/phpcs": [ - "scripts/phpcbf --standard=phpcs.xml.dist" + "phpcbf --standard=phpcs.xml.dist" ], "coding-standards-apply/twig-cs-fixer": [ "twig-cs-fixer lint web/themes/custom/hoeringsportal/templates --fix" @@ -279,7 +279,7 @@ "@coding-standards-check/twig-cs-fixer" ], "coding-standards-check/phpcs": [ - "vendor/bin/phpcs --standard=phpcs.xml.dist" + "phpcs --standard=phpcs.xml.dist" ], "coding-standards-check/twig-cs-fixer": [ "twig-cs-fixer lint web/themes/custom/hoeringsportal/templates" diff --git a/documentation/localDevelopment.md b/documentation/localDevelopment.md index d6cd8d64..68fcbd44 100644 --- a/documentation/localDevelopment.md +++ b/documentation/localDevelopment.md @@ -90,36 +90,24 @@ All code must follow the [Drupal coding standards](https://www.drupal.org/docs/d #### Coding standards -```sh -docker compose exec phpfpm composer coding-standards-check -``` - -Apply automatic coding standard fixes by running +Apply and check coding standard by running ```sh -docker compose exec phpfpm composer coding-standards-apply +task coding-standards:check ``` #### Code analysis ```sh -docker compose exec phpfpm composer code-analysis +task code-analysis ``` #### Markdown -```sh -docker compose run --rm node yarn install -``` - -```sh -docker compose run --rm node yarn coding-standards-check -``` - -Apply automatic coding standard fixes by running +Apply and check Markdown coding standards: ```sh -docker compose run --rm node yarn coding-standards-apply +task coding-standards:markdown:check ``` ## About translations diff --git a/package.json b/package.json deleted file mode 100644 index 3c858c46..00000000 --- a/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "license": "UNLICENSED", - "private": true, - "devDependencies": { - "@playwright/test": "^1.35.0", - "markdownlint-cli": "^0.31.1", - "playwright-mailhog": "^1.1.0", - "prettier": "2.8.8" - }, - "scripts": { - "coding-standards-check/markdownlint": "markdownlint --ignore '**/node_modules/**' --ignore '**/vendor/**' '*.md' 'web/modules/custom/**/*.md' 'documentation/*.md'", - "coding-standards-check/prettier": "prettier --check playwright", - "coding-standards-check": "yarn coding-standards-check/markdownlint && yarn coding-standards-check/prettier", - "coding-standards-apply/markdownlint": "markdownlint --fix '*.md' 'web/modules/custom/**/*.md' 'documentation/*.md'", - "coding-standards-apply/prettier": "prettier --write playwright", - "coding-standards-apply": "yarn coding-standards-apply/markdownlint && yarn coding-standards-apply/prettier" - } -} diff --git a/playwright/citizen-proposal-support.spec.js b/playwright/citizen-proposal-support.spec.js index 50457178..9e4a36b2 100644 --- a/playwright/citizen-proposal-support.spec.js +++ b/playwright/citizen-proposal-support.spec.js @@ -20,13 +20,13 @@ test("Support proposal", async ({ page }) => { await page.getByRole("button", { name: "Login" }).click(); await expect( - page.getByText("You're currently authenticated as Anders And") + page.getByText("You're currently authenticated as Anders And"), ).toBeVisible(); await expect(page.getByRole("link", { name: "Sign out" })).toBeVisible(); await expect(page.getByLabel("Name", { exact: true })).toHaveValue( - "Anders And" + "Anders And", ); await page.getByRole("button", { name: "Support proposal" }).click(); @@ -48,7 +48,7 @@ test("Support proposal", async ({ page }) => { // Test that citizen cannot support proposal more than once await expect( - page.getByText("You already supported this proposal") + page.getByText("You already supported this proposal"), ).toBeVisible(); // Test that citizen must re-authenticate to support another proposal diff --git a/playwright/citizen-proposal.spec.js b/playwright/citizen-proposal.spec.js index 7f06fbdc..a51f6649 100644 --- a/playwright/citizen-proposal.spec.js +++ b/playwright/citizen-proposal.spec.js @@ -15,7 +15,7 @@ test("Can authenticate", async ({ page }) => { await page.getByRole("link", { name: "Sign out" }).click(); await expect( - page.getByRole("link", { name: "Authenticate with MitID" }) + page.getByRole("link", { name: "Authenticate with MitID" }), ).toBeVisible(); }); @@ -31,7 +31,7 @@ test("Create proposal", async ({ page }) => { await page.getByRole("button", { name: "Login" }).click(); await expect( - page.getByText("You're currently authenticated as Anders And") + page.getByText("You're currently authenticated as Anders And"), ).toBeVisible(); await expect(page.getByRole("link", { name: "Sign out" })).toBeVisible(); @@ -61,13 +61,13 @@ test("Create proposal", async ({ page }) => { expect(page).toHaveURL("/citizen_proposal/approve"); await expect( - page.getByRole("button", { name: "Approve proposal" }) + page.getByRole("button", { name: "Approve proposal" }), ).toBeVisible(); await expect(page.getByRole("link", { name: "Edit proposal" })).toBeVisible(); await expect( - page.getByRole("button", { name: "Cancel proposal" }) + page.getByRole("button", { name: "Cancel proposal" }), ).toBeVisible(); await expect(page.getByText("borger87@eksemple.dk")).toBeVisible(); @@ -75,7 +75,7 @@ test("Create proposal", async ({ page }) => { await page.getByRole("link", { name: "Edit proposal" }).click(); await expect(page.getByLabel("Email", { exact: true })).toHaveValue( - "borger87@eksemple.dk" + "borger87@eksemple.dk", ); await page.getByLabel("Email", { exact: true }).fill("borger87@eksempel.dk"); @@ -128,6 +128,6 @@ test("Cancel proposal", async ({ page }) => { await page.getByRole("button", { name: "Cancel proposal" }).click(); await expect( - page.getByText("Your submission has been cancelled.") + page.getByText("Your submission has been cancelled."), ).toBeVisible(); }); diff --git a/scripts/phpcbf b/scripts/phpcbf deleted file mode 100755 index ae923ebe..00000000 --- a/scripts/phpcbf +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -set -o errtrace -o noclobber -o nounset -o pipefail -IFS=$'\n\t' - -dir=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) -bold=$(tput bold) -normal=$(tput sgr0) - -# Wrapper around phpcbf to make exit codes wotk as expected -# (cf. https://github.com/squizlabs/PHP_CodeSniffer/issues/1359) - -$dir/../vendor/bin/phpcbf "$@" -exit_code=$? - -if [ $exit_code -eq 1 ]; then - exit 0 -fi - -exit 1 diff --git a/web/themes/custom/hoeringsportal/README.md b/web/themes/custom/hoeringsportal/README.md index 396240b4..98063417 100755 --- a/web/themes/custom/hoeringsportal/README.md +++ b/web/themes/custom/hoeringsportal/README.md @@ -3,14 +3,12 @@ We use [Webpack Encore](http://symfony.com/doc/current/frontend.html#webpack-encore) to handle frontend assets, see -http://symfony.com/doc/current/frontend.html#webpack-encore for + for details. - JavaScript and CSS (actually SCSS) assets are put in `assets/js/` and `assets/css/`, respectively, and built assets are put in `build/`. - ## Building assets First, install tools and requirements: @@ -79,7 +77,6 @@ yarn run apply-coding-standards-js to apply any possible automatic fixes. - ### Twig Check twig standards diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index 8c783e93..00000000 --- a/yarn.lock +++ /dev/null @@ -1,240 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@playwright/test@^1.35.0": - version "1.35.1" - resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.35.1.tgz#a596b61e15b980716696f149cc7a2002f003580c" - integrity sha512-b5YoFe6J9exsMYg0pQAobNDR85T1nLumUYgUTtKm4d21iX2L7WqKq9dW8NGJ+2vX0etZd+Y7UeuqsxDXm9+5ZA== - dependencies: - "@types/node" "*" - playwright-core "1.35.1" - optionalDependencies: - fsevents "2.3.2" - -"@types/node@*": - version "20.2.5" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.2.5.tgz#26d295f3570323b2837d322180dfbf1ba156fefb" - integrity sha512-JJulVEQXmiY9Px5axXHeYGLSjhkZEnD+MDPDGbCbIAbMslkKwmygtZFy1X6s/075Yo94sf8GuSlFfPzysQrWZQ== - -argparse@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" - integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== - -balanced-match@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" - integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== - -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -commander@~9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-9.0.0.tgz#86d58f24ee98126568936bd1d3574e0308a99a40" - integrity sha512-JJfP2saEKbQqvW+FI93OYUB4ByV5cizMpFMiiJI8xDbBvQvSkIk0VvQdn1CZ8mqAO8Loq2h0gYTYtDFUZUeERw== - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= - -deep-extend@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" - integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== - -entities@~2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/entities/-/entities-2.1.0.tgz#992d3129cf7df6870b96c57858c249a120f8b8b5" - integrity sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w== - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= - -fsevents@2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== - -get-stdin@~9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-9.0.0.tgz#3983ff82e03d56f1b2ea0d3e60325f39d703a575" - integrity sha512-dVKBjfWisLAicarI2Sf+JuBE/DghV4UzNAVe9yhEJuzeREd3JhOTE9cUaJTeSa77fsbQUK3pcOpJfM59+VKZaA== - -glob@~7.2.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" - integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -ignore@~5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" - integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -ini@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ini/-/ini-2.0.0.tgz#e5fd556ecdd5726be978fa1001862eacb0a94bc5" - integrity sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA== - -js-yaml@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" - integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== - dependencies: - argparse "^2.0.1" - -jsonc-parser@~3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.0.0.tgz#abdd785701c7e7eaca8a9ec8cf070ca51a745a22" - integrity sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA== - -linkify-it@^3.0.1: - version "3.0.3" - resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-3.0.3.tgz#a98baf44ce45a550efb4d49c769d07524cc2fa2e" - integrity sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ== - dependencies: - uc.micro "^1.0.1" - -markdown-it@12.3.2: - version "12.3.2" - resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-12.3.2.tgz#bf92ac92283fe983fe4de8ff8abfb5ad72cd0c90" - integrity sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg== - dependencies: - argparse "^2.0.1" - entities "~2.1.0" - linkify-it "^3.0.1" - mdurl "^1.0.1" - uc.micro "^1.0.5" - -markdownlint-cli@^0.31.1: - version "0.31.1" - resolved "https://registry.yarnpkg.com/markdownlint-cli/-/markdownlint-cli-0.31.1.tgz#8db34eec453e84bed06a954c8a289333f7c2c1c7" - integrity sha512-keIOMwQn+Ch7MoBwA+TdkyVMuxAeZFEGmIIlvwgV0Z1TGS5MxPnRr29XCLhkNzCHU+uNKGjU+VEjLX+Z9kli6g== - dependencies: - commander "~9.0.0" - get-stdin "~9.0.0" - glob "~7.2.0" - ignore "~5.2.0" - js-yaml "^4.1.0" - jsonc-parser "~3.0.0" - markdownlint "~0.25.1" - markdownlint-rule-helpers "~0.16.0" - minimatch "~3.0.5" - run-con "~1.2.10" - -markdownlint-rule-helpers@~0.16.0: - version "0.16.0" - resolved "https://registry.yarnpkg.com/markdownlint-rule-helpers/-/markdownlint-rule-helpers-0.16.0.tgz#c327f72782bd2b9475127a240508231f0413a25e" - integrity sha512-oEacRUVeTJ5D5hW1UYd2qExYI0oELdYK72k1TKGvIeYJIbqQWAz476NAc7LNixSySUhcNl++d02DvX0ccDk9/w== - -markdownlint@~0.25.1: - version "0.25.1" - resolved "https://registry.yarnpkg.com/markdownlint/-/markdownlint-0.25.1.tgz#df04536607ebeeda5ccd5e4f38138823ed623788" - integrity sha512-AG7UkLzNa1fxiOv5B+owPsPhtM4D6DoODhsJgiaNg1xowXovrYgOnLqAgOOFQpWOlHFVQUzjMY5ypNNTeov92g== - dependencies: - markdown-it "12.3.2" - -mdurl@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" - integrity sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4= - -minimatch@^3.0.4: - version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== - dependencies: - brace-expansion "^1.1.7" - -minimatch@~3.0.5: - version "3.0.8" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.8.tgz#5e6a59bd11e2ab0de1cfb843eb2d82e546c321c1" - integrity sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q== - dependencies: - brace-expansion "^1.1.7" - -minimist@^1.2.5: - version "1.2.6" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" - integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= - dependencies: - wrappy "1" - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= - -playwright-core@1.35.1: - version "1.35.1" - resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.35.1.tgz#52c1e6ffaa6a8c29de1a5bdf8cce0ce290ffb81d" - integrity sha512-pNXb6CQ7OqmGDRspEjlxE49w+4YtR6a3X6mT1hZXeJHWmsEz7SunmvZeiG/+y1yyMZdHnnn73WKYdtV1er0Xyg== - -playwright-mailhog@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/playwright-mailhog/-/playwright-mailhog-1.1.0.tgz#655564052ce5732f621a5de152a8abf11b1521e9" - integrity sha512-tOpuO0C7ya2+BrrojP5j4DMgl1AjBQ7ioyVOXhXgjaDmZJUonBy5RceOTJ5DiPJEaFc94OmNHMmlo7C7MsPEZg== - -prettier@2.8.8: - version "2.8.8" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" - integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== - -run-con@~1.2.10: - version "1.2.10" - resolved "https://registry.yarnpkg.com/run-con/-/run-con-1.2.10.tgz#90de9d43d20274d00478f4c000495bd72f417d22" - integrity sha512-n7PZpYmMM26ZO21dd8y3Yw1TRtGABjRtgPSgFS/nhzfvbJMXFtJhJVyEgayMiP+w/23craJjsnfDvx4W4ue/HQ== - dependencies: - deep-extend "^0.6.0" - ini "~2.0.0" - minimist "^1.2.5" - strip-json-comments "~3.1.1" - -strip-json-comments@~3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" - integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== - -uc.micro@^1.0.1, uc.micro@^1.0.5: - version "1.0.6" - resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac" - integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA== - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= From 9d51e37e43b75fe4313cb61fa1b90dd2dec65e03 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Thu, 9 Jan 2025 12:25:54 +0100 Subject: [PATCH 5/5] =?UTF-8?q?3534:=20Action!=20=F0=9F=8E=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr.yaml | 134 +++++++++++++------------------------- Taskfile.yml | 33 +++++++--- composer.json | 12 ++++ docker-compose.yml | 4 ++ 4 files changed, 86 insertions(+), 97 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 44dcf985..a48efcfb 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -1,5 +1,10 @@ on: pull_request +# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#defining-environment-variables-for-a-single-workflow +# (cf. services.phpfpm.user in ../../docker-compose.yml) +env: + COMPOSE_USER: root + name: PR Review jobs: fail-for-do-not-merge: @@ -58,112 +63,65 @@ jobs: composer install --no-interaction --no-progress composer normalize composer.json --dry-run - coding-standards-phpcs: - name: PHP - Check Coding Standards + coding-standards-assets: + name: Assets - Check 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: 8.3 - extensions: ctype, dom, iconv, json, zip, gd, soap - 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@v2 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- - - name: Install Dependencies - run: | - composer install --no-interaction --no-progress --no-scripts - # @see https://github.com/Dealerdirect/phpcodesniffer-composer-installer#calling-the-plugin-directly - composer run-script install-codestandards - - name: PHPCS - run: | - composer coding-standards-check/phpcs + - uses: pnorton5432/setup-task@v1 + - run: task coding-standards:assets:check + # Check for any changes (task …:check runs task …:apply) + - run: git diff --exit-code - coding-standards-twig-cs-fixer: - name: Twig - Check Coding Standards + coding-standards-markdown: + name: Markdown - Check 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: 8.3 - extensions: ctype, dom, iconv, json, zip, gd, soap - coverage: none - tools: composer:v2 - - 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@v2 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- - - name: Install Dependencies - run: | - composer install --no-interaction --no-progress --no-scripts - # @see https://github.com/Dealerdirect/phpcodesniffer-composer-installer#calling-the-plugin-directly - composer run-script install-codestandards - - name: TwigCS - run: | - composer coding-standards-check/twig-cs-fixer + - uses: pnorton5432/setup-task@v1 + - run: task coding-standards:markdown:check + # Check for any changes (task …:check runs task …:apply) + - run: git diff --exit-code - coding-standards-markdown: - name: Yarn - Check Coding Standards (Node ${{ matrix.node }}) + coding-standards-php: + name: PHP - Check Coding Standards runs-on: ubuntu-latest - strategy: - matrix: - node: [ '16' ] steps: - uses: actions/checkout@v4 - - name: Setup node - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node }} + - uses: pnorton5432/setup-task@v1 - run: | - yarn install - yarn coding-standards-check + docker network create frontend + task compose -- up --detach + task composer -- install + task coding-standards:php:check + # Check for any changes (task …:check runs task …:apply) + - run: git diff --exit-code + + coding-standards-twig: + name: Twig - Check Coding Standards + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnorton5432/setup-task@v1 + - run: | + docker network create frontend + task compose -- up --detach + task composer -- install + task coding-standards:twig:check + # Check for any changes (task …:check runs task …:apply) + - run: git diff --exit-code code-analysis: name: PHP - Code analysis runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Setup PHP, with composer and extensions - uses: shivammathur/setup-php@v2 - with: - php-version: 8.3 - extensions: ctype, dom, iconv, json, zip, gd, soap - 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@v2 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- - - name: Install Dependencies - run: | - # Using `--no-scripts` breaks something with mglaman/drupal-check. - composer install --no-interaction --no-progress --no-scripts - - name: code-analysis - run: | - composer code-analysis + - uses: pnorton5432/setup-task@v1 + - run: | + docker network create frontend + task compose -- up --detach + task composer -- install + task code-analysis coding-standards-custom-themes: name: Yarn - Check Coding Standards in custom themes diff --git a/Taskfile.yml b/Taskfile.yml index bf7f775e..a74ac771 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -134,8 +134,8 @@ tasks: coding-standards:apply: desc: "Apply coding standards" cmds: - - task: coding-standards:markdown:apply - task: coding-standards:assets:apply + - task: coding-standards:markdown:apply - task: coding-standards:php:apply - task: coding-standards:twig:apply silent: true @@ -143,8 +143,8 @@ tasks: coding-standards:check: desc: "Apply coding standards" cmds: - - task: coding-standards:markdown:check - task: coding-standards:assets:check + - task: coding-standards:markdown:check - task: coding-standards:php:check - task: coding-standards:twig:check silent: true @@ -156,43 +156,58 @@ tasks: # https://github.com/prettier/prettier/issues/15206) have an official # docker image. # https://hub.docker.com/r/jauderho/prettier is good candidate (cf. https://hub.docker.com/search?q=prettier&sort=updated_at&order=desc) - - docker pull jauderho/prettier - docker run --rm --volume "$PWD:/work" jauderho/prettier --write playwright coding-standards:assets:check: desc: "Apply and check coding standards for assets" cmds: - task: coding-standards:assets:apply - - docker pull jauderho/prettier - docker run --rm --volume "$PWD:/work" jauderho/prettier --check playwright coding-standards:markdown:apply: desc: "Apply coding standards for Markdown" cmds: - - docker pull peterdavehello/markdownlint - docker run --rm --volume "$PWD:/md" peterdavehello/markdownlint markdownlint --ignore '**/node_modules/**' --ignore '**/vendor/**' '*.md' 'web/*/custom/**/*.md' 'documentation/*.md' --fix - silent: true coding-standards:markdown:check: desc: "Apply and check coding standards for Markdown" cmds: - task: coding-standards:markdown:apply - docker run --rm --volume "$PWD:/md" peterdavehello/markdownlint markdownlint --ignore '**/node_modules/**' --ignore '**/vendor/**' '*.md' 'web/*/custom/**/*.md' 'documentation/*.md' - silent: true coding-standards:php:apply: desc: "Apply coding standards for PHP" cmds: - - task composer -- coding-standards-apply + - task composer -- coding-standards-apply/php silent: true coding-standards:php:check: desc: "Apply and check coding standards for PHP" cmds: - task: coding-standards:php:apply - - task composer -- coding-standards-check + - task composer -- coding-standards-check/php + silent: true + + coding-standards:twig:apply: + desc: "Apply coding standards for Twig" + cmds: + - task composer -- coding-standards-apply/twig + silent: true + + coding-standards:twig:check: + desc: "Apply and check coding standards for Twig" + cmds: + - task: coding-standards:twig:apply + - task composer -- coding-standards-check/twig silent: true code-analysis: cmds: - task composer -- code-analysis + + docker-pull: + desc: "Pull all development docker images" + cmds: + - docker pull jauderho/prettier + - docker pull peterdavehello/markdownlint + - task compose -- pull diff --git a/composer.json b/composer.json index b55731d3..df40a8a6 100755 --- a/composer.json +++ b/composer.json @@ -268,9 +268,15 @@ "@coding-standards-apply/phpcs", "@coding-standards-apply/twig-cs-fixer" ], + "coding-standards-apply/php": [ + "@coding-standards-apply/phpcs" + ], "coding-standards-apply/phpcs": [ "phpcbf --standard=phpcs.xml.dist" ], + "coding-standards-apply/twig": [ + "@coding-standards-apply/twig-cs-fixer" + ], "coding-standards-apply/twig-cs-fixer": [ "twig-cs-fixer lint web/themes/custom/hoeringsportal/templates --fix" ], @@ -278,9 +284,15 @@ "@coding-standards-check/phpcs", "@coding-standards-check/twig-cs-fixer" ], + "coding-standards-check/php": [ + "@coding-standards-check/phpcs" + ], "coding-standards-check/phpcs": [ "phpcs --standard=phpcs.xml.dist" ], + "coding-standards-check/twig": [ + "@coding-standards-check/twig-cs-fixer" + ], "coding-standards-check/twig-cs-fixer": [ "twig-cs-fixer lint web/themes/custom/hoeringsportal/templates" ], diff --git a/docker-compose.yml b/docker-compose.yml index 0dece663..f0a6e6b5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,6 +25,10 @@ services: phpfpm: image: itkdev/php8.3-fpm:latest + # https://docs.docker.com/reference/compose-file/services/#user + # https://docs.docker.com/compose/how-tos/environment-variables/variable-interpolation/#interpolation-syntax + # (used in .github/workflows/pr.yaml to run service as root) + user: ${COMPOSE_USER:-deploy} networks: - app extra_hosts: