cattr-app/server-application

View on GitHub

Showing 84 of 177 total issues

Function init has 590 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function init(context, router) {
    let routes = {};

    ModuleLoaderInterceptor.on('Core', m => {
        m.routes.forEach(route => {
Severity: Major
Found in resources/frontend/core/modules/Tasks/module.init.js - About 2 days to fix

    File time.js has 713 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import moment from 'moment-timezone';
    import i18n from '@/i18n';
    
    export function formatDate(date, format = 'YYYY-MM-DD h:mm:ss') {
        return moment(date).format(format);
    Severity: Major
    Found in resources/frontend/core/utils/time.js - About 1 day to fix

      File module.init.js has 612 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import cloneDeep from 'lodash/cloneDeep';
      import TasksService from '@/services/resource/task.service';
      import ProjectsService from '@/services/resource/project.service';
      import StatusService from '@/services/resource/status.service';
      import { ModuleLoaderInterceptor } from '@/moduleLoader';
      Severity: Major
      Found in resources/frontend/core/modules/Tasks/module.init.js - About 1 day to fix

        File users.js has 478 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import cloneDeep from 'lodash/cloneDeep';
        import TimezonePicker from '@/components/TimezonePicker';
        import CoreUsersService from '@/services/resource/user.service';
        import RoleSelect from '@/components/RoleSelect';
        import Users from '../views/Users';
        Severity: Minor
        Found in resources/frontend/core/modules/Users/sections/users.js - About 7 hrs to fix

          Function fieldsToFillProvider has 184 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function fieldsToFillProvider() {
              return [
                  {
                      key: 'id',
                      displayable: () => false,
          Severity: Major
          Found in resources/frontend/core/modules/Users/sections/users.js - About 7 hrs to fix

            Function init has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
            Open

            export function init(context, router) {
                let routes = {};
            
                ModuleLoaderInterceptor.on('Core', m => {
                    m.routes.forEach(route => {
            Severity: Minor
            Found in resources/frontend/core/modules/Tasks/module.init.js - About 6 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 apply has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function apply(Builder $query, Model $model, array $filter = [], bool $first = true): void
                {
                    $table = $model->getTable();
                    $relations = [];
            
            
            Severity: Minor
            Found in app/Helpers/QueryHelper.php - About 5 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 localModuleLoader has 135 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function localModuleLoader(router) {
                const requireModule = require.context('_modules', true, /module.init.js$/);
                let moduleInitQueue = [];
            
                requireModule.keys().forEach(fn => {
            Severity: Major
            Found in resources/frontend/core/moduleLoader.js - About 5 hrs to fix

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

                  public function up()
                  {
                      Schema::table('time_intervals', function (Blueprint $table) {
                          $table->index('start_at');
                          $table->index('end_at');
              Severity: Major
              Found in database/migrations/2018_09_11_100952_add_index.php - About 4 hrs to fix

                Function init has 99 lines of code (exceeds 25 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: Major
                Found in resources/frontend/core/modules/TimeIntervals/module.init.js - About 3 hrs to fix

                  Function defultCallback has a Cognitive Complexity of 26 (exceeds 5 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 3 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 up has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function up()
                      {
                          // Adds soft-delete handling.
                          // Fixes error with an update affects time durations of all users.
                  
                  
                  Severity: Major
                  Found in database/migrations/2018_10_02_112003_fix_time_durations_cache.php - About 3 hrs to fix

                    Method down has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function down()
                        {
                            DB::unprepared('CREATE VIEW `time_durations` AS
                                SELECT
                                    DATE(`start_at`) AS `date`,

                      Module has 28 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      export default class Module {
                          routes = [];
                          navEntries = [];
                          navEntriesDropdown = {};
                          navEntriesMenuDropdown = [];
                      Severity: Minor
                      Found in resources/frontend/core/arch/module.js - About 3 hrs to fix

                        Method down has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function down()
                            {
                                // Restores old view and triggers.
                                // Copied from the 2018_09_11_100952_add_index.php
                        
                        
                        Severity: Major
                        Found in database/migrations/2018_10_02_112003_fix_time_durations_cache.php - About 3 hrs to fix

                          Method apply has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function apply(Builder $query, Model $model, array $filter = [], bool $first = true): void
                              {
                                  $table = $model->getTable();
                                  $relations = [];
                          
                          
                          Severity: Major
                          Found in app/Helpers/QueryHelper.php - About 2 hrs to fix

                            Method updateData has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected function updateData()
                                {
                                    $userRoles = DB::table('user_role')->select(['user_id', 'role_id'])->get();
                                    $total = $userRoles->count();
                            
                            
                            Severity: Major
                            Found in database/migrations/2019_11_29_071129_add_role_to_users.php - About 2 hrs to fix

                              Method tasks has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function tasks(Request $request): JsonResponse
                                  {
                                      $validationRules = [
                                          'start_at' => 'date',
                                          'end_at' => 'date',
                              Severity: Major
                              Found in app/Http/Controllers/Api/TimeController.php - About 2 hrs to fix

                                Method handle has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function handle(): int
                                    {
                                        if ($this->option('email')) {
                                            $email = $this->option('email');
                                
                                
                                Severity: Major
                                Found in app/Console/Commands/MakeAdmin.php - About 2 hrs to fix

                                  Function load has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      load(userIDs, projectIDs, startAt, endAt, userTimezone) {
                                          this.getReport(startAt, endAt, userIDs, projectIDs, userTimezone)
                                              .then(response => {
                                                  if (!response) {
                                                      return;
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language