cattr-app/server-application

View on GitHub

Showing 177 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

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

          <?php
          
          use App\Models\Role;
          use App\Models\Rule;
          use Illuminate\Database\Migrations\Migration;
          Severity: Major
          Found in database/migrations/2020_02_04_080909_fix_user_roles.php and 2 other locations - About 7 hrs to fix
          database/migrations/2020_01_14_061358_fixes_for_roles.php on lines 1..61
          database/migrations/2020_02_06_080530_add_user_permissions.php on lines 1..59

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

          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 3 locations. Consider refactoring.
          Open

          <?php
          
          use App\Models\Role;
          use App\Models\Rule;
          use Illuminate\Database\Migrations\Migration;
          database/migrations/2020_01_14_061358_fixes_for_roles.php on lines 1..61
          database/migrations/2020_02_04_080909_fix_user_roles.php on lines 1..59

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

          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 3 locations. Consider refactoring.
          Open

          <?php
          
          use App\Models\Role;
          use App\Models\Rule;
          use Illuminate\Database\Migrations\Migration;
          Severity: Major
          Found in database/migrations/2020_01_14_061358_fixes_for_roles.php and 2 other locations - About 7 hrs to fix
          database/migrations/2020_02_04_080909_fix_user_roles.php on lines 1..59
          database/migrations/2020_02_06_080530_add_user_permissions.php on lines 1..59

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

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

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

                    $tasks = $itemsQuery
                        ->with('task')
                        ->get()
                        ->groupBy(['task_id', 'user_id'])
                        ->map(static function ($taskIntervals, $taskId) use (&$totalTime) {
            Severity: Major
            Found in app/Http/Controllers/Api/TimeController.php and 1 other location - About 6 hrs to fix
            app/Http/Controllers/Api/IntervalController.php on lines 666..696

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

            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

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

                    $tasks = $itemsQuery
                        ->with('task')
                        ->get()
                        ->groupBy(['task_id', 'user_id'])
                        ->map(static function ($taskIntervals, $taskId) use (&$totalTime) {
            Severity: Major
            Found in app/Http/Controllers/Api/IntervalController.php and 1 other location - About 6 hrs to fix
            app/Http/Controllers/Api/TimeController.php on lines 247..278

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

            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

                grid.addAction([
                    {
                        title: 'control.edit',
                        icon: 'icon-edit',
                        onClick: (router, { item }, context) => {
            resources/frontend/core/modules/Priorities/sections/priorities.js on lines 97..119

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

            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

                grid.addAction([
                    {
                        title: 'control.edit',
                        icon: 'icon-edit',
                        onClick: (router, { item }, context) => {
            resources/frontend/core/modules/Statuses/sections/statuses.js on lines 123..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 155.

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

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

                  initCompanySections() {
                      this.additionalFields
                          .filter(({ scope }) => scope === 'company')
                          .forEach(({ scope, path, field }) => {
                              store.dispatch('settings/addField', { scope, path, field });
              Severity: Major
              Found in resources/frontend/core/arch/module.js and 1 other location - About 4 hrs to fix
              resources/frontend/core/arch/module.js on lines 203..211

              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

                  initSettingsSections() {
                      this.additionalFields
                          .filter(({ scope }) => scope === 'settings')
                          .forEach(({ scope, path, field }) => {
                              store.dispatch('settings/addField', { scope, path, field });
              Severity: Major
              Found in resources/frontend/core/arch/module.js and 1 other location - About 4 hrs to fix
              resources/frontend/core/arch/module.js on lines 217..225

              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

              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

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

                    addSettingsSection(...args) {
                        Array.from(args).forEach(({ route, accessCheck, scope, order, component }) => {
                            const { path, name, meta, children } = route;
                            const section = new SettingsSection(path, name, meta, accessCheck, scope, order, component, children);
                            this.settingsSections.push(section);
                Severity: Major
                Found in resources/frontend/core/arch/module.js and 1 other location - About 4 hrs to fix
                resources/frontend/core/arch/module.js on lines 173..179

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

                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

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

                        {
                            title: 'field.color',
                            key: 'color',
                            render(h, { item }) {
                                return h(
                resources/frontend/core/modules/Statuses/sections/statuses.js on lines 93..120

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

                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

                Severity
                Category
                Status
                Source
                Language