antaresproject/core

View on GitHub

Showing 306 of 306 total issues

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

    public function handle(Installer $installer)
    {
        if (!$this->confirm('Do you wish to continue? [y|N]')) {
            return;
        }
Severity: Minor
Found in src/components/extension/src/Console/InstallCommand.php and 1 other location - About 1 hr to fix
src/components/extension/src/Console/UninstallCommand.php on lines 43..58

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

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

    public function handle(Uninstaller $uninstaller)
    {
        if (! $this->confirm('Do you wish to continue? [y|N]')) {
            return;
        }
Severity: Minor
Found in src/components/extension/src/Console/UninstallCommand.php and 1 other location - About 1 hr to fix
src/components/extension/src/Console/InstallCommand.php on lines 44..58

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

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 getWidgetAttribute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function getWidgetAttribute($name)
    {
        if (!empty(self::$staticAttributes)) {
            return array_get(self::$staticAttributes, $name);
        }
Severity: Minor
Found in src/ui/components/templates/src/Templates/Datatables.php - About 55 mins 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 joinEagerLoadedColumn has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function joinEagerLoadedColumn($relation, $relationColumn)
    {
        $joins = [];
        foreach ((array) $this->getQueryBuilder()->joins as $key => $join) {
            $joins[] = $join->table;
Severity: Minor
Found in src/ui/components/datatables/src/Engines/QueryBuilderEngine.php - About 55 mins 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 webpack has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function webpack()
    {

        $scripts = array_merge(['/packages/core/js/on-load.js', '/packages/core/js/datatable-helpers.js'], $this->dispatcher->scripts('script', $this->assets, $this->path));

Severity: Minor
Found in src/utils/asset/src/Asset.php - About 55 mins 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 getLowerRoles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getLowerRoles(array $elements, $parentId = 0, &$return = [])
    {
        foreach ($elements as $element) {
            if ($element['parent_id'] != $parentId) {
                continue;
Severity: Minor
Found in src/utils/security/src/Scope/AccessScope.php - About 55 mins 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 uninstall has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function uninstall($name)
    {
        $this->unseed($name);
        $paths = $this->uninstallPathes($name);
        foreach ($paths as $path) {
Severity: Minor
Found in src/components/publisher/src/MigrateManager.php - About 55 mins 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 unseed has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function unseed($name)
    {
        $paths = $this->uninstallPathes($name, 'seeds');
        $files = $this->app->make('files');
        foreach ($paths as $path) {
Severity: Minor
Found in src/components/publisher/src/MigrateManager.php - About 55 mins 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 clear has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function clear(array $items = [])
    {
        $cleared = [];
        foreach ($items as $name => $item) {
            $pass = true;
Severity: Minor
Found in src/components/memory/src/Component/ComponentHandler.php - About 55 mins 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 middleware has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function middleware($middleware, array $options = [])
    {
        if (!isset($options['only']) or ! app('antares.installed')) {
            return $this->runMiddleware($middleware, $options);
        }
Severity: Minor
Found in src/foundation/src/Http/Controllers/AdminController.php - About 55 mins 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 smtp has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function smtp(array $data = null)
    {
        $valid = true;
        foreach (['email_address', 'email_host', 'email_port', 'email_username', 'email_password', 'email_encryption'] as $key) {

Severity: Minor
Found in src/foundation/src/Tester/ConnectionTester.php - About 55 mins 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 handle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle(GridContract $grid)
    {
        $runtime = Memory::make('runtime')->get('control');
        if (is_null($runtime)) {
            return false;
Severity: Minor
Found in src/components/html/src/Events/BeforeFormRender.php - About 55 mins 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 getLowerRoles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getLowerRoles(array $elements, $parentId = 0, &$return = [])
    {
        foreach ($elements as $element) {
            if ($element['parent_id'] != $parentId) {
                continue;
Severity: Minor
Found in src/components/model/src/Role.php - About 55 mins 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 5 locations. Consider refactoring.
Open

        Schema::table('tbl_logs_translations', function(Blueprint $table) {
            $table->foreign('lang_id', 'fk_tlt_lang_id')->references('id')->on('tbl_languages')->onUpdate('NO ACTION')->onDelete('CASCADE');
            $table->foreign('log_id', 'fk_tlt_log_id')->references('id')->on('tbl_logs')->onUpdate('NO ACTION')->onDelete('CASCADE');
        });
src/components/auth/resources/database/migrations/2015_12_02_3_create_ tbl_logs_login_devices_table.php on lines 49..52
src/components/auth/resources/database/migrations/2017_07_24_082030_create_notifications_table.php on lines 92..95
src/components/auth/resources/database/migrations/2017_07_24_082030_create_notifications_table.php on lines 96..99
src/ui/components/templates/resources/database/migrations/2015_10_23_115748_create_components.php on lines 73..76

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

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

        Schema::table('tbl_notifications_stack', function(Blueprint $table) {
            $table->foreign('notification_id', 'fk_notification_stack')->references('id')->on('tbl_notifications')->onUpdate('NO ACTION')->onDelete('CASCADE');
            $table->foreign('author_id', 'fk_notification_stack_author_id')->references('id')->on('tbl_users')->onUpdate('NO ACTION')->onDelete('CASCADE');
        });
src/components/auth/resources/database/migrations/2015_12_02_3_create_ tbl_logs_login_devices_table.php on lines 49..52
src/components/auth/resources/database/migrations/2015_12_10_091059_create_tbl_logs_translations.php on lines 44..47
src/components/auth/resources/database/migrations/2017_07_24_082030_create_notifications_table.php on lines 92..95
src/ui/components/templates/resources/database/migrations/2015_10_23_115748_create_components.php on lines 73..76

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

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

        Schema::table('tbl_logs_login_devices', function(Blueprint $table) {
            $table->foreign('user_id', 'tbl_logs_login_devices_fk1')->references('id')->on('tbl_users')->onUpdate('NO ACTION')->onDelete('CASCADE');
            $table->foreign('log_id', 'tbl_logs_login_devices_fk2')->references('id')->on('tbl_logs')->onUpdate('NO ACTION')->onDelete('SET NULL');
        });
src/components/auth/resources/database/migrations/2015_12_10_091059_create_tbl_logs_translations.php on lines 44..47
src/components/auth/resources/database/migrations/2017_07_24_082030_create_notifications_table.php on lines 92..95
src/components/auth/resources/database/migrations/2017_07_24_082030_create_notifications_table.php on lines 96..99
src/ui/components/templates/resources/database/migrations/2015_10_23_115748_create_components.php on lines 73..76

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

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

        Schema::table('tbl_page_closure', function(Blueprint $table) {
            $table->foreign('ancestor', 'page_closure_ancestor_foreign')->references('id')->on('tbl_widgets_params')->onUpdate('RESTRICT')->onDelete('CASCADE');
            $table->foreign('descendant', 'page_closure_descendant_foreign')->references('id')->on('tbl_widgets_params')->onUpdate('RESTRICT')->onDelete('CASCADE');
        });
src/components/auth/resources/database/migrations/2015_12_02_3_create_ tbl_logs_login_devices_table.php on lines 49..52
src/components/auth/resources/database/migrations/2015_12_10_091059_create_tbl_logs_translations.php on lines 44..47
src/components/auth/resources/database/migrations/2017_07_24_082030_create_notifications_table.php on lines 92..95
src/components/auth/resources/database/migrations/2017_07_24_082030_create_notifications_table.php on lines 96..99

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

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

        Schema::table('tbl_notification_contents', function(Blueprint $table) {
            $table->foreign('notification_id', 'fk_notification_id')->references('id')->on('tbl_notifications')->onUpdate('NO ACTION')->onDelete('CASCADE');
            $table->foreign('lang_id', 'fk_notification_contents_lang')->references('id')->on('tbl_languages')->onUpdate('NO ACTION')->onDelete('CASCADE');
        });
src/components/auth/resources/database/migrations/2015_12_02_3_create_ tbl_logs_login_devices_table.php on lines 49..52
src/components/auth/resources/database/migrations/2015_12_10_091059_create_tbl_logs_translations.php on lines 44..47
src/components/auth/resources/database/migrations/2017_07_24_082030_create_notifications_table.php on lines 96..99
src/ui/components/templates/resources/database/migrations/2015_10_23_115748_create_components.php on lines 73..76

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

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

namespace Antares\Events\Html\Form;

use Antares\Events\Events\AbstractEvent;
Severity: Minor
Found in src/components/events/src/Events/Html/Form/ValidateForm.php and 1 other location - About 45 mins to fix
src/components/events/src/Events/Html/Form/BeforeRenderForm.php on lines 1..47

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

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

/**
 * Part of the Antares Project package.
 *
Severity: Minor
Found in src/components/events/src/Events/Html/Form/BeforeRenderForm.php and 1 other location - About 45 mins to fix
src/components/events/src/Events/Html/Form/ValidateForm.php on lines 1..29

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

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