Skip to content

Commit

Permalink
Added srtict types.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Nov 8, 2023
1 parent 893bb27 commit 16d0440
Show file tree
Hide file tree
Showing 166 changed files with 1,946 additions and 2,669 deletions.
9 changes: 8 additions & 1 deletion .ahoy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,20 +164,27 @@ commands:
cmd: |
ahoy cli vendor/bin/phpcs
ahoy cli vendor/bin/phpstan
ahoy cli vendor/bin/rector process --dry-run .
ahoy cli vendor/bin/phpmd . text phpmd.xml
lint-fe:
usage: Lint front-end code.
cmd: |
ahoy cli vendor/bin/twigcs
ahoy cli "npm run --prefix \${DREVOPS_WEBROOT}/themes/custom/\${DRUPAL_THEME} lint"
ahoy cli "npm run --prefix \${DREVOPS_WEBROOT}/themes/contrib/\${DRUPAL_THEME} lint"
lint-config:
usage: Lint config
cmd: |
ahoy cli ./scripts/lint-theme-config.sh
ahoy cli "./vendor/bin/drush inspect_config civictheme.settings --detail --only-error"
lint-fix:
usage: Fix lint issues of back-end and front-end code.
cmd: |
ahoy cli vendor/bin/phpcbf
ahoy cli vendor/bin/rector process .
test:
usage: Run all tests.
cmd: ahoy test-unit && ahoy test-kernel && ahoy test-functional && ahoy test-bdd
Expand Down
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ job-build: &job-build
- run:
name: Lint code with PHPStan
command: docker compose exec -T cli vendor/bin/phpstan || [ "${DREVOPS_CI_PHPSTAN_IGNORE_FAILURE:-0}" -eq 1 ]
- run:
name: Lint code with Rector
command: docker compose exec -T cli vendor/bin/rector process --dry-run . || [ "${DREVOPS_CI_RECTOR_IGNORE_FAILURE:-0}" -eq 1 ]
- run:
name: Lint code with PHPMD
command: docker compose exec -T cli vendor/bin/phpmd . text phpmd.xml || [ "${DREVOPS_CI_PHPMD_IGNORE_FAILURE:-0}" -eq 1 ]
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@
"drupal/core-dev": "^10",
"drupal/drupal-extension": "^5@rc",
"friendsoftwig/twigcs": "^6.2",
"mglaman/phpstan-drupal": "^1.1",
"mglaman/phpstan-drupal": "^1.2",
"palantirnet/drupal-rector": "dev-main",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpcompatibility/php-compatibility": "^9.3",
"phpmd/phpmd": "^2.13",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/extension-installer": "^1.3",
"pyrech/composer-changelogs": "^1.8"
},
"autoload": {
Expand Down
158 changes: 146 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Before starting, ensure you have reviewed the documentation for

The following steps outline the build process:

1. Construct a fresh Drupal 9 site from the GovCMS Drupal profile. Utilize
1. Construct a fresh Drupal 10 site from the GovCMS Drupal profile. Utilize
`ahoy install-site` for a rebuild.
2. Activate additional modules needed for development by installing the
`civictheme_dev` module.
Expand All @@ -34,7 +34,7 @@ the profile, following the order of their numbering.

By default, the site:

- Installs Drupal 9.
- Installs Drupal 10.
- Installs the `govcms` profile.
- Installs the CivicTheme Drupal theme.
- Creates and installs the CivicTheme Demo sub-theme.
Expand Down
24 changes: 21 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,18 @@ parameters:
drupal:
drupal_root: web

# Do not report on ignored errors that do not occur in the results. This is
# required to allow code generated by a sub-theme to be ignored.
reportUnmatchedIgnoredErrors: false

ignoreErrors:
-
# Since tests and data providers do not have to have parameter docblocks,
# it is not possible to specify the type of the parameter, so we ignore
# this error.
message: '#.*no value type specified in iterable type array.#'
paths:
- web/modules/custom/*/tests/*
- web/themes/custom/*/tests/*
- web/themes/contrib/civictheme/*/tests/*
- web/themes/contrib/civictheme/tests/*
- tests/phpunit/*
-
# Hook implementations do not provide docblocks for parameters, so there
Expand All @@ -52,3 +54,19 @@ parameters:
message: '#Variable .* might not be defined.#'
paths:
- web/sites/default/includes
-
# Allow using Drupal::service() in tests and Drush commands.
message: '#\Drupal calls should be avoided in classes, use dependency injection instead#'
paths:
- web/themes/contrib/civictheme/src/Drush/Commands
- tests/behat
-
# Allow using direct callable calls for generated content.
message: '#Parameter \#1 \$callback of function call_user_func expects callable.*#'
paths:
- web/modules/custom/cs_generated_content/src/CsGeneratedContentCivicthemeTrait.php
-
# Allow using direct assignment to fields.
message: '#Property.*does not accept.*#'
paths:
- web/themes/contrib/civictheme/
Loading

0 comments on commit 16d0440

Please sign in to comment.