GrafiteInc/FormMaker

View on GitHub

Showing 139 of 139 total issues

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

    public static function styles($id, $options)
    {
        return <<<CSS
@media (prefers-color-scheme: dark) {
    .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
Severity: Minor
Found in src/Fields/Bootstrap/Select2.php - About 1 hr to fix

    Method delete has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function delete($model = null)
        {
            if (! is_null($model)) {
                $this->setInstance($model);
            }
    Severity: Minor
    Found in src/Forms/ModelForm.php - About 1 hr to fix

      Method __construct has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __construct()
          {
              parent::__construct();
      
              $this->url = app(UrlGenerator::class);
      Severity: Minor
      Found in src/Forms/HtmlForm.php - About 1 hr to fix

        Method make has 44 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/BaseForm.php - About 1 hr to fix

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

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

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

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

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

              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 static function styles($id, $options)
                  {
                      $darkTheme = '';
              
                      if (! isset($options['theme']) || (is_bool($options['theme']) && $options['theme'])) {
              Severity: Major
              Found in src/Fields/Quill.php and 1 other location - About 1 hr to fix
              src/Fields/Dropzone.php on lines 53..96

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

              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

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

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