madbob/GASdottoNG

View on GitHub

Showing 437 of 494 total issues

File ModifierEngine.php has 260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace App\Singletons;

use Illuminate\Support\Facades\Log;
Severity: Minor
Found in code/app/Singletons/ModifierEngine.php - About 2 hrs to fix

    Function iconsLegendTrigger has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        static iconsLegendTrigger(node, legend_class)
        {
            /*
                Se clicco l'intestazione di un dropdown, passo oltre. Qui interviene
                il JS di Bootstrap per aprire e chiudere il dropdown stesso
    Severity: Major
    Found in code/resources/assets/js/filters.js - About 2 hrs to fix

      Method handleShipping has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function handleShipping($obj, $request)
          {
              $action = $request['action'] ?? 'download';
              $subtype = $request['format'] ?? 'pdf';
              $status = $request['status'] ?? 'pending';
      Severity: Major
      Found in code/app/Printers/Order.php - About 2 hrs to fix

        File Products.php has 258 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace App\Importers\CSV;
        
        use DB;
        Severity: Minor
        Found in code/app/Importers/CSV/Products.php - About 2 hrs to fix

          File summary.blade.php has 257 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          $summary = $master_summary->orders[$order->id];
          
          $columns = $currentgas->orders_display_columns;
          Severity: Minor
          Found in code/resources/views/order/summary.blade.php - About 2 hrs to fix

            Method handleSummary has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function handleSummary($obj, $request)
                {
                    $action = $request['action'] ?? 'download';
                    $subtype = $request['format'] ?? 'pdf';
                    $extra_modifiers = $request['extra_modifiers'] ?? 0;
            Severity: Major
            Found in code/app/Printers/Order.php - About 2 hrs to fix

              Function targetDefinition has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function targetDefinition($modifier, $value)
                  {
                      if ($modifier->scale == 'minor') {
                          foreach($modifier->definitions as $def) {
                              if ($value < $def->threshold) {
              Severity: Minor
              Found in code/app/Singletons/ModifierEngine.php - About 2 hrs 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 getBookingsAttribute has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getBookingsAttribute()
                  {
                      $ret = [];
              
                      foreach ($this->orders as $order) {
              Severity: Minor
              Found in code/app/Aggregate.php - About 2 hrs 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

              File widgets.js has 252 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require('bootstrap-datepicker');
              require('select2');
              
              import utils from "./utils";
              
              
              Severity: Minor
              Found in code/resources/assets/js/widgets.js - About 2 hrs to fix

                Function updateBookingQuantities has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    static updateBookingQuantities(dynamic_data, container, action)
                    {
                        for (let [product_id, product_meta] of Object.entries(dynamic_data)) {
                            var inputbox = $('input[name="' + product_id + '"]', container);
                            inputbox.closest('tr').find('.booking-product-price span').text(utils.priceRound(product_meta.total));
                Severity: Major
                Found in code/resources/assets/js/bookings.js - About 2 hrs to fix

                  File UsersController.php has 251 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  namespace App\Http\Controllers;
                  
                  use Illuminate\Http\Request;
                  Severity: Minor
                  Found in code/app/Http/Controllers/UsersController.php - About 2 hrs to fix

                    Method formattableColumns has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function formattableColumns($type = null)
                        {
                            $ret = [
                                'name' => (object) [
                                    'name' => _i('Nome Prodotto'),
                    Severity: Minor
                    Found in code/app/Formatters/Order.php - About 2 hrs to fix

                      Method displayColumns has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function displayColumns()
                          {
                              $ret = [];
                      
                              $gas = currentAbsoluteGas();
                      Severity: Minor
                      Found in code/app/Product.php - About 1 hr to fix

                        Function init has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            static init(container)
                            {
                                $('.triggers-all-checkbox', container).change(function() {
                                    $(this).prop('disabled', true);
                        
                        
                        Severity: Minor
                        Found in code/resources/assets/js/triggers.js - About 1 hr to fix

                          Method formatShipping has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function formatShipping($order, $fields, $status, $shipping_place, $extra_modifiers)
                              {
                                  $ret = (object) [
                                      'headers' => $fields->headers,
                                      'contents' => [],
                          Severity: Minor
                          Found in code/app/Printers/Concerns/Shipping.php - About 1 hr to fix

                            Method update has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function update($id, array $request)
                                {
                                    $modifier = $this->show($id);
                                    $this->testAccess($modifier);
                            
                            
                            Severity: Minor
                            Found in code/app/Services/ModifiersService.php - About 1 hr to fix

                              Method output_csv has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function output_csv($filename, $head, $contents, $format_callback, $out_file = null)
                              {
                                  $callback = function() use ($head, $contents, $format_callback, $out_file) {
                                      $csv_separator = currentAbsoluteGas()->getConfig('csv_separator');
                              
                              
                              Severity: Minor
                              Found in code/app/Helpers/Formatters.php - About 1 hr to fix

                                Function updateContacts has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function updateContacts($request)
                                    {
                                        $ids = [];
                                        $types = [];
                                        $values = [];
                                Severity: Minor
                                Found in code/app/Models/Concerns/ContactableTrait.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 initOnce has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    static initOnce()
                                    {
                                        $('body').on('click', '.order-summary .toggle-product-abilitation', function() {
                                            $('.order-summary tr.product-disabled').toggle();
                                        })
                                Severity: Minor
                                Found in code/resources/assets/js/orders.js - About 1 hr to fix

                                  Function bookingTotal has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      static bookingTotal(editor) {
                                          var form = $(editor).closest('form');
                                          var data = this.serializeBooking(form);
                                          var url = form.attr('data-dynamic-url');
                                  
                                  
                                  Severity: Minor
                                  Found in code/resources/assets/js/bookings.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language