GrafiteInc/FormMaker

View on GitHub

Showing 124 of 139 total issues

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

    private function buildSection($fields, $columns, $label = null)
    {
        $formChunks = [];
        $newFormBuild = [];

Severity: Minor
Found in src/Services/FormMaker.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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function create()
    {
        $this->submitMethod = $this->submitMethods['create'] ?? null;

        if ($this->orientation === 'horizontal') {
Severity: Minor
Found in src/Forms/ModelForm.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

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

        $form,
        $item,
        $confirm = false,
        $confirmMessage = "Are you sure you want to delete this item?",
        $confirmMethod = "confirm"
Severity: Minor
Found in src/Components/FormDelete.php - About 35 mins to fix

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

            $index,
            $route,
            $content = "",
            $placeholder = "",
            $method = "post"
    Severity: Minor
    Found in src/Components/FormSearch.php - About 35 mins to fix

      Method makeField has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          protected function makeField($columnConfig, $label, $column, $value, $errors)
      Severity: Minor
      Found in src/Services/FieldMaker.php - About 35 mins to fix

        Method render has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function render($attributes, $name = null, $livewireEnabled = false, $livewireOnKeydown = false, $livewireOnChange = false)
        Severity: Minor
        Found in src/Builders/AttributeBuilder.php - About 35 mins to fix

          Function parseFields has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function parseFields($formFields)
              {
                  $fields = [];
          
                  if (empty($formFields)) {
          Severity: Minor
          Found in src/Forms/HtmlForm.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

          Function formSubmitHtml has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function formSubmitHtml()
              {
                  $html = '';
                  $onSubmit = null;
          
          
          Severity: Minor
          Found in src/Forms/HtmlForm.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

          Function make has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function make()
              {
                  if ($this->orientation === 'horizontal') {
                      $this->formClass = $this->formClass ?? config('forms.form.horizontal-class', 'form-horizontal');
                  }
          Severity: Minor
          Found in src/Forms/BaseForm.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

          Function isChecked has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function isChecked($name, $value, $options)
              {
                  if (is_null($value) && isset($options['attributes']['value'])) {
                      $value = $options['attributes']['value'];
                  }
          Severity: Minor
          Found in src/Builders/FieldBuilder.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

          Avoid too many return statements within this method.
          Open

                          return $this->buildColumnForm($formBuild, 6);
          Severity: Major
          Found in src/Services/FormMaker.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return $this->buildColumnForm($formBuild, null);
            Severity: Major
            Found in src/Services/FormMaker.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return "<{$listStyle}l>{$listItems}</{$listStyle}l>";
              Severity: Major
              Found in src/Parsers/Editor.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return $this->buildColumnForm($formBuild, null, true);
                Severity: Major
                Found in src/Services/FormMaker.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return implode('', $formBuild);
                  Severity: Major
                  Found in src/Services/FormMaker.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return "<table>{$contents}</table>";
                    Severity: Major
                    Found in src/Parsers/Editor.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return '';
                      Severity: Major
                      Found in src/Builders/FieldBuilder.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return $checklist;
                        Severity: Major
                        Found in src/Parsers/Editor.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          return "<pre><code>{$code}</code></pre>";
                          Severity: Major
                          Found in src/Parsers/Editor.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                            return "<img src=\"{$file['url']}\" title=\"{$caption}\" alt=\"{$caption}\">";
                            Severity: Major
                            Found in src/Parsers/Editor.php - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language