cattr-app/server-application

View on GitHub

Showing 84 of 177 total issues

Function serialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export function serialize(data, prefix) {
    let str = [],
        p;
    for (p in data) {
        if (Object.prototype.hasOwnProperty.call(data, p)) {
Severity: Minor
Found in resources/frontend/core/utils/url.js - 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

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

    public function show(ShowProjectRequest $request): JsonResponse
    {
        Filter::listen(Filter::getSuccessResponseFilterName(), static function ($project) {
            $totalTracked = 0;
            $taskIDs = array_map(static function ($task) {
Severity: Minor
Found in app/Http/Controllers/Api/ProjectController.php - About 1 hr to fix

    Method create has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function create(CreateTimeIntervalRequest $request): JsonResponse
        {
            Filter::listen(
                Filter::getRequestFilterName(),
                static function (array $requestData) {
    Severity: Minor
    Found in app/Http/Controllers/Api/IntervalController.php - About 1 hr to fix

      Method postForm has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function postForm(Request $request, string $key): JsonResponse
          {
              $invitation = Invitation::where('key', $key)
                  ->where('expires_at', '>=', time())
                  ->first();
      Severity: Minor
      Found in app/Http/Controllers/RegistrationController.php - About 1 hr to fix

        Method up has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function up()
            {
                DB::unprepared("
                    CREATE OR REPLACE ALGORITHM=MERGE VIEW `project_report` AS
                    SELECT

          Method up has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function up()
              {
                  Schema::create('users', function (Blueprint $table) {
                      $table->increments('id');
                      $table->string('full_name');
          Severity: Minor
          Found in database/migrations/2014_10_12_000000_create_users_table.php - About 1 hr to fix

            Function timePerProject has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                timePerProject: (state, getters) => {
                    return Object.keys(getters.intervals).reduce((result, userID) => {
                        const userEvents = getters.intervals[userID];
                        if (!userEvents) {
                            return result;
            Severity: Minor
            Found in resources/frontend/core/modules/Dashboard/storeModule.js - 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 setLoading has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            const setLoading = value => {
                if (value) {
                    if (pendingRequests === 0) Vue.prototype.$Loading.start();
                    pendingRequests++;
                } else {
            Severity: Minor
            Found in resources/frontend/core/helpers/httpInterceptor.js - 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 render has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        render: (h, data) => {
                            if (!hasRole(router.app.$store.getters['user/user'], 'admin')) {
                                return h(
                                    'ul',
                                    {},
            Severity: Minor
            Found in resources/frontend/core/modules/Tasks/module.init.js - About 1 hr to fix

              Method solve has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function solve(string $captchaToken = ''): void
                  {
                      if (!$this->captchaEnabled()) {
                          return;
                      }
              Severity: Minor
              Found in app/Helpers/Recaptcha.php - About 1 hr to fix

                Method login has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function login(LoginRequest $request): JsonResponse
                    {
                        $credentials = $request->only(['email', 'password', 'recaptcha']);
                
                        $this->recaptcha->check($credentials);
                Severity: Minor
                Found in app/Http/Controllers/AuthController.php - About 1 hr to fix

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

                    Method _rules has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function _rules(): array
                        {
                            return [
                                'id' => 'required|int',
                                'full_name' => 'sometimes|required|string',
                    Severity: Minor
                    Found in app/Http/Requests/User/EditUserRequest.php - About 1 hr to fix

                      Function createStatusDialog has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function createStatusDialog(type) {
                          const statusTitles = {
                              info: '信息',
                              success: '成功',
                              warning: '警告',
                      Severity: Minor
                      Found in resources/frontend/core/components/global/CustomModal/dialog.js - About 1 hr to fix

                        Method hasProjectRole has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            final public function hasProjectRole(Role|array $role, int $projectId): bool
                            {
                                $self = $this;
                                $roles = Cache::store('octane')->remember(
                                    "role_project_$self->id",
                        Severity: Minor
                        Found in app/Traits/HasRole.php - About 1 hr to fix

                          Function defultCallback has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const defultCallback = action => {
                              if (currentModal) {
                                  const callback = currentModal.callback;
                                  if (typeof callback === 'function') {
                                      if (instance.showInput) {
                          Severity: Minor
                          Found in resources/frontend/core/components/global/CustomModal/dialog.js - About 1 hr to fix

                            Function showNextModal has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const showNextModal = () => {
                                initInstance();
                                instance.action = '';
                            
                                if (!instance.visible && modalQueue.length) {
                            Severity: Minor
                            Found in resources/frontend/core/components/global/CustomModal/dialog.js - About 55 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 ru has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                ru: function (choice, choicesLength) {
                                    // this === VueI18n instance, so the locale property also exists here
                            
                                    if (choice === 0) {
                                        return 0;
                            Severity: Minor
                            Found in resources/frontend/core/i18n/pluralizationRules.js - About 55 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 hasProjectRole has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

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

                                public static function thin($force = false): void
                                {
                                    if ((!$force && !self::needThinning()) || Cache::store('octane')->get('thinning_now')) {
                                        return;
                                    }
                            Severity: Minor
                            Found in app/Helpers/StorageCleaner.php - About 55 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