[2.0.0-beta1] ui_patterns_devel: code quality

Created on 22 July 2024, 4 months ago
Updated 12 August 2024, 3 months ago

The main goal of beta1 is to increase code quality.

PHPMD

Following 📌 [2.0.0-beta1] Reduce code complexity Fixed

vendor/bin/phpmd path/to/ui_patterns/modules/ui_patterns_devel text codesize is raising those alerts.

I know it is not very important to fix them because they are in tests classes, but we want to add PHPMD to the Gitlab CI piepeline, so it would be nice to fix them (without suppressing them) to avoid noisy results.

TwigValidatorRuleTest::processNode()

Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.

TwigValidatorRuleFilterTest::providerTestTwigValidatorFilter()

ExcessiveMethodLength: 121 lines of code. Current threshold is set to 100. Avoid really long methods.

TwigValidatorRuleFunctionTest::providerTestTwigValidatorFunction()

ExcessiveMethodLength: 168 lines of code. Current threshold is set to 100. Avoid really long methods.

PHPCS

16 use phpcs:disable in all ui_patterns 2.x, all of them but on are in ui_patterns_devel. It is OK to use this directive but it is even better to address the feedbacks.

src/Plugin/TwigValidatorRule/TwigValidatorRuleFilter.php:    // @phpcs:disable Drupal.Semantics.FunctionT.NotLiteralString
src/Plugin/TwigValidatorRule/TwigValidatorRuleTest.php:          // @phpcs:disable

src/ValidatorMessage.php:    // phpcs:disable Drupal.Semantics.FunctionT.NotLiteralString
src/ValidatorMessage.php:    // phpcs:disable Drupal.Semantics.FunctionT.NotLiteralString
src/ValidatorMessage.php:    // phpcs:disable Drupal.Semantics.FunctionT.NotLiteralString

tests/src/Unit/TwigNodeFinderTest.php: * phpcs:disable Drupal.Commenting.VariableComment.Missing
tests/src/Unit/TwigValidatorRulePluginTest.php: * phpcs:disable Drupal.Commenting.VariableComment.Missing
tests/src/Unit/TwigValidatorRulePluginTest.php:   * @phpcs:disable DrupalPractice.Objects.UnusedPrivateMethod.UnusedMethod
tests/src/Kernel/TwigValidatorTestBase.php: * phpcs:disable Drupal.Commenting.VariableComment.Missing,
tests/src/Kernel/ValidatorTest.php: * phpcs:disable Drupal.Commenting.VariableComment.Missing
tests/src/Kernel/TwigValidatorRule/TwigValidatorRuleFilterTest.php: * phpcs:disable Drupal.Arrays.Array.LongLineDeclaration,Drupal.Commenting.InlineComment.SpacingBefore,Drupal.Files.LineLength.TooLong
tests/src/Kernel/TwigValidatorRule/TwigValidatorRuleFunctionTest.php: * phpcs:disable Drupal.Arrays.Array.LongLineDeclaration,Drupal.Commenting.InlineComment.SpacingBefore
tests/src/Kernel/TwigValidatorRule/TwigValidatorRuleNameTest.php: * phpcs:disable Drupal.Arrays.Array.LongLineDeclaration,Drupal.Commenting.DocComment.MissingShort
tests/src/Kernel/TwigValidatorRule/TwigValidatorRuleGetAttrTest.php: * phpcs:disable Drupal.Arrays.Array.LongLineDeclaration
tests/src/Kernel/TwigVariableCollectorTest.php: * @phpcs:disable Drupal.Commenting.FunctionComment.Missing
📌 Task
Status

Fixed

Version

2.0

Component

UI Patterns Devel [2.x only]

Created by

🇫🇷France pdureau Paris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024