madbob/GASdottoNG

View on GitHub

Showing 501 of 501 total issues

Avoid too many return statements within this method.
Open

                    return $product->pivot->notes;
Severity: Major
Found in code/app/Formatters/Order.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return output_csv($filename, $data->headers, $flat_contents, function($row) {
                    return $row;
                });
    Severity: Major
    Found in code/app/Printers/Aggregate.php - About 30 mins to fix

      Function saveValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          private function saveValue($modifier, $obj_mod_target, $altered_amount)
          {
              $modifier_value = $this->retrieveExistingValue($modifier, $obj_mod_target);
      
              /*
      Severity: Minor
      Found in code/app/Singletons/ModifierEngine.php - About 25 mins 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 creditHistory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function creditHistory($class, $date)
          {
              $currencies = Currency::enabled();
              $balances = Balance::whereDate('date', $date)->where('target_type', $class)->get();
              $ret = [];
      Severity: Minor
      Found in code/app/Services/MovementsService.php - About 25 mins 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 fastShipping has a Cognitive Complexity of 6 (exceeds 5 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 25 mins 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 enforceMeasureDiscrete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function enforceMeasureDiscrete(node) {
          var form = node.closest('form');
          var selected = node.find('option:selected').val();
          var discrete = measure_discrete[selected];
          var disabled = (discrete == '1');
      Severity: Minor
      Found in code/resources/assets/js/gasdotto.js - About 25 mins 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 evaluateEmptyBooking has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          static evaluateEmptyBooking(form) {
              if (form.find('input:hidden[name=action]').val() == 'shipped') {
                  var test = false;
      
                  form.find('.booking-total').each(function() {
      Severity: Minor
      Found in code/resources/assets/js/callables.js - About 25 mins 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 dispatchToReferents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          private function dispatchToReferents($notifiable_users)
          {
              foreach($notifiable_users as $notifiable) {
                  if ($notifiable->user->gas->auto_referent_order_summary) {
                      try {
      Severity: Minor
      Found in code/app/Jobs/NotifyClosedOrder.php - About 25 mins 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 revisioned has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function revisioned($id, $approved)
          {
              DB::beginTransaction();
      
              $user = $this->show($id);
      Severity: Minor
      Found in code/app/Services/UsersService.php - About 25 mins 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 attachUser has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function attachUser($user_id, $role_id, $target)
          {
              $this->checkAccessToRole($role_id);
              $r = Role::findOrFail($role_id);
              $u = User::tFind($user_id, true);
      Severity: Minor
      Found in code/app/Services/RolesService.php - About 25 mins 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 testInternalFunctionsAccess has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          private function testInternalFunctionsAccess($requester, $target, $type)
          {
              $admin_editable = $requester->can('users.admin', $target->gas);
              $access = ($admin_editable || $requester->id == $target->id || $target->parent_id == $requester->id);
      
      
      Severity: Minor
      Found in code/app/Http/Controllers/UsersController.php - About 25 mins 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 getPrintableUpdaterAttribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getPrintableUpdaterAttribute()
          {
              $last_update = null;
              $last_updater = null;
      
      
      Severity: Minor
      Found in code/app/AggregateBooking.php - About 25 mins 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 destroy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function destroy($id)
          {
              $product = DB::transaction(function() use ($id) {
                  $product = $this->show($id);
                  $this->ensureAuth(['supplier.modify' => $product->supplier]);
      Severity: Minor
      Found in code/app/Services/ProductsService.php - About 25 mins 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 queryMovements has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function queryMovements($query = null, $type = 'all')
          {
              if (is_null($query)) {
                  $query = Movement::orderBy('created_at', 'desc');
              }
      Severity: Minor
      Found in code/app/Supplier.php - About 25 mins 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 fixVoidMethods has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          private function fixVoidMethods(&$data, $request)
          {
              $payments = paymentTypes();
      
              foreach(array_keys($payments) as $pay_id) {
      Severity: Minor
      Found in code/app/Services/MovementTypesService.php - About 25 mins 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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function create(Request $request)
          {
              $type = $request->input('type', null);
              if (is_null($type)) {
                  return view('movement.create');
      Severity: Minor
      Found in code/app/Http/Controllers/MovementsController.php - About 25 mins 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 formatObjectsToComponentRec has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function formatObjectsToComponentRec($options)
      {
          $ret = [];
      
          foreach($options as $option) {
      Severity: Minor
      Found in code/app/Helpers/Components.php - About 25 mins 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 decodePeriodic has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function decodePeriodic($value)
      {
          if (empty($value))
              return '';
      
      
      Severity: Minor
      Found in code/app/Helpers/Dates.php - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function handle()
          {
              $today = date('Y-m-d');
      
              foreach(Gas::all() as $gas) {
      Severity: Minor
      Found in code/app/Console/Commands/CheckFees.php - About 25 mins 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 readDate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function readDate($date)
      {
          if (preg_match('/\d{1,2}\/\d{1,2}\/\d{1,4}/', $date) == 1) {
              list($day, $month, $year) = explode('/', $date);
              if ($year < 1000)
      Severity: Minor
      Found in code/app/Helpers/Dates.php - About 25 mins 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