cattr-app/server-application

View on GitHub

Showing 177 of 177 total issues

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

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
database/migrations/2018_05_31_110006_create_relations_users_table.php on lines 1..37
database/migrations/2019_07_22_120600_drop_relations_users_table.php on lines 1..37

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

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

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

            Schema::create('rule', function (Blueprint $table) {
                $table->increments('id');
                $table->unsignedInteger('role_id');
                $table->string('object', 50);
                $table->string('action', 50);
    Severity: Major
    Found in database/migrations/2018_03_07_141643_create_roles.php and 1 other location - About 2 hrs to fix
    database/migrations/2020_10_23_105909_drop_rules_table.php on lines 26..36

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

    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

            Schema::create('rule', function(Blueprint $table) {
                $table->increments('id');
                $table->unsignedInteger('role_id');
                $table->string('object', 50);
                $table->string('action', 50);
    Severity: Major
    Found in database/migrations/2020_10_23_105909_drop_rules_table.php and 1 other location - About 2 hrs to fix
    database/migrations/2018_03_07_141643_create_roles.php on lines 31..41

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

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

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

                      {
                          label: 'settings.company_language',
                          key: 'language',
                          render: (h, props) => {
                              const lang = props.values.language ?? 'en';
      Severity: Major
      Found in resources/frontend/core/modules/Settings/sections/general.js and 1 other location - About 2 hrs to fix
      resources/frontend/core/modules/Settings/sections/general.js on lines 35..51

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

      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

                      {
                          label: 'settings.company_timezone',
                          key: 'timezone',
                          render: (h, props) => {
                              const value = props.values.timezone ?? 'UTC';
      Severity: Major
      Found in resources/frontend/core/modules/Settings/sections/general.js and 1 other location - About 2 hrs to fix
      resources/frontend/core/modules/Settings/sections/general.js on lines 159..176

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

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

            Function fieldsProvider has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Function render has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                                  render(h, props) {
                                      const defaultConfig = [
                                          {
                                              start: 0,
                                              end: 0.75,
              Severity: Major
              Found in resources/frontend/core/modules/Settings/sections/general.js - About 2 hrs to fix

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

                    public function tasks(IntervalTasksRequest $request): JsonResponse
                    {
                        $requestData = Filter::process(Filter::getRequestFilterName(), $request->validated());
                
                        $timezone = Settings::scope('core')->get('timezone', 'UTC');
                Severity: Major
                Found in app/Http/Controllers/Api/IntervalController.php - About 2 hrs to fix

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

                  export default class PriorityPolicy {
                      static viewAny(user) {
                          return hasRole(user, 'admin');
                      }
                  
                  
                  Severity: Major
                  Found in resources/frontend/core/policies/priority.policy.js and 2 other locations - About 2 hrs to fix
                  resources/frontend/core/policies/invitation.policy.js on lines 3..19
                  resources/frontend/core/policies/status.policy.js on lines 3..19

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

                  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

                  export default class StatusPolicy {
                      static viewAny(user) {
                          return hasRole(user, 'admin');
                      }
                  
                  
                  Severity: Major
                  Found in resources/frontend/core/policies/status.policy.js and 2 other locations - About 2 hrs to fix
                  resources/frontend/core/policies/invitation.policy.js on lines 3..19
                  resources/frontend/core/policies/priority.policy.js on lines 3..19

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

                  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

                  export default class InvitationPolicy {
                      static viewAny(user) {
                          return hasRole(user, 'admin');
                      }
                  
                  
                  Severity: Major
                  Found in resources/frontend/core/policies/invitation.policy.js and 2 other locations - About 2 hrs to fix
                  resources/frontend/core/policies/priority.policy.js on lines 3..19
                  resources/frontend/core/policies/status.policy.js on lines 3..19

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

                  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

                      ModuleLoaderInterceptor.on('Core', m => {
                          m.routes.forEach(route => {
                              if (route.name.search('users.view') > 0) {
                                  routes.usersView = route.name;
                              }
                  Severity: Major
                  Found in resources/frontend/core/modules/Tasks/module.init.js and 1 other location - About 2 hrs to fix
                  resources/frontend/core/modules/Tasks/module.init.js on lines 34..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 77.

                  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

                      ModuleLoaderInterceptor.on('Projects', m => {
                          m.routes.forEach(route => {
                              if (route.name.search('view') > 0) {
                                  routes.projectsView = route.name;
                              }
                  Severity: Major
                  Found in resources/frontend/core/modules/Tasks/module.init.js and 1 other location - About 2 hrs to fix
                  resources/frontend/core/modules/Tasks/module.init.js on lines 26..32

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

                  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 handle has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function handle(Client $client): int
                      {
                          if (Settings::scope('core')->get('instance')) {
                              echo 'Application already registered';
                              return 1;
                  Severity: Major
                  Found in app/Console/Commands/RegisterInstance.php - About 2 hrs to fix

                    File IntervalController.php has 253 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    namespace App\Http\Controllers\Api;
                    
                    use App\Contracts\ScreenshotService;
                    Severity: Minor
                    Found in app/Http/Controllers/Api/IntervalController.php - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language