ArthurGuy/BBMembershipSystem

View on GitHub

Showing 174 of 174 total issues

Function processBills has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    private function processBills($action, array $bills)
    {
        foreach ($bills as $bill) {
            $existingPayment = $this->paymentRepository->getPaymentBySourceId($bill['id']);
            if ($existingPayment) {
Severity: Minor
Found in app/Http/Controllers/GoCardlessWebhookController.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

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

                    <ReactBootstrap.Input type='text' label='Description' help={this.validationMessage('description')} placeholder='New saw blades' value={this.state.description} onChange={this.handleChange('description')} bsStyle={this.fieldStyle('description')} />
Severity: Major
Found in resources/assets/js/components/expenses/NewExpenseModal.js and 1 other location - About 2 hrs to fix
resources/assets/js/components/expenses/NewExpenseModal.js on lines 147..147

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

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

                    <ReactBootstrap.Input type='text' label='Amount' help={this.validationMessage('amount')} placeholder='4.99' value={this.state.amount} onChange={this.handleChange('amount')} bsStyle={this.fieldStyle('amount')} />
Severity: Major
Found in resources/assets/js/components/expenses/NewExpenseModal.js and 1 other location - About 2 hrs to fix
resources/assets/js/components/expenses/NewExpenseModal.js on lines 145..145

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

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 AccountController.php has 269 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php namespace BB\Http\Controllers;


use BB\Entities\Notification;
use BB\Entities\User;
Severity: Minor
Found in app/Http/Controllers/AccountController.php - About 2 hrs to fix

    Method adminUpdate has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function adminUpdate($id)
        {
            $user = User::findWithPermission($id);
    
            $madeTrusted = false;
    Severity: Major
    Found in app/Http/Controllers/AccountController.php - About 2 hrs to fix

      Function index has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public function index()
          {
              $users = $this->userRepository->getActive();
              $paymentMethodsNumbers = [
                  'gocardless'            => 0,
      Severity: Minor
      Found in app/Http/Controllers/StatsController.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 receive has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public function receive()
          {
              $request = \Request::instance();
              $webhookData = $request->getContent();
              $signature = $request->header('Webhook-Signature');
      Severity: Minor
      Found in app/Http/Controllers/GoCardlessWebhookController.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 receive has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function receive()
          {
              $request = \Request::instance();
              $webhookData = $request->getContent();
              $signature = $request->header('Webhook-Signature');
      Severity: Major
      Found in app/Http/Controllers/GoCardlessWebhookController.php - About 2 hrs to fix

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

        <?php
        
        namespace BB\Listeners;
        
        use BB\Events\ExpenseWasDeclined;
        Severity: Major
        Found in app/Listeners/EmailMemberAboutDeclinedExpense.php and 1 other location - About 2 hrs to fix
        app/Listeners/EmailMemberAboutApprovedExpense.php on lines 1..40

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

        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

        <?php
        
        namespace BB\Listeners;
        
        use BB\Events\ExpenseWasApproved;
        Severity: Major
        Found in app/Listeners/EmailMemberAboutApprovedExpense.php and 1 other location - About 2 hrs to fix
        app/Listeners/EmailMemberAboutDeclinedExpense.php on lines 1..40

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

        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

            public function approveExpense($id, $userId)
            {
                $expense = $this->model->findOrFail($id);
                $expense->approved = true;
                $expense->declined = false;
        Severity: Major
        Found in app/Repo/ExpenseRepository.php and 1 other location - About 2 hrs to fix
        app/Repo/ExpenseRepository.php on lines 49..63

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

        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

            public function declineExpense($id, $userId)
            {
                $expense = $this->model->findOrFail($id);
                $expense->approved = false;
                $expense->declined = true;
        Severity: Major
        Found in app/Repo/ExpenseRepository.php and 1 other location - About 2 hrs to fix
        app/Repo/ExpenseRepository.php on lines 29..43

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

        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 User.php has 254 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php namespace BB\Entities;
        
        use BB\Exceptions\AuthenticationException;
        use BB\Traits\UserRoleTrait;
        use Carbon\Carbon;
        Severity: Minor
        Found in app/Entities/User.php - About 2 hrs to fix

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

                  try {
                      $keyFob = KeyFob::lookup($tagId);
                  } catch (\Exception $e) {
                      $oldTagId = substr('BB' . $tagId, 0, 12);
                      try {
          Severity: Major
          Found in app/Http/Controllers/ACS/StatusController.php and 1 other location - About 2 hrs to fix
          app/Services/KeyFobAccess.php on lines 262..281

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

          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

                  try {
                      $keyFob = KeyFob::lookup($keyId);
                  } catch (\Exception $e) {
                      $oldTagId = substr('BB' . $keyId, 0, 12);
                      try {
          Severity: Major
          Found in app/Services/KeyFobAccess.php and 1 other location - About 2 hrs to fix
          app/Http/Controllers/ACS/StatusController.php on lines 37..56

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

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

              public function run()
              {
          
                  $users = User::active()->where('status', '=', 'active')->notSpecialCase()->get();
                  foreach ($users as $user) {
          Severity: Minor
          Found in app/Process/CheckMemberships.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 render has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public function render($request, Exception $e)
              {
                  if ($e instanceof FormValidationException) {
                      if ($request->wantsJson()) {
                          return \Response::json($e->getErrors(), 422);
          Severity: Minor
          Found in app/Exceptions/Handler.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 run has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              public function run()
              {
          
                  $today = new Carbon();
          
          
          Severity: Minor
          Found in app/Process/CheckSuspendedUsers.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 store has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              public function store($userId)
              {
                  $user = User::findWithPermission($userId);
          
                  if ( ! \Auth::user()->hasRole('admin') &&  ! \Auth::user()->hasRole('finance')) {
          Severity: Minor
          Found in app/Http/Controllers/PaymentController.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 billMembers has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              public function billMembers()
              {
                  $subCharges = $this->subscriptionChargeRepository->getDue();
          
                  //Check each of the due charges, if they have previous attempted payments ignore them
          Severity: Minor
          Found in app/Services/MemberSubscriptionCharges.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