madbob/GASdottoNG

View on GitHub

Showing 494 of 494 total issues

Function generalInit has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function generalInit(container) {
    if (container == null) {
        container = $('body');
    }

Severity: Major
Found in code/resources/assets/js/gasdotto.js - About 2 hrs to fix

    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 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 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 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/TourController.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

          UsersController has 25 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class UsersController extends BackedController
          {
              public function __construct(UsersService $service)
              {
                  $this->commonInit([
          Severity: Minor
          Found in code/app/Http/Controllers/UsersController.php - About 2 hrs to fix

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

                public static function commons($user)
                {
                    return [
                        'clock' => (object) [
                            'test' => function ($obj) {
            Severity: Major
            Found in code/app/View/Icons/Booking.php and 1 other location - About 2 hrs to fix
            code/app/View/Icons/AggregateBooking.php on lines 7..29

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

            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

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

                public static function commons($user)
                {
                    return [
                        'clock' => (object) [
                            'test' => function ($obj) {
            Severity: Major
            Found in code/app/View/Icons/AggregateBooking.php and 1 other location - About 2 hrs to fix
            code/app/View/Icons/Booking.php on lines 7..29

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

            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

            File BookedProduct.php has 284 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 list has 69 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

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

                    private function parseRules(&$data, $role, $classname, $request)
                    {
                        $payments = paymentTypes();
                        $valid_payments = array_intersect_key($request, $payments);
                        $fields = (new $classname())->balanceFields();
                Severity: Minor
                Found in code/app/Services/MovementTypesService.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 registerPolicies has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function registerPolicies()
                    {
                        $all_permissions = allPermissions();
                
                        foreach ($all_permissions as $rules) {
                Severity: Minor
                Found in code/app/Services/RolesService.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 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 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

                Severity
                Category
                Status
                Source
                Language