madbob/GASdottoNG

View on GitHub

Showing 441 of 501 total issues

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

    protected function handleShipping($obj, $request)
    {
        $subtype = $request['format'] ?? 'pdf';
        $required_fields = $request['fields'] ?? [];

Severity: Major
Found in code/app/Printers/Aggregate.php - About 2 hrs to fix

    Function descriptions has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function descriptions($target)
        {
            /*
                Qui predispongo le stringhe descrittive per tutte le possibili
                combinazioni di valori, destinate a rendere più comprensibile la
    Severity: Minor
    Found in code/app/View/Texts/Modifier.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 handlePreProcess has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function handlePreProcess($request, $booking)
        {
            $manual_total = $this->deliveringManualTotal($request, $booking->order);
            if ($manual_total > 0) {
                $booking->enforceTotal($manual_total);
    Severity: Minor
    Found in code/app/Services/BookingsService.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 postFeedback has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function postFeedback(Request $request, $id)
        {
            $ret = [];
            $aggregate = Aggregate::findOrFail($id);
            $master_summary = null;
    Severity: Minor
    Found in code/app/Http/Controllers/AggregatesController.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 compareBalances has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function compareBalances($old_balances)
        {
            $diff = [];
    
            foreach($old_balances as $currency_id => $data) {
    Severity: Minor
    Found in code/app/Models/Concerns/CreditableTrait.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

    Method startTour has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function startTour(Request $request)
        {
            $user = $request->user();
            $gas = $user->gas;
    
    
    Severity: Major
    Found in code/app/Http/Controllers/UsersController.php - About 2 hrs to fix

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

      <?php
      
      $more_orders = ($aggregate->orders->count() > 1);
      $handling_movements = someoneCan('movements.admin', $currentgas);
      $tot_amount = 0;
      Severity: Minor
      Found in code/resources/views/delivery/edit.blade.php - About 2 hrs to fix

        Function setupPermissionsEditor has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            static setupPermissionsEditor(container) {
                $('.roleAssign', container).each(function() {
                    if ($(this).hasClass('tt-hint') == true) {
                        return;
                    }
        Severity: Major
        Found in code/resources/assets/js/roles.js - About 2 hrs to fix

          Function update has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              public function update($id, array $request)
              {
                  if ($id == 0) {
                      $user = $this->ensureAuth(['supplier.orders' => null]);
                      $suppliers = array_keys($user->targetsByAction('supplier.orders'));
          Severity: Minor
          Found in code/app/Services/DatesService.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 readVariants has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              private function readVariants($product, $booked, $values, $quantities, $delivering)
              {
                  $param = $this->handlingParam($delivering);
                  $quantity = 0;
                  $saved_variants = [];
          Severity: Minor
          Found in code/app/Services/BookingsService.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 productByString has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

          function productByString($string, $products = null)
          {
              if (is_null($products)) {
                  $products = App\Product::all();
              }
          Severity: Minor
          Found in code/app/Helpers/Reflection.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 handle has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              public function handle()
              {
                  $orders = Order::where('status', 'open')->where('end', '>', Carbon::today()->format('Y-m-d'))->get();
                  $notifications = [];
          
          
          Severity: Minor
          Found in code/app/Console/Commands/RemindOrders.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 hasChangedProdcts has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              public function hasChangedProdcts()
              {
                  $has_changed_products = false;
          
                  if ($this->isActive()) {
          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 UsersService.php has 280 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          namespace App\Services;
          
          use App\Exceptions\AuthException;
          Severity: Minor
          Found in code/app/Services/UsersService.php - About 2 hrs to fix

            Method minimumRedux has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function minimumRedux($modifiers)
                {
                    if ($modifiers->isEmpty()) {
                        return [];
                    }
            Severity: Major
            Found in code/app/Models/Concerns/ReducibleTrait.php - About 2 hrs to fix

              Product has 24 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Product extends Model
              {
                  use HasFactory, SoftDeletes, ProductConcept, TracksUpdater, Priceable, ModifiableTrait, GASModel, SluggableID, Cachable;
              
                  public $incrementing = false;
              Severity: Minor
              Found in code/app/Product.php - About 2 hrs to fix

                Method importXML has 66 lines of code (exceeds 25 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: Major
                Found in code/app/Importers/GDXP/Products.php - About 2 hrs to fix

                  Method list has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function list($request)
                      {
                          /*
                              TODO sarebbe assai più efficiente usare with('sender') e
                              with('target'), ma poi la relazione in Movement si spacca (cambiando
                  Severity: Major
                  Found in code/app/Services/MovementsService.php - About 2 hrs to fix

                    File BookedProduct.php has 275 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    namespace App;
                    
                    use Illuminate\Database\Eloquent\Model;
                    Severity: Minor
                    Found in code/app/BookedProduct.php - About 2 hrs to fix

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

                          public function run($request)
                          {
                              DB::beginTransaction();
                      
                              $direct_fields = ['name', 'weight', 'description', 'price', 'supplier_code', 'package_size', 'min_quantity', 'multiple', 'portion_quantity'];
                      Severity: Major
                      Found in code/app/Importers/CSV/Products.php - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language