imagecms/ImageCMS

View on GitHub

Showing 1,858 of 1,858 total issues

Avoid too many return statements within this method.
Open

                return $this->make(lang('Action type', 'navigation'), 'shop/action_type/show', $widget);
Severity: Major
Found in application/modules/navigation/navigation_widgets.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return $this->make(lang('Compare', 'navigation'), 'shop/compare/', $widget);
Severity: Major
Found in application/modules/navigation/navigation_widgets.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return $this->getUrl();
Severity: Major
Found in application/modules/core/models/Base/Route.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

        return $brandId;
Severity: Major
Found in application/modules/exchange/classes/Properties.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return null;
Severity: Major
Found in application/modules/core/models/Base/Route.php - About 30 mins to fix

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

        $('.robots_check').each(
            function (number) {
                    $(this).attr('name', 'robots_check[' + number + ']');
            }
        );
Severity: Minor
Found in application/modules/sitemap/assets/js/admin.js and 1 other location - About 30 mins to fix
application/modules/sitemap/assets/js/admin.js on lines 23..27

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

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

        $('.robots_check').each(
            function (number) {
                    $(this).attr('name', 'robots_check[' + number + ']');
            }
        );
Severity: Minor
Found in application/modules/sitemap/assets/js/admin.js and 1 other location - About 30 mins to fix
application/modules/sitemap/assets/js/admin.js on lines 15..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 45.

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

    private static function checkModuleInstall() {
        $for_check = CI::$APP->uri->segment(2);

        if ($for_check == 'components') {
            if (in_array(CI::$APP->uri->segment(3), ['init_window', 'run', 'cp'])) {
Severity: Minor
Found in application/libraries/Permitions.php - About 25 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 _trans has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function _trans($original, $aParams = false) {
        if (!isset($this->gettext_domain)) {
            return false;
        }

Severity: Minor
Found in application/libraries/MY_Lang.php - About 25 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 loadModules has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function loadModules() {

        CI::$APP->load->helper('file');
        foreach (Modules::$locations as $path => $relPath) {
            $modulesInLocation = get_dir_file_info($path);
Severity: Minor
Found in application/libraries/lib_modules.php - About 25 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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct($interval = 0, $cacheFilename, Closure $dataSourceCallback) {
        if (is_numeric($interval)) {
            $this->interval = $interval;
        } elseif (ENVIRONMENT == 'development') {
            throw new \Exception(lang('Interval argument must be integer', 'main'));
Severity: Minor
Found in application/libraries/CustomCache.php - About 25 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 getSetting has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getSetting($key = NULL) {
        $result = $this->ci->db->select('backup')->get('settings');
        if ($result) {
            $row = $result->result_array();
        } else {
Severity: Minor
Found in application/libraries/Backup.php - About 25 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 privilegeEdit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function privilegeEdit($privilegeId) {
        //        $queryRBACPrivilege = $this->db->get_where('shop_rbac_privileges', array('id' => $privilegeId))->row();

        $sqlPr = 'SELECT SRP.id, SRP.name, SRP.group_id, SRPI.title, SRPI.description
            FROM shop_rbac_privileges SRP
Severity: Minor
Found in application/libraries/Permitions.php - About 25 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 query_from_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function query_from_file($file) {

        $string_query = rtrim($file, "\n;");
        $array_query = explode(";\n", $string_query);

Severity: Minor
Found in application/libraries/Update.php - About 25 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 _get_sub_cats has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function _get_sub_cats($parent_id) {
        $new_sub_cats = [];
        $this->level++;

        foreach ($this->categories as $sub_cats) {
Severity: Minor
Found in application/libraries/lib_category.php - About 25 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 prepareConditions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function prepareConditions(array $params) {

        $paidCondition = '';
        if (isset($params['paid'])) {
            switch ($params['paid']) {
Severity: Minor
Found in application/modules/mod_stats/models/orders_model.php - About 25 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 autologin has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function autologin() {
        $result = FALSE;

        //if ($auto = $this->ci->input->cookie($this->ci->config->item('DX_autologin_cookie_name')) AND ! $this->ci->session->userdata('DX_logged_in'))
        if ($auto = $this->ci->input->cookie($this->ci->config->item('DX_autologin_cookie_name'))) {
Severity: Minor
Found in application/libraries/DX_Auth.php - About 25 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 checkIsInstalled has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function checkIsInstalled() {
        $isNotInstalledInConfig = !config_item('is_installed');
        $installControllerExists = file_exists(getModulePath('install') . '/install.php');

        if (!$isNotInstalledInConfig && !$installControllerExists) {
Severity: Minor
Found in application/libraries/lib_init.php - About 25 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 renderGA has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function renderGA($GAid = null) {

        /* Show Google Analytics code if some value inserted in admin panel */
        if ($GAid['google_analytics_id']) {
            if ($this->getCustomParams()) {
Severity: Minor
Found in application/libraries/lib_seo.php - About 25 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 getMoFileName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    function getMoFileName($domain) {

        if ($domain) {
            if (array_key_exists('MO_FILE_NAMES', $GLOBALS) && array_key_exists($domain, $GLOBALS['MO_FILE_NAMES'])) {
                return $GLOBALS['MO_FILE_NAMES'][$domain];
Severity: Minor
Found in application/helpers/language_helper.php - About 25 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

Severity
Category
Status
Source
Language