GrafiteInc/FormMaker

View on GitHub

Showing 139 of 139 total issues

Method styles has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function styles($id, $options)
    {
        return <<<CSS
.form-autocomplete {
    position: relative;
Severity: Minor
Found in src/Fields/AutoSuggest.php - About 1 hr to fix

    Method styles has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function styles($id, $options)
        {
            return <<<CSS
    .form-autocomplete {
        position: relative;
    Severity: Minor
    Found in src/Fields/AutoSuggestSelect.php - About 1 hr to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          public function makeRadio($name, $value, $options)
          {
              $checked = $this->isChecked($name, $value, $options);
              $attributes = $this->attributeBuilder->render($options['attributes'], $name, $this->withLivewire, $this->livewireOnKeydown, $this->livewireOnChange);
      
      
      Severity: Minor
      Found in src/Builders/FieldBuilder.php and 1 other location - About 55 mins to fix
      src/Builders/FieldBuilder.php on lines 379..385

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 99.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          public function makeCheckbox($name, $value, $options)
          {
              $checked = $this->isChecked($name, $value, $options);
              $attributes = $this->attributeBuilder->render($options['attributes'], $name, $this->withLivewire, $this->livewireOnKeydown, $this->livewireOnChange);
      
      
      Severity: Minor
      Found in src/Builders/FieldBuilder.php and 1 other location - About 55 mins to fix
      src/Builders/FieldBuilder.php on lines 396..402

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 99.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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

      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 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 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 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

      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 styles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function styles()
            {
                $color = $this->progressBarColor ?? '#28a745';
                $numberOfSteps = count($this->steps($this->fieldsForSteps));
                $size = $numberOfSteps * 100;
        Severity: Minor
        Found in src/Forms/WizardForm.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 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 handler has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function handler($content)
            {
                $convertor = new HtmlConvertor([
                    'raw' => function ($html) {
                        return $html;
        Severity: Minor
        Found in src/Parsers/Editor.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 buildColumnForm has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            private function buildColumnForm($formBuild, $columns, $isStepped = false)
            {
                $formSections = [];
        
                if (! empty($this->sections)) {
        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 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

        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
              Severity
              Category
              Status
              Source
              Language