Repository navigation
#72 Add tomasvotruba/cognitive-complexity. - #95
Merged
Merged
Conversation
hkirsman
force-pushed
the
feature/72-Re-add-code-complexity
branch
3 times, most recently
from
May 29, 2023 10:08
2c9c89c to
c93f7c0
Compare
hkirsman
force-pushed
the
feature/72-Re-add-code-complexity
branch
from
May 29, 2023 10:09
c93f7c0 to
11101c9
Compare
hkirsman
commented
May 29, 2023
Member
|
I tested this in Metropolia project, got this: |
Juhani-moilanen
left a comment
Contributor
There was a problem hiding this comment.
Tested in VaKe
Locally all is good -- threw an error that complexity is too high
tried the" deploy" step also -- should it "flag" all files?
IIRC then before it only searched those files that were changed in the commit and did not scan all of them
…r branch for easier merge)
…72-Re-add-code-complexity
hkirsman
commented
May 22, 2024
| "mglaman/phpstan-drupal": "^1.1", | ||
| "phpstan/extension-installer": "^1.1", | ||
| "phpstan/phpstan-deprecation-rules": "^1.0", | ||
| "nette/finder": "^2.5", |
Contributor
Author
There was a problem hiding this comment.
Not 100% sure if nette/finder is needed as nothing hasn't been broken before, then again it is used in https://github.com/wunderio/code-quality/blob/main/src/Drupal/DrupalAutoloader.php
tormi
approved these changes
May 22, 2024
Contributor
Author
|
@misterjoonas you need to remoe these from phpstan.neon file as they are loaded automatically now. I'm soon merging this and creating 3.1 version for Code Quality. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
2 years ago we had to remove code complexity checks https://github.com/wunderio/code-quality/pull/71/files#diff-368d327cbe54fd3c9d4537668316b016ca7aee4c2e09f60cca8d9c67f711d27eL15 when adding support for D9 for Code Quality. We were waiting for Drupal 10 to come out to add it back, but it seems there's a new package that can be used and there's no Symfony restriction on it https://github.com/TomasVotruba/cognitive-complexity
Testing notes
Include this version of Code Quality
lando composer require wunderio/code-quality:dev-feature/72-Re-add-code-complexity --dev --with-all-dependenciesEdit your local phpstan.neon file and add (use tabs)
OR copy over the file from this version:
OR
Create file at
web/modules/custom/updates_file.php(it needs to be under web/modules/custom/)Ask Copilot To create the code.
Create in PHP 10 foreaches inside each other in a function. Please write out each foreach.Stage the file to GIT
git add web/modules/custom/updates_file.phpTry to commit and see if the you see alert about cognitive complexity
You should see something like this along the lines: