madbob/GASdottoNG

View on GitHub

Showing 494 of 494 total issues

Function hasBrokenModifier has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function hasBrokenModifier()
    {
        if ($this->id == 'booking-payment') {
            $types = Modifier::has('movementType')->pluck('movement_type_id')->unique();
            $types = MovementType::whereIn('id', $types)->get();
Severity: Minor
Found in code/app/MovementType.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 organizeForProducts has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static function organizeForProducts(&$products_modifiers, $target_modifiers, $key): void
    {
        foreach($target_modifiers as $pmod) {
            if ($pmod->target_type == BookedProduct::class) {
                $mod_id = $pmod->modifier->modifier_type_id;
Severity: Minor
Found in code/app/ModifiedValue.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 readVariants has 35 lines of code (exceeds 25 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 1 hr to fix

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

        public function updateOrders(array $request)
        {
            $user = $this->ensureAuth(['supplier.orders' => null]);
            $suppliers = array_keys($user->targetsByAction('supplier.orders'));
    
    
    Severity: Minor
    Found in code/app/Services/DatesService.php - About 1 hr to fix

      Function content has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  content: function() {
                      var ret = '<div>\
                          <div class="row mb-2"><label for="password" class="col-4 col-form-label">' + _('Nuova Password') + '</label><div class="col-8"><input type="password" class="form-control" name="password" value="" autocomplete="off" minlength="8"></div></div>\
                          <div class="row mb-2"><label for="password_confirm" class="col-4 col-form-label">' + _('Conferma Password') + '</label><div class="col-8"><input type="password" class="form-control" name="password_confirm" value="" autocomplete="off" minlength="8"></div></div>';
      
      
      Severity: Minor
      Found in code/resources/assets/js/password.js - About 1 hr to fix

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

            private function readGdxpFile($path, $execute, $supplier_replace)
            {
                $working_dir = sys_get_temp_dir();
        
                $data = [];
        Severity: Minor
        Found in code/app/Http/Controllers/ImportController.php - About 1 hr to fix

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

              public function fastShipping($deliverer, $aggregate, $users = null)
              {
                  DB::beginTransaction();
          
                  $service = app()->make('BookingsService');
          Severity: Minor
          Found in code/app/Services/FastBookingsService.php - About 1 hr to fix

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

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

                  public function up()
                  {
                      Schema::create('orders', function (Blueprint $table) {
                          $table->string('id')->primary();
                          $table->timestamps();
              Severity: Minor
              Found in code/database/migrations/2015_11_21_011221_create_orders_table.php - About 1 hr to fix

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

                    private function roleInit($gas)
                    {
                        $queue = systemParameters('Roles');
                
                        while(true) {
                Severity: Minor
                Found in code/database/seeders/DatabaseSeeder.php - About 1 hr to fix

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

                      public function dynamicModifiers(array $request, $aggregate, $target_user)
                      {
                          /*
                              Innanzitutto, qui sospendo l'esecuzione delle callback sui movimenti
                              contabili. Nella fase di revisione della prenotazione capita che i
                  Severity: Minor
                  Found in code/app/Services/DynamicBookingsService.php - About 1 hr to fix

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

                        private function initCollectionMacros()
                        {
                            /*
                                Questa va usata solo per una Collection di BookedProductVariant,
                                come ad esempio la relazione variants() di BookedProduct
                    Severity: Minor
                    Found in code/app/Providers/AppServiceProvider.php - About 1 hr to fix

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

                          private function getSupplier($start, $end, $type, $target, $supplier)
                          {
                              $data = [];
                              $categories = [];
                      
                      
                      Severity: Minor
                      Found in code/app/Http/Controllers/StatisticsController.php - About 1 hr to fix

                        Method closeBalance has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function closeBalance($request)
                            {
                                $this->ensureAuth(['movements.admin' => 'gas']);
                                $hub = App::make('MovementsHub');
                        
                        
                        Severity: Minor
                        Found in code/app/Services/MovementsService.php - About 1 hr to fix

                          Method distributionLabels has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private static function distributionLabels()
                              {
                                  $currency = defaultCurrency()->symbol;
                          
                                  return [
                          Severity: Minor
                          Found in code/app/View/Texts/Modifier.php - About 1 hr to fix

                            Method columnsByType has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private static function columnsByType($ret, $type)
                                {
                                    if ($type == 'export' || $type == 'all') {
                                        $ret['last_login'] = (object) [
                                            'name' => _i('Ultimo Accesso'),
                            Severity: Minor
                            Found in code/app/Formatters/User.php - About 1 hr to fix

                              Method iban_split has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function iban_split($iban, $field)
                              {
                                  switch($field) {
                                      case 'country':
                                          $start = 0;
                              Severity: Minor
                              Found in code/app/Helpers/Formatters.php - About 1 hr to fix

                                Method otherFields has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    private function otherFields(&$ret)
                                    {
                                        $ret['birthplace'] = (object) [
                                            'label' => _i('Luogo di Nascita'),
                                        ];
                                Severity: Minor
                                Found in code/app/Importers/CSV/Users.php - About 1 hr to fix

                                  Method up has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function up()
                                      {
                                          Schema::create('suppliers', function (Blueprint $table) {
                                              $table->string('id')->primary();
                                              $table->timestamps();

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

                                                var ret = $('<div>\
                                                    <div class="row mb-2">\
                                                        <label for="street" class="col-4 col-form-label">' + _('Indirizzo') + '</label>\
                                                        <div class="col-8"><input type="text" class="form-control" name="street" value="" autocomplete="off"></div>\
                                                    </div>\
                                    Severity: Major
                                    Found in code/resources/assets/js/popovers.js and 1 other location - About 1 hr to fix
                                    code/resources/assets/js/popovers.js on lines 93..102

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

                                    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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language