mambax7/songlist

View on GitHub

Showing 3,642 of 3,642 total issues

File FormController.php has 1053 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php declare(strict_types=1);

namespace XoopsModules\Songlist\Form;


Severity: Major
Found in class/Form/FormController.php - About 2 days to fix

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

        public function getFilterCriteria($filter): CriteriaCompo
        {
            $parts    = \explode('|', $filter);
            $criteria = new CriteriaCompo();
            foreach ($parts as $part) {
    Severity: Major
    Found in class/ArtistsHandler.php and 3 other locations - About 2 days to fix
    class/AlbumsHandler.php on lines 41..65
    class/Utf8mapHandler.php on lines 41..65
    class/VotesHandler.php on lines 41..65

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

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

        public function getFilterCriteria($filter): CriteriaCompo
        {
            $parts    = \explode('|', $filter);
            $criteria = new CriteriaCompo();
            foreach ($parts as $part) {
    Severity: Major
    Found in class/Utf8mapHandler.php and 3 other locations - About 2 days to fix
    class/AlbumsHandler.php on lines 41..65
    class/ArtistsHandler.php on lines 39..63
    class/VotesHandler.php on lines 41..65

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

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

        public function getFilterCriteria($filter): CriteriaCompo
        {
            $parts    = \explode('|', $filter);
            $criteria = new CriteriaCompo();
            foreach ($parts as $part) {
    Severity: Major
    Found in class/VotesHandler.php and 3 other locations - About 2 days to fix
    class/AlbumsHandler.php on lines 41..65
    class/ArtistsHandler.php on lines 39..63
    class/Utf8mapHandler.php on lines 41..65

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

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

        public function getFilterCriteria($filter): CriteriaCompo
        {
            $parts    = \explode('|', $filter);
            $criteria = new CriteriaCompo();
            foreach ($parts as $part) {
    Severity: Major
    Found in class/AlbumsHandler.php and 3 other locations - About 2 days to fix
    class/ArtistsHandler.php on lines 39..63
    class/Utf8mapHandler.php on lines 41..65
    class/VotesHandler.php on lines 41..65

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

    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

                        if (Request::hasVar('mp3' . $id, 'FILES') && !empty($_FILES['mp3' . $id]['title'])) {
    //                        if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) {
    //                            foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) {
    //                                foreach (explode('/', $folders) as $folder) {
    //                                    $path .= DS . $folder;
    Severity: Major
    Found in admin/songs.php and 1 other location - About 2 days to fix
    admin/songs.php on lines 124..170

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

    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

                    if (Request::hasVar('mp3' . $id, 'FILES') && !empty($_FILES['mp3' . $id]['title'])) {
    //                    if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) {
    //                        foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) {
    //                            foreach (explode('/', $folders) as $folder) {
    //                                $path .= DS . $folder;
    Severity: Major
    Found in admin/songs.php and 1 other location - About 2 days to fix
    admin/songs.php on lines 202..248

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

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

        public function decode($str)
        {
            $str = $this->reduce_string($str);
    
            switch (mb_strtolower($str)) {
    Severity: Minor
    Found in class/JSON.php - About 1 day 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 xml2array has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function xml2array($contents, $get_attributes = 1, $priority = 'tag')
        {
            if (!$contents) {
                return [];
            }
    Severity: Minor
    Found in class/Utility.php - About 1 day 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

    File Utility.php has 609 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php declare(strict_types=1);
    
    namespace XoopsModules\Songlist;
    
    use Xmf\Request;
    Severity: Major
    Found in class/Utility.php - About 1 day to fix

      Function insert has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
      Open

          public function insert(XoopsObject $obj, $force = true, $object = null)
          {
              if ($obj->isNew()) {
                  $new = true;
                  $old = $this->create();
      Severity: Minor
      Found in class/AlbumsHandler.php - About 1 day 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

      File Blocksadmin.php has 591 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php declare(strict_types=1);
      
      namespace XoopsModules\Songlist\Common;
      
      /**
      Severity: Major
      Found in class/Common/Blocksadmin.php - About 1 day to fix

        File import.php has 563 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php declare(strict_types=1);
        
        use Xmf\Module\Admin;
        use Xmf\Request;
        use XoopsModules\Songlist\Helper;
        Severity: Major
        Found in admin/import.php - About 1 day to fix

          Function getFormSongs has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function  getFormSongs($object, $as_array = false)
              {
                  if (!\is_object($object)) {
                      $handler = Helper::getInstance()
                                       ->getHandler('Songs');
          Severity: Minor
          Found in class/Form/FormController.php - About 1 day 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 listBlocks has 219 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function listBlocks(): void
              {
                  global $xoopsModule, $pathIcon16;
                  require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
                  //        xoops_loadLanguage('admin', 'system');
          Severity: Major
          Found in class/Common/Blocksadmin.php - About 1 day to fix

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

                                    if (mb_strlen($_POST['songid']) > 0 && !empty($data[$_POST['songid']])) {
                                        $criteria = new \Criteria('songid', $data[$_POST['songid']]);
                                        if ($songsHandler->getCount($criteria) > 0) {
                                            $objects = $songsHandler->getObjects($criteria, false);
                                            $object  = $objects[0]->getVar('sid');
            Severity: Major
            Found in admin/export.php and 1 other location - About 1 day to fix
            admin/export.php on lines 188..204

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

            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

                                        if (mb_strlen($_POST['songid']) > 0 && !empty($data[$_POST['songid']])) {
                                            $criteria = new \Criteria('songid', $data[$_POST['songid']]);
                                            if ($songsHandler->getCount($criteria) > 0) {
                                                $objects = $songsHandler->getObjects($criteria, false);
                                                $object  = $objects[0]->getVar('sid');
            Severity: Major
            Found in admin/export.php and 1 other location - About 1 day to fix
            admin/export.php on lines 284..300

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

            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 __construct($fid = null)
                {
                    $this->initVar('vcid', \XOBJ_DTYPE_INT, 0, false);
                    $this->initVar('name', \XOBJ_DTYPE_TXTBOX, null, false, 128);
                    $this->initVar('artists', \XOBJ_DTYPE_INT, 0, false);
            Severity: Major
            Found in class/Voice.php and 1 other location - About 1 day to fix
            class/Genre.php on lines 30..42

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

            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 __construct($fid = null)
                {
                    $this->initVar('gid', \XOBJ_DTYPE_INT, 0, false);
                    $this->initVar('name', \XOBJ_DTYPE_TXTBOX, null, false, 128);
                    $this->initVar('artists', \XOBJ_DTYPE_INT, 0, false);
            Severity: Major
            Found in class/Genre.php and 1 other location - About 1 day to fix
            class/Voice.php on lines 32..44

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

            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

                                    if (!empty($_POST['artist']) && mb_strlen($_POST['artist']) > 1) {
                                        if (isset($data[$_POST['artist']]) && '' != $_POST['artist']) {
                                            foreach (explode(',', trim($data[$_POST['artist']])) as $artist) {
                                                $criteria = new \Criteria('name', trim($artist));
                                                if ($artistsHandler->getCount($criteria) > 0) {
            Severity: Major
            Found in admin/import.php and 1 other location - About 1 day to fix
            admin/import.php on lines 339..355

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

            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