madbob/GASdottoNG

View on GitHub

Showing 495 of 495 total issues

File Aggregate.php has 405 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
Severity: Minor
Found in code/app/Aggregate.php - About 5 hrs to fix

    File MovementsController.php has 393 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/MovementsController.php - About 5 hrs to fix

      File bookings.js has 392 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import utils from "./utils";
      import Modifiers from "./modifiers";
      
      class Bookings
      {
      Severity: Minor
      Found in code/resources/assets/js/bookings.js - About 5 hrs to fix

        Function miscInnerCallbacks has 121 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function miscInnerCallbacks(form, data) {
            if (locker == true) {
                return false;
            }
        
        
        Severity: Major
        Found in code/resources/assets/js/gasdotto.js - About 4 hrs to fix

          Function importXML has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function importXML($xml, $replace, $supplier_id)
              {
                  if (is_null($replace)) {
                      $product = new Product();
                      $product->supplier_id = $supplier_id;
          Severity: Minor
          Found in code/app/Importers/GDXP/Products.php - About 4 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 handleSummary has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function handleSummary($obj, $request)
              {
                  $action = $request['action'] ?? 'download';
                  $subtype = $request['format'] ?? 'pdf';
                  $extra_modifiers = $request['extra_modifiers'] ?? 0;
          Severity: Minor
          Found in code/app/Printers/Order.php - About 4 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 run has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              public function run()
              {
                  $gas = Gas::where('name', '!=', '')->first();
          
                  $gas->name = 'GAS Demo';
          Severity: Minor
          Found in code/database/seeders/DemoSeeder.php - About 4 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 UsersController.php has 334 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 4 hrs to fix

            Function dynamictree has 99 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                $.fn.dynamictree = function() {
                    $(this).each(function() {
                        $(this).find('.dynamic-tree').sortable({
                            items: 'li',
                            connectWith: '.dynamic-tree ul',
            Severity: Major
            Found in code/resources/assets/js/jquery.dynamictree.js - About 3 hrs to fix

              Method select has 98 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function select($request)
                  {
                      $user = Auth::user();
                      $service = app()->make('BookingsService');
                      $errors = [];
              Severity: Major
              Found in code/app/Importers/CSV/Deliveries.php - About 3 hrs to fix

                Method apply has 97 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function apply($modifier, $booking, $aggregate_data)
                    {
                        if ($modifier->active == false) {
                            Log::debug('Modificatore non attivo, ignoro applicazione');
                            return null;
                Severity: Major
                Found in code/app/Singletons/ModifierEngine.php - About 3 hrs to fix

                  Method document has 97 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function document(Request $request, $type, $subtype = 'none')
                      {
                          $user = $this->checkAuth();
                  
                          switch ($type) {
                  Severity: Major
                  Found in code/app/Http/Controllers/MovementsController.php - About 3 hrs to fix

                    Function handleShipping has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function handleShipping($obj, $request)
                        {
                            $action = $request['action'] ?? 'download';
                            $subtype = $request['format'] ?? 'pdf';
                            $status = $request['status'] ?? 'pending';
                    Severity: Minor
                    Found in code/app/Printers/Order.php - About 3 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 serializeTransformations has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                    Open

                        function serializeTransformations($target, $json_target)
                        {
                            $transformations = [];
                            $modifiers = $target->modifiers->filter(fn($m) => $m->active && in_array($m->modifierType->identifier, ['shipping', 'discount']));
                    
                    
                    Severity: Minor
                    Found in code/resources/views/gdxp/json/supplier.blade.php - About 3 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 importXML has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function importXML($xml, $replace)
                        {
                            if (is_null($replace)) {
                                $supplier = new Supplier();
                                $supplier->payment_method = '';
                    Severity: Minor
                    Found in code/app/Importers/GDXP/Suppliers.php - About 3 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

                    Method select has 93 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function select($request)
                        {
                            list($reader, $columns) = $this->initRead($request);
                            $target_separator = ',';
                    
                    
                    Severity: Major
                    Found in code/app/Importers/CSV/Movements.php - About 3 hrs to fix

                      Function unrollPeriodic has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function unrollPeriodic($value)
                      {
                          if (!isset($value->from) || !isset($value->to)) {
                              return [];
                          }
                      Severity: Minor
                      Found in code/app/Helpers/Dates.php - About 3 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 output_csv has a Cognitive Complexity of 25 (exceeds 5 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 3 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

                      Method run has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function run($request)
                          {
                              DB::beginTransaction();
                      
                              list($reader, $columns) = $this->initRead($request);
                      Severity: Major
                      Found in code/app/Importers/CSV/Users.php - About 3 hrs to fix

                        Method select has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function select($request)
                            {
                                list($reader, $columns) = $this->initRead($request);
                                list($name_index, $supplier_code_index) = $this->getColumnsIndex($columns, ['name', 'supplier_code']);
                                $s = $this->getSupplier($request);
                        Severity: Major
                        Found in code/app/Importers/CSV/Products.php - About 3 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language