Skip to content

Commit bd66afe

Browse files
committed
Merge branch 'release/0.2.0'
2 parents ae007ca + ede9115 commit bd66afe

File tree

15 files changed

+260
-125
lines changed

15 files changed

+260
-125
lines changed

.github/workflows/pr.yml

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
composer install --no-interaction --no-progress
8181
- name: PHPCS
8282
run: |
83-
composer coding-standards-check/phpcs
83+
docker run --interactive --rm --volume ${PWD}:/app itkdev/php8.3-fpm:latest composer coding-standards-check
8484
8585
php-code-analysis:
8686
name: PHP code analysis
@@ -111,27 +111,12 @@ jobs:
111111
run: |
112112
./scripts/code-analysis
113113
114-
markdownlint:
114+
markdown-lint:
115+
name: Markdown lint
115116
runs-on: ubuntu-latest
116-
name: markdownlint
117117
steps:
118118
- name: Checkout
119-
uses: actions/checkout@v2
120-
- name: Get yarn cache directory path
121-
id: yarn-cache-dir-path
122-
run: echo "::set-output name=dir::$(yarn cache dir)"
123-
- name: Cache yarn packages
124-
uses: actions/cache@v2
125-
id: yarn-cache
126-
with:
127-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
128-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
129-
restore-keys: |
130-
${{ runner.os }}-yarn-
131-
- name: Yarn install
132-
uses: actions/setup-node@v2
133-
with:
134-
node-version: '20'
135-
- run: yarn install
136-
- name: markdownlint
137-
run: yarn coding-standards-check/markdownlint
119+
uses: actions/checkout@v4
120+
121+
- name: Markdown lint
122+
run: docker run --rm --volume "$PWD:/md" itkdev/markdownlint markdownlint --ignore vendor '**/*.md'

.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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#ignoring-files
2+
vendor/
3+
LICENSE.md
4+
5+
# Local Variables:
6+
# mode: gitignore
7+
# End:

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
## [Unreleased]
1010

11+
## [0.2.0] - 2025-02-17
12+
13+
- Used account name as fallback in user logging
14+
- Add Drush 13 compatibility
15+
- Add linting and code analysis to readme
16+
- Add markdown linting
17+
1118
## [0.1.6] - 2024-12-16
1219

1320
- Fixed missing queue error during installation.
@@ -52,7 +59,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5259
- First version of the module
5360
- Added submodule to log user CUD events.
5461

55-
[Unreleased]: https://github.com/OS2web/os2web_audit/compare/0.1.6...HEAD
62+
[Unreleased]: https://github.com/OS2web/os2web_audit/compare/0.2.0...HEAD
63+
[0.2.0]: https://github.com/OS2web/os2web_audit/compare/0.1.6...0.2.0
5664
[0.1.6]: https://github.com/OS2web/os2web_audit/compare/0.1.5...0.1.6
5765
[0.1.5]: https://github.com/OS2web/os2web_audit/compare/0.1.4...0.1.5
5866
[0.1.4]: https://github.com/OS2web/os2web_audit/compare/0.1.3...0.1.4

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,36 @@ drush advancedqueue:queue:list
7272

7373
or go to `/admin/config/system/queues/jobs/os2web_audit` for a
7474
graphical overview of jobs in the queue.
75+
76+
### Coding standards
77+
78+
#### PHP files (PHP_CodeSniffer)
79+
80+
Check PHP coding standards
81+
82+
```shell
83+
docker run --interactive --rm --volume ${PWD}:/app itkdev/php8.3-fpm:latest composer install
84+
docker run --interactive --rm --volume ${PWD}:/app itkdev/php8.3-fpm:latest composer coding-standards-check
85+
```
86+
87+
Apply coding standard changes
88+
89+
```shell
90+
docker run --interactive --rm --volume ${PWD}:/app itkdev/php8.3-fpm:latest composer install
91+
docker run --interactive --rm --volume ${PWD}:/app itkdev/php8.3-fpm:latest composer coding-standards-apply
92+
```
93+
94+
### Code analysis
95+
96+
phpstan is used to perform static analysis of the code. Run the following script:
97+
98+
```sh
99+
./scripts/code-analysis
100+
```
101+
102+
#### Markdown files
103+
104+
```shell
105+
docker run --interactive --rm --volume "$PWD:/md" itkdev/markdownlint markdownlint '**/*.md' --fix
106+
docker run --interactive --rm --volume "$PWD:/md" itkdev/markdownlint markdownlint '**/*.md'
107+
```

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"ext-curl": "*",
2020
"php": "^8.1",
2121
"drupal/advancedqueue": "^1.2",
22-
"drush/drush": "^11.5|^12.5"
22+
"drush/drush": "^11|^12|^13"
2323
},
2424
"require-dev": {
2525
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",

drush.services.yml

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

modules/os2web_audit_user/os2web_audit_user.module

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use Drupal\user\UserInterface;
1515
function os2web_audit_user_user_insert(EntityInterface $entity): void {
1616
/** @var \Drupal\user\Entity\User $entity */
1717
$msg = sprintf('User created with rolles: %s', implode(', ', $entity->getRoles()));
18-
os2web_audit_user_log($msg, $entity->getEmail());
18+
os2web_audit_user_log($msg, $entity->getEmail() ?? $entity->getAccountName());
1919
}
2020

2121
/**
@@ -24,29 +24,29 @@ function os2web_audit_user_user_insert(EntityInterface $entity): void {
2424
function os2web_audit_user_user_update(EntityInterface $entity): void {
2525
/** @var \Drupal\user\Entity\User $entity */
2626
$msg = sprintf('User updated with rolles: %s', implode(', ', $entity->getRoles()));
27-
os2web_audit_user_log($msg, $entity->getEmail());
27+
os2web_audit_user_log($msg, $entity->getEmail() ?? $entity->getAccountName());
2828
}
2929

3030
/**
3131
* Implements hook_ENTITY_TYPE_delete().
3232
*/
3333
function os2web_audit_user_user_delete(EntityInterface $entity): void {
3434
/** @var \Drupal\user\Entity\User $entity */
35-
os2web_audit_user_log('User deleted', $entity->getEmail());
35+
os2web_audit_user_log('User deleted', $entity->getEmail() ?? $entity->getAccountName());
3636
}
3737

3838
/**
3939
* Implements hook_user_login().
4040
*/
4141
function os2web_audit_user_user_login(UserInterface $account): void {
42-
os2web_audit_user_log('User logged in', $account->getEmail());
42+
os2web_audit_user_log('User logged in', $account->getEmail() ?? $account->getAccountName());
4343
}
4444

4545
/**
4646
* Implements hook_user_logout().
4747
*/
4848
function os2web_audit_user_user_logout(AccountInterface $account): void {
49-
os2web_audit_user_log('User logged out', $account->getEmail());
49+
os2web_audit_user_log('User logged out', $account->getEmail() ?? $account->getAccountName());
5050
}
5151

5252
/**

package.json

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

scripts/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
COMPOSE_PROJECT_NAME=drupal-module
2+
MODULE_NAME=os2web_audit

0 commit comments

Comments
 (0)