GrafiteInc/FormMaker

View on GitHub

Showing 124 of 139 total issues

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 _formsjs_set_bindings has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    window._formsjs_set_bindings = function () {
        document.querySelectorAll('[data-formsjs-onload]').forEach(function (element) {
            if (! element.hasAttribute('data-formsjs-rendered')) {
                let _method = element.getAttribute('data-formsjs-onload');
                    window[_method](element);
    Severity: Minor
    Found in src/JavaScript/core.js - 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

      Method boot has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function boot()
          {
              $this->publishes([
                  __DIR__ . '/../config/forms.php' => base_path('config/forms.php'),
              ]);
      Severity: Minor
      Found in src/FormsProvider.php - About 1 hr to fix

        Function FormsJS_validation has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        window.FormsJS_validation = function () {
            let _fields = document.getElementsByClassName('_formValidationClass');
        
            for (let i = 0; i < _fields.length; i++) {
                _fields[i].addEventListener("keyup", function (e) {
        Severity: Minor
        Found in src/JavaScript/validation.js - About 1 hr to fix

          Method js has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function js($id, $options)
              {
                  return <<<JS
                  _formsjs_datetimePickerField = function (element) {
                      if (! element.getAttribute('data-formsjs-rendered')) {
          Severity: Minor
          Found in src/Fields/Bootstrap/DateTimePicker.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

              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

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

                  Severity
                  Category
                  Status
                  Source
                  Language