GrafiteInc/Forms

View on GitHub

Showing 47 of 63 total issues

Function makeSelect has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function makeSelect($name, $selected, $options)
    {
        $selectOptions = '';

        if (isset($options['attributes']['value'])) {
Severity: Minor
Found in src/Builders/FieldBuilder.php - About 3 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

Function indexBody has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function indexBody($query = null)
    {
        $fields = $this->parseVisibleFields($this->parseFields($this->fields()));
        $sortBy = array_keys($fields)[0];
        $query = $query;
Severity: Minor
Found in src/Forms/Concerns/HasIndex.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

Function formButtonsAndClose has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    protected function formButtonsAndClose()
    {
        $rowAlignment = config('forms.form.sections.row-alignment-end', 'd-flex justify-content-end');

        if (isset($this->buttons['cancel']) || $this->columns === 'steps' || $this->buttonsJustified) {
Severity: Minor
Found in src/Forms/HtmlForm.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

Function indexHeaders has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function indexHeaders()
    {
        $headers = '';

        $columns = (! empty($this->indexColumns())) ? $this->indexColumns() : $this->parseVisibleFields($this->parseFields($this->fields()));
Severity: Minor
Found in src/Forms/Concerns/HasIndex.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

Function _formsjs_trigger_onclick_function has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

window._formsjs_trigger_onclick_function = function (event) {
    event.preventDefault();

    let _form = event.target.form;
    let _method = event.target.getAttribute('data-formsjs-onclick');
Severity: Minor
Found in src/JavaScript/core.js - 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

Function makeCheckInput has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function makeCheckInput($name, $value, $options)
    {
        $customClasses = $options['attributes']['class'] ?? '';
        $customLabelClasses = $options['label_class'] ?? '';

Severity: Minor
Found in src/Builders/FieldBuilder.php - 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

Consider simplifying this complex logical expression.
Open

            if (_input.validity.patternMismatch
                || _input.validity.valueMissing
                || _input.validity.rangeOverflow
                || _input.validity.stepMismatch
                || _input.validity.typeMismatch
Severity: Critical
Found in src/JavaScript/default.js - About 1 hr to fix

    Function action has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function action($method, $route, $button = 'Send', $options = [], $asModal = false, $disableOnSubmit = false, $submitViaAjax = false)
        {
            if (! is_null($this->submitViaAjax)) {
                $submitViaAjax = $this->submitViaAjax;
            }
    Severity: Minor
    Found in src/Forms/Form.php - 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

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

            $route,
            $content = "",
            $payload = [],
            $method = "post",
            $options = [],
    Severity: Major
    Found in src/Components/FormAction.php - About 1 hr to fix

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

              $route,
              $method = 'post',
              $content = '',
              $message = '',
              $payload = [],
      Severity: Major
      Found in src/Components/FormModal.php - About 1 hr to fix

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

            protected function getOptionSelectedValue($selected, $value, $options)
            {
                $selectedValue = '';
        
                if (
        Severity: Minor
        Found in src/Builders/FieldBuilder.php - 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 render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function render($attributes, $name = null, $livewireEnabled = false, $livewireOnKeydown = false, $livewireOnChange = false)
            {
                $html = [];
                $livewireAttributes = [];
        
        
        Severity: Minor
        Found in src/Builders/AttributeBuilder.php - 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 getWrappers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            protected static function getWrappers($options, $key)
            {
                $groupTextClass = config('forms.form.input-group-text', 'input-group-text');
        
                if (isset($options[$key])) {
        Severity: Minor
        Found in src/Fields/Field.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 edit has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function edit($model = null)
            {
                if (! is_null($model)) {
                    $this->setInstance($model);
                }
        Severity: Minor
        Found in src/Forms/ModelForm.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 makeRelationship has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function makeRelationship($name, $value, $options)
            {
                $method = 'all';
                $class = $options['model'];
        
        
        Severity: Minor
        Found in src/Builders/FieldBuilder.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 getFieldsAsInputs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function getFieldsAsInputs($fields, $formBuild)
            {
                $inputs = [];
        
                foreach ($fields as $field) {
        Severity: Minor
        Found in src/Services/FormMaker.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 getObjectValue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getObjectValue($object, $name)
            {
                if (is_object($object) && isset($object->$name)) {
                    return $object->$name;
                }
        Severity: Minor
        Found in src/Services/FieldMaker.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

        Method action has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function action($method, $route, $button = 'Send', $options = [], $asModal = false, $disableOnSubmit = false, $submitViaAjax = false)
        Severity: Major
        Found in src/Forms/Form.php - About 50 mins to fix

          Function makeField has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function makeField($columnConfig, $label, $column, $value, $errors)
              {
                  $field = null;
          
                  if (in_array($columnConfig['type'], $this->standard)) {
          Severity: Minor
          Found in src/Services/FieldMaker.php - About 45 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 make has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function make(string $column, array $columnConfig, $object = null)
              {
                  $this->builder
                      ->setLivewire($this->withLivewire)
                      ->setLivewireOnKeydown($this->livewireOnKeydown)
          Severity: Minor
          Found in src/Services/FieldMaker.php - About 45 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