mambax7/publisher

View on GitHub

Showing 3,032 of 3,032 total issues

Method cloneFileFolder has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Severity: Minor
Found in class/Cloner.php - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

            if ('png' === $imgType && OPTIPNG_ENABLED && OPTIPNG_PATH && @is_file(OPTIPNG_PATH)) {
                $exec = OPTIPNG_PATH;
                $this->debug(3, "optipng'ing $tempfile");
                $presize = filesize($tempfile);
                $out     = shell_exec('$exec -o1 $tempfile'); //you can use up to -o7 but it really slows things down
    Severity: Major
    Found in thumb.php - About 1 hr to fix

      Method getAllSubmitted has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function getAllSubmitted($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none')
      Severity: Major
      Found in class/ItemHandler.php - About 1 hr to fix

        Method isBlockCloned has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups): void
        Severity: Major
        Found in class/Common/Blocksadmin.php - About 1 hr to fix

          Method getAllExpired has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function getAllExpired($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none')
          Severity: Major
          Found in class/ItemHandler.php - About 1 hr to fix

            Method getAllRejected has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function getAllRejected($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none')
            Severity: Major
            Found in class/ItemHandler.php - About 1 hr to fix

              Method getAllOffline has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function getAllOffline($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none')
              Severity: Major
              Found in class/ItemHandler.php - About 1 hr to fix

                Each class must be in a namespace of at least one level (a top-level vendor name)
                Open

                class PublisherCorePreload extends \XoopsPreloadItem
                Severity: Minor
                Found in preloads/core.php by phpcodesniffer

                Each class must be in a namespace of at least one level (a top-level vendor name)
                Open

                class Timthumb
                Severity: Minor
                Found in thumb.php by phpcodesniffer

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

                    public function getProjectTaskByStatus($statusId, $itemId)
                    {
                        $helper   = Helper::getInstance();
                        $dbHandle = new TrelloDBController($this->xoopsDb);
                        $query    = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_items') . 'WHERE status= ? AND itemid = ?';
                Severity: Minor
                Found in class/TrelloManagement.php and 1 other location - About 1 hr to fix
                class/TrelloManagement.php on lines 53..61

                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

                        if ($confirm) {
                            if (!$helper->getHandler('File')
                                        ->delete($fileObj)) {
                                redirect_header('item.php?itemid=' . $fileObj->itemid(), 2, _AM_PUBLISHER_FILE_DELETE_ERROR);
                            }
                Severity: Minor
                Found in file.php and 1 other location - About 1 hr to fix
                submit.php on lines 146..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 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

                        if ($confirm) {
                            if (!$helper->getHandler('Item')
                                        ->delete($itemObj)) {
                                redirect_header('index.php', 2, _AM_PUBLISHER_ITEM_DELETE_ERROR . Utility::formatErrors($itemObj->getErrors()));
                            }
                Severity: Minor
                Found in submit.php and 1 other location - About 1 hr to fix
                file.php on lines 114..127

                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 editTaskStatus($statusId, $itemId)
                    {
                        $helper   = Helper::getInstance();
                        $dbHandle = new TrelloDBController($this->xoopsDb);
                        $query    = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_items') . ' SET status = ? WHERE itemid = ?';
                Severity: Minor
                Found in class/TrelloManagement.php and 1 other location - About 1 hr to fix
                class/TrelloManagement.php on lines 26..34

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

                    apply: function () {
                        for (h = 0; sheet = Behaviour.list[h]; h++) {
                            for (selector in sheet) {
                                list = document.getElementsBySelector(selector);
                
                
                Severity: Minor
                Found in assets/js/behavior.js - 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 calcDocRoot has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function calcDocRoot()
                    {
                        $docRoot = @$_SERVER['DOCUMENT_ROOT'];
                        if (defined('LOCAL_FILE_BASE_DIRECTORY')) {
                            $docRoot = LOCAL_FILE_BASE_DIRECTORY;
                Severity: Minor
                Found in thumb.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 getItemsCriteria has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function getItemsCriteria($categoryid = -1, $status = '', $notNullFields = null, $criteriaPermissions = null)
                    {
                        //        $notNullFields = (null !== $notNullFields) ?: '';
                        //        global $publisherIsAdmin;
                        //        $ret = 0;
                Severity: Minor
                Found in class/ItemHandler.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 rcopy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function rcopy($src, $dest)
                    {
                        // Only continue if user is a 'global' Admin
                        if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                            return false;
                Severity: Minor
                Found in class/Common/FilesManagement.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 recurseCopy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function recurseCopy(string $src, string $dst): void
                    {
                        $dir = \opendir($src);
                        if (!\mkdir($dst) && !\is_dir($dst)) {
                            throw new \RuntimeException(\sprintf('Directory "%s" was not created', $dst));
                Severity: Minor
                Found in class/Common/FilesManagement.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 insert has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function insert(\XoopsObject $obj, $force = false)// insert($obj, $force = false)
                    {
                        // Make sure object is of correct type
                        if (0 != \strcasecmp($this->className, \get_class($obj))) {
                            return false;
                Severity: Minor
                Found in class/BaseObjectHandler.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 rmove has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function rmove($src, $dest)
                    {
                        // Only continue if user is a 'global' Admin
                        if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                            return false;
                Severity: Minor
                Found in class/Common/FilesManagement.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

                Severity
                Category
                Status
                Source
                Language