Skip to content

Commit b849e83

Browse files
committed
Cleaned up code
1 parent eecb47a commit b849e83

File tree

22 files changed

+168
-189
lines changed

22 files changed

+168
-189
lines changed

.github/workflows/pr.yml

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
runs-on: ubuntu-latest
2424
strategy:
2525
matrix:
26-
php-versions: [ '8.1' ]
26+
php-versions: [ '8.3' ]
2727
dependency-version: [ prefer-lowest, prefer-stable ]
2828
steps:
2929
- uses: actions/checkout@master
@@ -39,24 +39,29 @@ jobs:
3939
id: composer-cache
4040
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
4141
- name: Cache dependencies
42-
uses: actions/cache@v2
42+
uses: actions/cache@v4
4343
with:
4444
path: ${{ steps.composer-cache.outputs.dir }}
4545
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
4646
restore-keys: ${{ runner.os }}-composer-
4747
- name: Validate composer files
4848
run: |
4949
composer config --no-plugins allow-plugins.mglaman/composer-drupal-lenient true
50-
composer validate --strict composer.json
50+
# The --strict flag on validate has been removed due to the package drupal/config_entity_revisions 2.0.x-dev
51+
# being considered a version cf. https://getcomposer.org/doc/articles/versions.md#branches
52+
composer validate composer.json
5153
# Check that dependencies resolve.
5254
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
55+
- name: Check that composer file is normalized
56+
run: |
57+
composer normalize --dry-run
5358
5459
php-coding-standards:
5560
name: PHP coding standards
5661
runs-on: ubuntu-latest
5762
strategy:
5863
matrix:
59-
php-versions: [ '8.1' ]
64+
php-versions: [ '8.3' ]
6065
steps:
6166
- uses: actions/checkout@master
6267
- name: Setup PHP, with composer and extensions
@@ -71,7 +76,7 @@ jobs:
7176
id: composer-cache
7277
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
7378
- name: Cache dependencies
74-
uses: actions/cache@v2
79+
uses: actions/cache@v4
7580
with:
7681
path: ${{ steps.composer-cache.outputs.dir }}
7782
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -89,7 +94,7 @@ jobs:
8994
runs-on: ubuntu-latest
9095
strategy:
9196
matrix:
92-
php-versions: [ '8.1' ]
97+
php-versions: [ '8.3' ]
9398
steps:
9499
- uses: actions/checkout@master
95100
- name: Setup PHP, with composer and extensions
@@ -104,7 +109,7 @@ jobs:
104109
id: composer-cache
105110
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
106111
- name: Cache dependencies
107-
uses: actions/cache@v2
112+
uses: actions/cache@v4
108113
with:
109114
path: ${{ steps.composer-cache.outputs.dir }}
110115
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -113,27 +118,13 @@ jobs:
113118
run: |
114119
./scripts/code-analysis
115120
116-
markdownlint:
121+
coding-standards-markdown:
122+
name: Markdown coding standards
117123
runs-on: ubuntu-latest
118-
name: markdownlint
119124
steps:
120125
- name: Checkout
121-
uses: actions/checkout@v2
122-
- name: Get yarn cache directory path
123-
id: yarn-cache-dir-path
124-
run: echo "::set-output name=dir::$(yarn cache dir)"
125-
- name: Cache yarn packages
126-
uses: actions/cache@v2
127-
id: yarn-cache
128-
with:
129-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
130-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
131-
restore-keys: |
132-
${{ runner.os }}-yarn-
133-
- name: Yarn install
134-
uses: actions/setup-node@v2
135-
with:
136-
node-version: '20'
137-
- run: yarn install
138-
- name: markdownlint
139-
run: yarn coding-standards-check/markdownlint
126+
uses: actions/checkout@master
127+
128+
- name: Coding standards
129+
run: |
130+
docker run --rm --volume $PWD:/md peterdavehello/markdownlint markdownlint '**/*.md'

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,3 @@
44
composer.lock
55
vendor
66

7-
node_modules/
8-
yarn.lock

.markdownlint.jsonc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"default": true,
3+
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md013.md
4+
"line-length": {
5+
"line_length": 120,
6+
"code_blocks": false,
7+
"tables": false
8+
},
9+
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md024.md
10+
"no-duplicate-heading": {
11+
"siblings_only": true
12+
}
13+
}

.markdownlintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#ignoring-files
2+
vendor/

.markdownlintrc

Lines changed: 0 additions & 18 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ before starting to add changes. Use example [placed in the end of the page](#exa
1111

1212
## [Unreleased]
1313

14+
- [PR-168](https://github.com/OS2Forms/os2forms/pull/168)
15+
Cleaned up code
1416
- Updating the display of os2forms package on the status page
1517

1618
## [4.0.0] 2025-03-06
1719

1820
- This is an alias for for 3.22.2. Major change is the module removal, which can lead to lack of backward support.
1921
See full release note here:
20-
https://github.com/OS2Forms/os2forms_docs/blob/master/docs/releases/2024-Q4-Release-notes.md
22+
<https://github.com/OS2Forms/os2forms_docs/blob/master/docs/releases/2024-Q4-Release-notes.md>
2123

2224
## [3.22.2] 2025-02-28
2325

@@ -92,9 +94,8 @@ https://github.com/OS2Forms/os2forms_docs/blob/master/docs/releases/2024-Q4-Rele
9294
## [3.16.0] 2024-08-27
9395

9496
f/OS-115_dawa_address
95-
- [OS-115] Skipping empty maktrikula objects
96-
9797

98+
- [OS-115] Skipping empty maktrikula objects
9899

99100
[#110](https://github.com/OS2Forms/os2forms/pull/110)
100101

README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -121,30 +121,29 @@ run the checks locally.
121121
### PHP
122122

123123
```sh
124-
docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.1-fpm composer install
125-
docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.1-fpm composer coding-standards-check
126-
124+
docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.3-fpm composer install
127125
# Fix (some) coding standards issues.
128-
docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.1-fpm composer coding-standards-apply
126+
docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.3-fpm composer coding-standards-apply
127+
docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.3-fpm composer coding-standards-check
129128
```
130129

131130
### Markdown
132131

133132
```sh
134-
docker run --rm --volume ${PWD}:/app --workdir /app node:20 yarn install
135-
docker run --rm --volume ${PWD}:/app --workdir /app node:20 yarn coding-standards-check/markdownlint
136-
137-
# Fix (some) coding standards issues.
138-
docker run --rm --volume ${PWD}:/app --workdir /app node:20 yarn coding-standards-apply/markdownlint
133+
docker pull peterdavehello/markdownlint
134+
docker run --rm --volume $PWD:/md peterdavehello/markdownlint markdownlint '**/*.md' --fix
135+
docker run --rm --volume $PWD:/md peterdavehello/markdownlint markdownlint '**/*.md'
139136
```
140137

141138
## Code analysis
142139

143140
We use [PHPStan](https://phpstan.org/) for static code analysis.
144141

145-
Running statis code analysis on a standalone Drupal module is a bit tricky, so
146-
we use a helper script to run the analysis:
142+
Running statis code analysis on a standalone Drupal module is a bit tricky, so we use a helper script to run the
143+
analysis:
147144

148-
```sh
149-
./scripts/code-analysis
145+
```shell
146+
docker run --rm --volume ${PWD}:/app --workdir /app itkdev/php8.3-fpm ./scripts/code-analysis
150147
```
148+
149+
**Note**: Currently the code analysis is only run on the `os2forms_digital_post` sub-module (cf. [`phpstan.neon`](./phpstan.neon)).

0 commit comments

Comments
 (0)