madbob/GASdottoNG

View on GitHub

Showing 494 of 494 total issues

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

    static init(container)
    {
        $('.dates-for-orders', container).each((index, item) => {
            /*
                Questo è per fare in modo che le date siano sempre coerenti tra
Severity: Minor
Found in code/resources/assets/js/orders.js - About 1 hr to fix

    Method index has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function index(Request $request)
        {
            try {
                $data['movements'] = $this->service->list($request->all());
                $ret = null;
    Severity: Minor
    Found in code/app/Http/Controllers/MovementsController.php - About 1 hr to fix

      Method store has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function store(Request $request)
          {
              DB::beginTransaction();
      
              $data = $request->input('data');
      Severity: Minor
      Found in code/app/Http/Controllers/AggregatesController.php - About 1 hr to fix

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

            public function up()
            {
                Schema::table('roles', function (Blueprint $table) {
                    $table->string('identifier')->default('');
                    $table->boolean('system')->default(false);
        Severity: Minor
        Found in code/database/migrations/2022_12_01_181229_advanced_roles.php - About 1 hr to fix

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

              public function run($request)
              {
                  $user = Auth::user();
                  $service = app()->make('BookingsService');
          
          
          Severity: Minor
          Found in code/app/Importers/CSV/Deliveries.php - About 1 hr to fix

            Method filterBySupplier has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function filterBySupplier($supplier, $user, $query, $own)
                {
                    $type = 'all';
            
                    if ($supplier) {
            Severity: Minor
            Found in code/app/Services/MovementsService.php - About 1 hr to fix

              Method handle has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function handle()
                  {
                      $hub = app()->make('GlobalScopeHub');
                      $gas = $hub->getGasObj();
              
              
              Severity: Minor
              Found in code/app/Jobs/NotifyRemindOrder.php - About 1 hr to fix

                Method selective has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function selective()
                    {
                        if (currentAbsoluteGas()->hasFeature('shipping_places')) {
                            return [
                                'truck' => (object) [
                Severity: Minor
                Found in code/app/View/Icons/AggregateBooking.php - About 1 hr to fix

                  Function updateBookingModifiers has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      static updateBookingModifiers(dynamic_modifiers, container)
                      {
                          $('input[name^="modifier-"]', container).each(function() {
                              let modid = parseInt($(this).attr('name').split('-')[1]);
                              if (modid == 0) {
                  Severity: Minor
                  Found in code/resources/assets/js/modifiers.js - About 1 hr to fix

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

                      Method getConvenientStringsAttribute has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getConvenientStringsAttribute()
                          {
                              $suppliers = [];
                              $shipping_date = PHP_INT_MAX;
                      
                      
                      Severity: Minor
                      Found in code/app/AggregateBooking.php - About 1 hr to fix

                        Function completionRowsInit has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function completionRowsInit(node) {
                            $(node).find('input:text').each(function() {
                                if ($(this).hasClass('ui-autocomplete-input') == true) {
                                    return;
                                }
                        Severity: Minor
                        Found in code/resources/assets/js/gasdotto.js - About 1 hr to fix

                          Method saving has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function saving(Movement $movement)
                              {
                                  if ($this->movements_hub->isSuspended()) {
                                      return true;
                                  }
                          Severity: Minor
                          Found in code/app/Observers/MovementObserver.php - About 1 hr to fix

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

                                public function update(Request $request, $id)
                                {
                                    DB::beginTransaction();
                            
                                    $user = Auth::user();
                            Severity: Minor
                            Found in code/app/Http/Controllers/MeasuresController.php - About 1 hr to fix

                              Method retrievePreSelectedFields has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private function retrievePreSelectedFields($parameters)
                                  {
                                      $selected = [];
                              
                                      if (isset($parameters['sorted_fields']) && empty($parameters['sorted_fields']) == false) {
                              Severity: Minor
                              Found in code/app/Importers/CSV/CSVImporter.php - About 1 hr to fix

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

                                        $('.table-number-filters input.table-number-filter', container).keyup((e) => {
                                            this.tableFilters($(e.currentTarget).closest('.table-number-filters').attr('data-table-target'));
                                        });
                                Severity: Major
                                Found in code/resources/assets/js/filters.js and 1 other location - About 1 hr to fix
                                code/resources/assets/js/filters.js on lines 32..34

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

                                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

                                        $('.table-filters input:radio', container).change((e) => {
                                            this.tableFilters($(e.currentTarget).closest('.table-filters').attr('data-table-target'));
                                        });
                                Severity: Major
                                Found in code/resources/assets/js/filters.js and 1 other location - About 1 hr to fix
                                code/resources/assets/js/filters.js on lines 24..26

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

                                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

                                Function applyDefinition has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private function applyDefinition($booking, $modifier, $amount, $definition, $target)
                                    {
                                        list($quantity_attribute, $price_attribute, $weight_attribute) = $this->applicationOffsets($booking);
                                        $reference_quantity = 1;
                                
                                
                                Severity: Minor
                                Found in code/app/Singletons/ModifierEngine.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 hasWarningWithinOrder has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function hasWarningWithinOrder($summary)
                                    {
                                        if (isset($summary->products[$this->id])) {
                                            $quantity = $summary->products[$this->id]->quantity;
                                
                                
                                Severity: Minor
                                Found in code/app/Product.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 postFeedback has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function postFeedback(Request $request, $id)
                                    {
                                        $ret = [];
                                
                                        if ($id == 'booking-payment') {
                                Severity: Minor
                                Found in code/app/Http/Controllers/MovementTypesController.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

                                Severity
                                Category
                                Status
                                Source
                                Language