cattr-app/server-application

View on GitHub

Showing 177 of 177 total issues

Function handle has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle(Client $client): int
    {
        if (Settings::scope('core')->get('instance')) {
            echo 'Application already registered';
            return 1;
Severity: Minor
Found in app/Console/Commands/RegisterInstance.php - 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

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

    grid.addPageControls([
        {
            label: 'control.create',
            type: 'primary',
            icon: 'icon-edit',
resources/frontend/core/modules/Invitations/sections/invitations.js on lines 104..113
resources/frontend/core/modules/Priorities/sections/priorities.js on lines 121..130

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

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

    grid.addPageControls([
        {
            label: 'control.create',
            type: 'primary',
            icon: 'icon-edit',
resources/frontend/core/modules/Priorities/sections/priorities.js on lines 121..130
resources/frontend/core/modules/Statuses/sections/statuses.js on lines 147..156

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

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

module.exports = () => {
    console.log('Reading modules config file...');
    const p = path.join(__dirname, '..', 'etc', 'modules.config.json');

    if (!fs.existsSync(path.join(__dirname, '..', 'generated'))) {
Severity: Minor
Found in resources/frontend/compiler/index.js - About 1 hr to fix

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

        grid.addPageControls([
            {
                label: 'control.create',
                type: 'primary',
                icon: 'icon-edit',
    resources/frontend/core/modules/Invitations/sections/invitations.js on lines 104..113
    resources/frontend/core/modules/Statuses/sections/statuses.js on lines 147..156

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

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

        public function process(Request $request): JsonResponse
        {
            $validator = Validator::make($request->all(), [
                'email' => 'required|email',
                'token' => 'required|string',
    Severity: Minor
    Found in app/Http/Controllers/PasswordResetController.php - About 1 hr to fix

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

          public function up()
          {
              DB::unprepared('
                  CREATE OR REPLACE VIEW `project_report` AS
                  SELECT
      Severity: Minor
      Found in database/migrations/2018_10_01_134048_add_project_report_view.php - About 1 hr to fix

        Method updateProjectSource has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function updateProjectSource()
            {
                $projectIds = DB::table(Property::getTableName())
                    ->select('entity_id')
                    ->where('entity_type', '=', Property::PROJECT_CODE)
        Severity: Minor
        Found in database/migrations/2020_03_24_064952_add_project_source.php - About 1 hr to fix

          Method total has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function total(Request $request): JsonResponse
              {
                  $validationRules = [
                      'start_at' => 'required|date',
                      'end_at' => 'required|date',
          Severity: Minor
          Found in app/Http/Controllers/Api/TimeController.php - About 1 hr to fix

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

                    {
                        label: 'field.active',
                        key: 'active',
                        render: (h, { currentValue }) => {
                            return h('span', currentValue ? i18n.t('control.yes') : i18n.t('control.no'));
            Severity: Major
            Found in resources/frontend/core/modules/Users/sections/users.js and 1 other location - About 1 hr to fix
            resources/frontend/core/modules/Users/sections/users.js on lines 252..258

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

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

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

                    {
                        label: 'field.screenshots_active',
                        key: 'screenshots_active',
                        render: (h, { currentValue }) => {
                            return h('span', currentValue ? i18n.t('control.yes') : i18n.t('control.no'));
            Severity: Major
            Found in resources/frontend/core/modules/Users/sections/users.js and 1 other location - About 1 hr to fix
            resources/frontend/core/modules/Users/sections/users.js on lines 245..251

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

            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 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
                        Severity
                        Category
                        Status
                        Source
                        Language