Showing 16 of 40 total issues

Form has 36 functions (exceeds 20 allowed). Consider refactoring.
Open

class Form extends \Galahad\Aire\DTD\Form implements NonInput
{
    use CreatesElements, CreatesInputTypes;
    
    /**
Severity: Minor
Found in src/Elements/Form.php - About 4 hrs to fix

    File Form.php has 341 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Galahad\Aire\Elements;
    
    use BadMethodCallException;
    Severity: Minor
    Found in src/Elements/Form.php - About 4 hrs to fix

      Function connect has 97 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const connect = (target, rules = {}, messages = {}, form_request = null) => {
          if (!supported) {
              return null;
          }
          
      Severity: Major
      Found in js/src/Aire.js - About 3 hrs to fix

        Input has 30 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Input extends Element
        {
            public $name = 'input';
            
            /**
        Severity: Minor
        Found in src/DTD/Input.php - About 3 hrs to fix

          Function data has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              public function data($data_key, $value) : self
              {
                  $key = "data-{$data_key}";
                  
                  if (null === $value) {
          Severity: Minor
          Found in src/Elements/Element.php - About 2 hrs 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

          Attributes has 22 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Attributes implements Htmlable, ArrayAccess, Arrayable
          {
              /**
               * @var array
               */
          Severity: Minor
          Found in src/Elements/Attributes/Attributes.php - About 2 hrs to fix

            Function run has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                const run = (e) => {
                    if ('undefined' !== typeof e && 'target' in e) {
                        touch(e);
                    }
                    
            Severity: Minor
            Found in js/src/Aire.js - About 1 hr to fix

              Method variantClassNames has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function variantClassNames() : array
                  {
                      if (null === $this->element) {
                          return [];
                      }
              Severity: Minor
              Found in src/Elements/Attributes/ClassNames.php - About 1 hr to fix

                Method aireHtml has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function aireHtml() : string
                    {
                        if (static::$aire_loaded) {
                            return '';
                        }
                Severity: Minor
                Found in src/Elements/ClientValidation.php - About 1 hr to fix

                  Function getData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const getData = (form) => {
                      const formData = new FormData(form);
                      const values = {};
                      for (let [key, value] of formData.entries()) {
                          const name = key.replace(/\[]$/, '');
                  Severity: Minor
                  Found in js/src/Aire.js - About 1 hr 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

                  Function offsetGet has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function offsetGet($key)
                      {
                          $value = $this->items[$key] ?? null;
                          
                          if (isset($this->mutators[$key])) {
                  Severity: Minor
                  Found in src/Elements/Attributes/Attributes.php - About 55 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

                  Function connect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const connect = (target, rules = {}, messages = {}, form_request = null) => {
                      if (!supported) {
                          return null;
                      }
                      
                  Severity: Minor
                  Found in js/src/Aire.js - About 55 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

                  Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function __construct(Aire $aire, $element_id, array $rules = [], array $messages = [], string $form_request = null, $dev_mode = false)
                  Severity: Minor
                  Found in src/Elements/ClientValidation.php - About 45 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return;
                    Severity: Major
                    Found in src/Elements/Form.php - About 30 mins to fix

                      Function getBoundValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getBoundValue($name, $default = null)
                          {
                              if (empty($name)) {
                                  return value($default);
                              }
                      Severity: Minor
                      Found in src/Elements/Form.php - About 25 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

                      Function getArrayableItems has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function getArrayableItems($items)
                          {
                              if (is_string($items) && is_subclass_of($items, '\\BenSampo\\Enum\\Enum')) {
                                  if (method_exists($items, 'toSelectArray')) {
                                      $items = forward_static_call([$items, 'toSelectArray']);
                      Severity: Minor
                      Found in src/Support/OptionsCollection.php - About 25 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

                      Severity
                      Category
                      Status
                      Source
                      Language