cattr-app/server-application

View on GitHub

Showing 84 of 177 total issues

Avoid deeply nested control flow statements.
Open

                } else if (action === 'cancel' && currentModal.reject) {
                    currentModal.reject(action);
                }
Severity: Major
Found in resources/frontend/core/components/global/CustomModal/dialog.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if (instance.showInput) {
                            currentModal.resolve({ value: instance.inputValue, action });
                        } else {
                            currentModal.resolve(action);
                        }
    Severity: Major
    Found in resources/frontend/core/components/global/CustomModal/dialog.js - About 45 mins to fix

      Function responseErrorInterceptor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      const responseErrorInterceptor = error => {
          setLoading(false);
      
          if (!has(error, 'response.status') || (error.request.responseType === 'blob' && error.request.status === 404)) {
              return Promise.reject(error);
      Severity: Minor
      Found in resources/frontend/core/helpers/httpInterceptor.js - About 35 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 dispatch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function dispatch($event, mixed $payload = [], $halt = false): mixed
          {
              foreach ($this->getListeners($event) as $listener) {
                  $response = $listener($event, $payload);
      
      
      Severity: Minor
      Found in app/Helpers/FilterDispatcher.php - About 35 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 hasRoleInAnyProject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          final public function hasRoleInAnyProject(Role|array $role): bool
          {
              $self = $this;
              $roles = Cache::store('octane')->remember(
                  "role_any_project_$self->id",
      Severity: Minor
      Found in app/Traits/HasRole.php - About 35 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 up has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function up()
          {
              $user_role_id = 2;
              $manager_role_id = 5;
              $blocked_role_id = 255;
      Severity: Minor
      Found in database/migrations/2018_09_27_100017_update_rules.php - About 35 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 init has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      export function init(context, router) {
          const crud = context.createCrud('time_intervals.crud_title', 'time-intervals', TimeIntervalService);
      
          crud.new.addToMetaProperties('permissions', 'time-intervals/create', crud.new.getRouterConfig());
          crud.new.addToMetaProperties('afterSubmitCallback', () => router.go(-1), crud.new.getRouterConfig());
      Severity: Minor
      Found in resources/frontend/core/modules/TimeIntervals/module.init.js - About 35 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 getRelationsFilter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          private static function getRelationsFilter(array $filter): array
          {
              $key = array_search('can', $filter, true);
              if ($key !== false) {
                  array_splice($filter, $key, 1);
      Severity: Minor
      Found in app/Helpers/QueryHelper.php - About 35 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 solve has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          private function solve(string $captchaToken = ''): void
          {
              if (!$this->captchaEnabled()) {
                  return;
              }
      Severity: Minor
      Found in app/Helpers/Recaptcha.php - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function handle(): int
          {
              if (!$this->option('force') && !$this->confirm('Are you sure want to drop data for your Cattr instance?')) {
                  return 0;
              }
      Severity: Minor
      Found in app/Console/Commands/ResetCommand.php - About 35 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

      Avoid too many return statements within this method.
      Open

                  return;
      Severity: Major
      Found in app/Helpers/Recaptcha.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return false;
        Severity: Major
        Found in app/Traits/HasRole.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return $filter;
          Severity: Major
          Found in app/Helpers/QueryHelper.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return 0;
            Severity: Major
            Found in app/Console/Commands/MakeAdmin.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return 1;
              Severity: Major
              Found in app/Console/Commands/MakeAdmin.php - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return choicesLength < 4 ? 2 : 3;
                Severity: Major
                Found in resources/frontend/core/i18n/pluralizationRules.js - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return true;
                  Severity: Major
                  Found in app/Helpers/Recaptcha.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return $this->_edit($request);
                    Severity: Major
                    Found in app/Http/Controllers/Api/TaskController.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return true;
                      Severity: Major
                      Found in app/Helpers/Recaptcha.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return $this->_create($request);
                        Severity: Major
                        Found in app/Http/Controllers/Api/TaskController.php - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language