rinvex/cortex-foundation

View on GitHub

Showing 183 of 183 total issues

Avoid excessively long variable names like $throwValidationExceptions. Keep variable name length under 20.
Open

    protected $throwValidationExceptions = true;
Severity: Minor
Found in src/Models/Log.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $enabledExtensionsPaths. Keep variable name length under 20.
Open

        $enabledExtensionsPaths = $this->app['cortex.foundation.extensions.enabled.paths'];
Severity: Minor
Found in src/Providers/BootServiceProvider.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $resourceMethodsWithoutModels. Keep variable name length under 20.
Open

    protected $resourceMethodsWithoutModels = [
        'import',
    ];

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $disabledGlobalMiddleware. Keep variable name length under 20.
Open

    protected array $disabledGlobalMiddleware = [];
Severity: Minor
Found in src/Http/Kernel.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Method getMessages has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getMessages($noSort)
    {
        $messages = [];

        foreach (array_merge(array_values(app('translation.loader')->namespaces()), [$this->sourcePath]) as $directory) {
Severity: Minor
Found in src/Generators/LangJsGenerator.php - About 1 hr to fix

Method guard has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function guard(): string
    {
        if (! is_null($this->guard)) {
            return $this->guard;
        }
Severity: Minor
Found in src/Http/Request.php - About 1 hr to fix

Method run has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function run()
    {
        $accessAbilities = [
            ['name' => 'access-adminarea', 'title' => 'Access adminarea'],
        ];
Severity: Minor
Found in database/seeders/CortexFoundationSeeder.php - About 1 hr to fix

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

        return [
            'ParentDummyFullModelClass' => $parentModelClass,
            '{{ namespacedParentModel }}' => $parentModelClass,
            '{{namespacedParentModel}}' => $parentModelClass,
            'ParentDummyModelClass' => class_basename($parentModelClass),
Severity: Major
Found in src/Console/Commands/ControllerMakeCommand.php and 1 other location - About 1 hr to fix
src/Console/Commands/ControllerMakeCommand.php on lines 94..104

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

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

        return array_merge($replace, [
            'DummyFullModelClass' => $modelClass,
            '{{ namespacedModel }}' => $modelClass,
            '{{namespacedModel}}' => $modelClass,
            'DummyModelClass' => class_basename($modelClass),
Severity: Major
Found in src/Console/Commands/ControllerMakeCommand.php and 1 other location - About 1 hr to fix
src/Console/Commands/ControllerMakeCommand.php on lines 64..74

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

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

    public function boot(): void
    {
        // Fix the specified key was too long error
        Schema::defaultStringLength(191);

Severity: Minor
Found in src/Providers/FoundationServiceProvider.php - About 1 hr to fix

Method boot has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function boot()
    {
        $configPath = $this->app->basePath('vendor/barryvdh/laravel-debugbar/config/debugbar.php');
        $this->publishes([$configPath => $this->getConfigPath()], 'config');

Severity: Minor
Found in src/Overrides/Barryvdh/Debugbar/DebugbarServiceProvider.php - About 1 hr to fix

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

<?php

declare(strict_types=1);

namespace Cortex\Foundation\Events;
Severity: Major
Found in src/Events/AccessareaRestored.php and 1 other location - About 1 hr to fix
src/Events/AccessareaUpdated.php on lines 1..66

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

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

<?php

declare(strict_types=1);

namespace Cortex\Foundation\Events;
Severity: Major
Found in src/Events/AccessareaUpdated.php and 1 other location - About 1 hr to fix
src/Events/AccessareaRestored.php on lines 1..66

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

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

    protected function replaceClasses($stub, $model, $transformer = null): string
    {
        if ($transformer) {
            $transformer = str_replace('/', '\\', $transformer);

Severity: Minor
Found in src/Console/Commands/DataTableMakeCommand.php - About 1 hr to fix

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

    protected function prepareAccessareaIds($accessareas): array
    {
        // Convert collection to plain array
        if ($accessareas instanceof BaseCollection && is_string($accessareas->first())) {
            $accessareas = $accessareas->toArray();
Severity: Minor
Found in src/Traits/Accessible.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

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

    protected function getBuilderParameters(): array
    {
        $buttons = $this->getButtons();

        return [
Severity: Minor
Found in src/DataTables/LogsDataTable.php - About 1 hr to fix

Method bindBlueprintMacro has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function bindBlueprintMacro(): void
    {
        Blueprint::macro('auditable', function () {
            $this->integer('created_by_id')->unsigned()->after('created_at')->nullable();
            $this->string('created_by_type')->after('created_at')->nullable();
Severity: Minor
Found in src/Providers/FoundationServiceProvider.php - About 1 hr to fix

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

<?php

declare(strict_types=1);

namespace Cortex\Foundation\Console\Commands;
Severity: Major
Found in src/Console/Commands/CoreDeactivateCommand.php and 3 other locations - About 1 hr to fix
src/Console/Commands/CoreActivateCommand.php on lines 1..38
src/Console/Commands/CoreAutoloadCommand.php on lines 1..38
src/Console/Commands/CoreUnloadCommand.php on lines 1..38

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

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

<?php

declare(strict_types=1);

namespace Cortex\Foundation\Console\Commands;
Severity: Major
Found in src/Console/Commands/CoreUnloadCommand.php and 3 other locations - About 1 hr to fix
src/Console/Commands/CoreActivateCommand.php on lines 1..38
src/Console/Commands/CoreAutoloadCommand.php on lines 1..38
src/Console/Commands/CoreDeactivateCommand.php on lines 1..38

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

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

<?php

declare(strict_types=1);

namespace Cortex\Foundation\Console\Commands;
Severity: Major
Found in src/Console/Commands/CoreAutoloadCommand.php and 3 other locations - About 1 hr to fix
src/Console/Commands/CoreActivateCommand.php on lines 1..38
src/Console/Commands/CoreDeactivateCommand.php on lines 1..38
src/Console/Commands/CoreUnloadCommand.php on lines 1..38

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

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