SU-SWS/stanford_fields

View on GitHub
src/Plugin/Field/FieldWidget/LocalistUrlWidget.php

Summary

Maintainability
A
0 mins
Test Coverage
A
98%

File LocalistUrlWidget.php has 295 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

<?php

namespace Drupal\stanford_fields\Plugin\Field\FieldWidget;

use Drupal\Component\Utility\NestedArray;
Severity: Minor
Found in src/Plugin/Field/FieldWidget/LocalistUrlWidget.php - About 3 hrs to fix

    Method formElement has 41 lines of code (exceeds 40 allowed). Consider refactoring.
    Wontfix

      public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
        $element = parent::formElement($items, $delta, $element, $form, $form_state);
        // Fallback to inherited link widget if the base_url is not set.
        if (!$this->getSetting('base_url')) {
          return $element;
    Severity: Minor
    Found in src/Plugin/Field/FieldWidget/LocalistUrlWidget.php - About 1 hr to fix

      Function massageFormValues has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
      Wontfix

        public function massageFormValues(array $values, array $form, FormStateInterface $form_state) {
          if (!$this->getSetting('base_url')) {
            return parent::massageFormValues($values, $form, $form_state);
          }
      
      
      Severity: Minor
      Found in src/Plugin/Field/FieldWidget/LocalistUrlWidget.php - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      syntax error, unexpected ','
      Open

        id: 'localist_url',

      Doc comment short description must start with a capital letter
      Wontfix

         * {@inheritDoc}

      Doc comment short description must start with a capital letter
      Wontfix

         * {@inheritDoc}

      Doc comment short description must start with a capital letter
      Wontfix

         * {@inheritDoc}

      Doc comment short description must start with a capital letter
      Wontfix

         * {@inheritDoc}

      Doc comment short description must start with a capital letter
      Wontfix

         * {@inheritDoc}

      Doc comment short description must end with a full stop
      Wontfix

         * {@inheritDoc}

      Doc comment short description must end with a full stop
      Wontfix

         * {@inheritDoc}

      Doc comment short description must start with a capital letter
      Wontfix

         * {@inheritDoc}

      Missing class doc comment
      Open

      class LocalistUrlWidget extends LinkWidget {

      Doc comment short description must end with a full stop
      Wontfix

         * {@inheritDoc}

      Perl-style comments are not allowed; use "// Comment" instead
      Open

      #[FieldWidget(

      Doc comment short description must end with a full stop
      Wontfix

         * {@inheritDoc}

      Doc comment short description must start with a capital letter
      Wontfix

         * {@inheritDoc}

      Doc comment short description must end with a full stop
      Wontfix

         * {@inheritDoc}

      Line indented incorrectly; expected 0 spaces, found 2
      Open

        id: 'localist_url',

      Doc comment short description must end with a full stop
      Wontfix

         * {@inheritDoc}

      Unused use statement
      Open

      use Drupal\Core\Field\Attribute\FieldWidget;

      Doc comment short description must end with a full stop
      Wontfix

         * {@inheritDoc}

      There are no issues that match your filters.

      Category
      Status