GrafiteInc/FormMaker

View on GitHub

Showing 124 of 139 total issues

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

    public static function styles($id, $options)
    {
        $color = (Str::of(config('forms.bootstrap-version'))->startsWith('5')) ? '--bs-primary' : '--primary';

        $darkTheme = '';
Severity: Minor
Found in src/Fields/Bootstrap/DateTimePicker.php - About 1 hr to fix

    Method formSubmitHtml has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function formSubmitHtml()
        {
            $html = '';
            $onSubmit = null;
    
    
    Severity: Minor
    Found in src/Forms/HtmlForm.php - About 1 hr to fix

      Method indexHeaders has 38 lines of code (exceeds 25 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 1 hr to fix

        Method make has 38 lines of code (exceeds 25 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/WizardForm.php - About 1 hr to fix

          Method asModal has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function asModal($triggerContent = null, $triggerClass = null, $message = null, $modalTitle = null)
              {
                  $modalTitle = $modalTitle ?? $this->modalTitle;
                  $title = $modalTitle ?? 'Confirmation';
          
          
          Severity: Minor
          Found in src/Forms/Form.php - About 1 hr to fix

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

                public static function js($id, $options)
                {
                    $url = url('/');
            
                    return <<<JS
            Severity: Minor
            Found in src/Fields/Filepond.php - About 1 hr to fix

              Method makeCheckInput has 36 lines of code (exceeds 25 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

                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

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

                    public static function styles($id, $options)
                    {
                        $darkTheme = '';
                
                        if (! isset($options['theme']) || (is_bool($options['theme']) && $options['theme'])) {
                Severity: Minor
                Found in src/Fields/Dropzone.php - About 1 hr to fix

                  Method buildSection has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function buildSection($fields, $columns, $label = null)
                      {
                          $formChunks = [];
                          $newFormBuild = [];
                  
                  
                  Severity: Minor
                  Found in src/Services/FormMaker.php - About 1 hr to fix

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

                        public static function js($id, $options)
                        {
                            return <<<JS
                            _formsjs_DatepickerField = function (element) {
                                if (! element.getAttribute('data-formsjs-rendered')) {
                    Severity: Minor
                    Found in src/Fields/Datepicker.php - About 1 hr to fix

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

                        window.FormsJS_validate_submission = function (_form, _processing) {
                            if (! _form.checkValidity()) {
                                let _inputs = _form.querySelectorAll('input');
                                let _selects = _form.querySelectorAll('select');
                                let _textarea = _form.querySelectorAll('textarea');
                        Severity: Minor
                        Found in src/JavaScript/default.js - About 1 hr to fix

                          Method processOptions has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function processOptions($options)
                              {
                                  $this->customOptions = $options;
                          
                                  $this->type = $options['type'] ?? 'text';
                          Severity: Minor
                          Found in src/Services/FieldConfigProcessor.php - About 1 hr to fix

                            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

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

                                  public function make($data = [])
                                  {
                                      $this->data = $data;
                              
                                      if ($this->onKeydown) {
                              Severity: Minor
                              Found in src/Forms/LivewireForm.php - About 1 hr to fix

                                Method make has 30 lines of code (exceeds 25 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/ModalForm.php - About 1 hr to fix

                                  Function _formsjs_trigger_onclick_function has 30 lines of code (exceeds 25 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 1 hr to fix

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

                                        public function makeRelationship($name, $value, $options)
                                        {
                                            $method = 'all';
                                            $class = $options['model'];
                                    
                                    
                                    Severity: Minor
                                    Found in src/Builders/FieldBuilder.php - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language