madbob/GASdottoNG

View on GitHub

Showing 494 of 494 total issues

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

            var ret = $('<div>\
                <div class="row mb-2">\
                    <label for="day" class="col-4 col-form-label">' + _('Giorno') + '</label>\
                    <div class="col-8">\
                        <select class="form-select" name="day" value="" autocomplete="off">\
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 29..45

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

Method postCsv has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function postCsv(Request $request)
    {
        $type = $request->input('type');
        $step = $request->input('step', 'guess');

Severity: Minor
Found in code/app/Http/Controllers/ImportController.php - About 1 hr to fix

    Method postGdxp has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function postGdxp(Request $request)
        {
            // try {
                $archivepath = '';
                $working_dir = sys_get_temp_dir();
    Severity: Minor
    Found in code/app/Http/Controllers/ImportController.php - About 1 hr to fix

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

        Method show has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function show(Request $request, $id)
            {
                $user = Auth::user();
        
                $format = $request->input('format', 'html');
        Severity: Minor
        Found in code/app/Http/Controllers/ProductsController.php - About 1 hr to fix

          Method show has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function show(Request $request, $id)
              {
                  $dom_id = $request->input('dom_id', rand());
          
                  try {
          Severity: Minor
          Found in code/app/Http/Controllers/MovementsController.php - About 1 hr to fix

            Method getBookingsAttribute has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getBookingsAttribute()
                {
                    $ret = [];
            
                    foreach ($this->orders as $order) {
            Severity: Minor
            Found in code/app/Aggregate.php - About 1 hr to fix

              Method handleTable has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function handleTable($obj, $request)
                  {
                      $action = $request['action'] ?? 'download';
                      $status = $request['status'] ?? 'pending';
                      $include_missing = $request['include_missing'] ?? 'no';
              Severity: Minor
              Found in code/app/Printers/Order.php - About 1 hr to fix

                Function filterBySupplier has a Cognitive Complexity of 11 (exceeds 5 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

                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 testAccess has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function testAccess($target, $orders, $delivering)
                    {
                        $user = Auth::user();
                        $valid = false;
                
                
                Severity: Minor
                Found in code/app/Services/BookingsService.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 getConvenientStringsAttribute has a Cognitive Complexity of 11 (exceeds 5 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

                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 comparePrices has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function comparePrices($other)
                    {
                        if ($this->getPrice(false) != $other->getPrice(false)) {
                            return false;
                        }
                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 selective has a Cognitive Complexity of 11 (exceeds 5 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

                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 dispatchToSupplier has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function dispatchToSupplier($order)
                    {
                        if ($order->isRunning() == false) {
                            $supplier = $order->supplier;
                
                
                Severity: Minor
                Found in code/app/Jobs/NotifyClosedOrder.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 dynamicModifiers has a Cognitive Complexity of 11 (exceeds 5 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

                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 postStatusScaleway has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function postStatusScaleway(Request $request)
                    {
                        if (env('MAIL_MAILER') == 'scaleway') {
                            $api_endpoint = 'https://api.scaleway.com/transactional-email/v1alpha1/regions/fr-par/webhooks';
                
                
                Severity: Minor
                Found in code/app/Http/Controllers/MailController.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 saving has a Cognitive Complexity of 11 (exceeds 5 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

                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 unalignedModifiers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function unalignedModifiers($master_summary)
                    {
                        if ($this->isActive()) {
                            return [];
                        }
                Severity: Minor
                Found in code/app/Order.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 applyModifiers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function applyModifiers($aggregate_data = null, $enforce_status = false)
                    {
                        $modifiers = new Collection();
                        $order_modifiers = $this->involvedModifiers(true);
                
                
                Severity: Minor
                Found in code/app/Order.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 roleByFunction has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                function roleByFunction($identifier)
                {
                    $gas = currentAbsoluteGas();
                    $role_id = $gas->roles[$identifier] ?? null;
                    $ret = App\Role::find($role_id);
                Severity: Minor
                Found in code/app/Helpers/Permissions.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