mambax7/publisher

View on GitHub

Showing 3,032 of 3,032 total issues

Function toArraySimple has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function toArraySimple($display = 'default', $maxCharTitle = 0, $maxCharSummary = 300, $fullSummary = false)
    {
        $itemPageId = -1;
        if (\is_numeric($display)) {
            $itemPageId = $display;
Severity: Minor
Found in class/Item.php - About 2 hrs 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 cloneFileFolder has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public static function cloneFileFolder($path): void
    {
        global $patKeys;
        global $patValues;

Severity: Minor
Found in class/Cloner.php - About 2 hrs 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 lofSidernews has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $.lofSidernews = function (obj, settings) {
        this.settings = {
            direction: '',
            mainItemSelector: 'li',
            navInnerSelector: 'ul',
Severity: Major
Found in assets/js/script.easing.js - About 2 hrs to fix

    Method publisher_items_random_item_show has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function publisher_items_random_item_show($options)
    {
        $block = [];
    
        $helper = Helper::getInstance();
    Severity: Major
    Found in blocks/items_random_item.php - About 2 hrs to fix

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

          protected function getURL($url, $tempfile)
          {
              $this->lastURLError = false;
              $url                = preg_replace('/ /', '%20', $url);
              if (function_exists('curl_init')) {
      Severity: Major
      Found in thumb.php - About 2 hrs to fix

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

                    if (Constants::TABLE_CATEGORY === $source) {
                        $tableName   = 'category';
                        $fieldVote   = '_vote';
                        $fieldVotes  = '_votes';
                        $categoryObj = $categoryHandler->get($itemId);
        Severity: Major
        Found in vote.php and 2 other locations - About 2 hrs to fix
        ratelike.php on lines 135..148
        ratelike.php on lines 149..162

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

        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

                    if (Constants::TABLE_CATEGORY === $source) {
                        $tableName    = 'category';
                        $fieldRatings = '_ratings';
                        $fieldVotes   = '_votes';
                        $categoryObj  = $categoryHandler->get($itemId);
        Severity: Major
        Found in ratelike.php and 2 other locations - About 2 hrs to fix
        ratelike.php on lines 149..162
        vote.php on lines 138..151

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

        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

                    if (Constants::TABLE_ARTICLE === $source) {
                        $tableName    = 'article';
                        $fieldRatings = '_ratings';
                        $fieldVotes   = '_votes';
                        $articleObj   = $articleHandler->get($itemId);
        Severity: Major
        Found in ratelike.php and 2 other locations - About 2 hrs to fix
        ratelike.php on lines 135..148
        vote.php on lines 138..151

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

        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

            if ('category' === $category) {
                // Assume we have a valid category id
                $sql          = 'SELECT name, short_url FROM ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_categories') . ' WHERE categoryid  = ' . $itemId;
                $result       = $GLOBALS['xoopsDB']->query($sql); // TODO: error check
                $resultArray  = $GLOBALS['xoopsDB']->fetchArray($result);
        Severity: Major
        Found in include/notification.inc.php and 1 other location - About 2 hrs to fix
        include/notification.inc.php on lines 54..63

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

        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

            if ('item' === $category) {
                // Assume we have a valid story id
                $sql          = 'SELECT title, short_url FROM ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_items') . ' WHERE itemid = ' . $itemId;
                $result       = $GLOBALS['xoopsDB']->query($sql); // TODO: error check
                $resultArray  = $GLOBALS['xoopsDB']->fetchArray($result);
        Severity: Major
        Found in include/notification.inc.php and 1 other location - About 2 hrs to fix
        include/notification.inc.php on lines 43..52

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

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

            public function resizeImage()
            {
                // check file extension
                switch ($this->imageMimetype) {
                    case 'image/png':
        Severity: Major
        Found in class/Resizer.php - About 2 hrs to fix

          Method uploadFile has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function uploadFile($another, $withRedirect, &$itemObj = null)
              {
                  \xoops_load('XoopsMediaUploader');
                  //        require_once PUBLISHER_ROOT_PATH . '/class/uploader.php';
          
          
          Severity: Major
          Found in class/Utility.php - About 2 hrs to fix

            Function selectAll has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            function selectAll(formObj, fieldname, isInverse) {
                if (fieldname.length == 0) {
                    for (var i = 0; i < formObj.length; i++) {
                        fldObj = formObj.elements[i];
                        if (fldObj.type == 'checkbox') {
            Severity: Minor
            Found in assets/js/funcs.js - About 2 hrs 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 getURL has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function getURL($url, $tempfile)
                {
                    $this->lastURLError = false;
                    $url                = preg_replace('/ /', '%20', $url);
                    if (function_exists('curl_init')) {
            Severity: Minor
            Found in thumb.php - About 2 hrs 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 cleanCache has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function cleanCache()
                {
                    if (FILE_CACHE_TIME_BETWEEN_CLEANS < 0) {
                        return null;
                    }
            Severity: Minor
            Found in thumb.php - About 2 hrs 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 uploadFile has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function uploadFile($another, $withRedirect, &$itemObj = null)
                {
                    \xoops_load('XoopsMediaUploader');
                    //        require_once PUBLISHER_ROOT_PATH . '/class/uploader.php';
            
            
            Severity: Minor
            Found in class/Utility.php - About 2 hrs 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 _createInput has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    _createInput: function () {
                        var self = this;
            
                        var input = document.createElement("input");
                        input.setAttribute('type', 'file');
            Severity: Major
            Found in assets/js/ajaxupload.3.9.js - About 2 hrs to fix

              Method isBlockCloned has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups): void
                  {
                      \xoops_loadLanguage('admin', 'system');
                      \xoops_loadLanguage('admin/blocksadmin', 'system');
                      \xoops_loadLanguage('admin/groups', 'system');
              Severity: Major
              Found in class/Common/Blocksadmin.php - About 2 hrs to fix

                Method mergeImage has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function mergeImage(): void
                    {
                        $dest = \imagecreatefromjpeg($this->endFile);
                        $src  = \imagecreatefromjpeg($this->sourceFile);
                        if (4 == $this->mergeType) {
                Severity: Major
                Found in class/Resizer.php - About 2 hrs to fix

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

                      foreach ($comments as $comment) {
                          $comment->setVar('com_itemid', $newArticleArray[(int)$comment->getVar('com_itemid')]);
                          $comment->setVar('com_modid', $publisher_module_id);
                          $comment->setNew();
                          if ($commentHandler->insert($comment)) {
                  Severity: Major
                  Found in admin/import/ams.php and 6 other locations - About 2 hrs to fix
                  admin/import/cjaycontent.php on lines 172..181
                  admin/import/fmcontent.php on lines 356..365
                  admin/import/news.php on lines 278..287
                  admin/import/wfsection.php on lines 274..283
                  admin/import/xfsection.php on lines 272..281
                  admin/import/xnews.php on lines 441..450

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

                  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