mambax7/songlist

View on GitHub

Showing 3,642 of 3,642 total issues

Function getEditElement has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

    public function getEditElement($user, $profile)
    {
        $value = \in_array($this->getVar('field_name'), $this->getPostVars(), true) ? $user->getVar($this->getVar('field_name'), 'e') : $profile->getVar($this->getVar('field_name'), 'e');
        if (null === $value) {
            $value = $this->getVar('field_default');
Severity: Minor
Found in class/Field.php - About 5 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 getSearchElement has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

    public function getSearchElement()
    {
        $caption = $this->getVar('field_title');
        $caption = \defined($caption) ? \constant($caption) : $caption;
        $name    = $this->getVar('field_name', 'e');
Severity: Minor
Found in class/Field.php - About 5 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 insert has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

    public function insert(\XoopsObject $obj, $force = false)
    {
        $objectsHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Extras');
        $obj->setVar('field_name', \str_replace(' ', '_', $obj->getVar('field_name')));
        $obj->cleanVars();
Severity: Minor
Found in class/FieldHandler.php - About 5 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

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

        switch ($fct) {
            default:
            case 'title':
            case 'lyrics':
            case 'artist':
Severity: Major
Found in artists.php and 1 other location - About 5 hrs to fix
albums.php on lines 141..161

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

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

        switch ($fct) {
            default:
            case 'title':
            case 'lyrics':
            case 'artist':
Severity: Major
Found in albums.php and 1 other location - About 5 hrs to fix
artists.php on lines 143..163

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

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

    public function _encode($var)
    {
        switch (gettype($var)) {
            case 'boolean':
                return $var ? 'true' : 'false';
Severity: Major
Found in class/JSON.php - About 5 hrs to fix

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

                            if (mb_strlen($_POST['album']) > 0 && !empty($data[$_POST['album']])) {
                                $criteria = new \Criteria('name', $data[$_POST['album']]);
                                if ($albumsHandler->getCount($criteria) > 0) {
                                    $objects = $albumsHandler->getObjects($criteria, false);
                                    $abid    = $objects[0]->getVar('aid');
    Severity: Major
    Found in admin/export.php and 1 other location - About 4 hrs to fix
    admin/export.php on lines 174..186

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

    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['album']) > 0 && !empty($data[$_POST['album']])) {
                                    $criteria = new \Criteria('name', $data[$_POST['album']]);
                                    if ($albumsHandler->getCount($criteria) > 0) {
                                        $objects = $albumsHandler->getObjects($criteria, false);
                                        $abid    = $objects[0]->getVar('aid');
    Severity: Major
    Found in admin/export.php and 1 other location - About 4 hrs to fix
    admin/export.php on lines 270..282

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

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

        public function getEditElement($user, $profile)
        {
            $value = \in_array($this->getVar('field_name'), $this->getPostVars(), true) ? $user->getVar($this->getVar('field_name'), 'e') : $profile->getVar($this->getVar('field_name'), 'e');
            if (null === $value) {
                $value = $this->getVar('field_default');
    Severity: Major
    Found in class/Field.php - About 4 hrs to fix

      Function listBlocks has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

          public function listBlocks(): void
          {
              global $xoopsModule, $pathIcon16;
              require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
              //        xoops_loadLanguage('admin', 'system');
      Severity: Minor
      Found in class/Common/Blocksadmin.php - About 4 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

      Method insert has 115 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function insert(\XoopsObject $obj, $force = false)
          {
              $objectsHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Extras');
              $obj->setVar('field_name', \str_replace(' ', '_', $obj->getVar('field_name')));
              $obj->cleanVars();
      Severity: Major
      Found in class/FieldHandler.php - About 4 hrs to fix

        Method getSearchElement has 114 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getSearchElement()
            {
                $caption = $this->getVar('field_title');
                $caption = \defined($caption) ? \constant($caption) : $caption;
                $name    = $this->getVar('field_name', 'e');
        Severity: Major
        Found in class/Field.php - About 4 hrs to fix

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

                      case 'title':
                          $browse_criteria = new \CriteriaCompo();
                          switch ($value) {
                              case '0':
                                  for ($u = 0; $u < 10; ++$u) {
          Severity: Major
          Found in index.php and 1 other location - About 4 hrs to fix
          index.php on lines 166..181

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

          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

                      case 'lyrics':
                          $browse_criteria = new \CriteriaCompo();
                          switch ($value) {
                              case '0':
                                  for ($u = 0; $u < 10; ++$u) {
          Severity: Major
          Found in index.php and 1 other location - About 4 hrs to fix
          index.php on lines 150..165

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

          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

              public function getImage($field = 'image', $local = false)
              {
                  if ('' == $this->getVar($field)) {
                      return false;
                  }
          Severity: Major
          Found in class/Albums.php and 1 other location - About 4 hrs to fix
          class/Category.php on lines 94..107

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

          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

              public function getImage($field = 'image', $local = false)
              {
                  if ('' == $this->getVar($field)) {
                      return false;
                  }
          Severity: Major
          Found in class/Category.php and 1 other location - About 4 hrs to fix
          class/Albums.php on lines 124..137

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

          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

          File index.php has 347 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php declare(strict_types=1);
          
          use XoopsModules\Songlist\Form\SelectCategoryForm;
          use XoopsModules\Songlist\Form\SelectGenreForm;
          use XoopsModules\Songlist\Form\SelectVoiceForm;
          Severity: Minor
          Found in index.php - About 4 hrs to fix

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

                            if (\is_object($artist) && !$artist->isNew()) {
                                return XOOPS_URL
                                       . '/'
                                       . $GLOBALS['songlistModuleConfig']['baseofurl']
                                       . '/albums/'
            Severity: Major
            Found in class/Albums.php and 1 other location - About 4 hrs to fix
            class/Artists.php on lines 130..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 166.

            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 (\is_object($artist) && !$artist->isNew()) {
                                return XOOPS_URL
                                       . '/'
                                       . $GLOBALS['songlistModuleConfig']['baseofurl']
                                       . '/artists/'
            Severity: Major
            Found in class/Artists.php and 1 other location - About 4 hrs to fix
            class/Albums.php on lines 149..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 166.

            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

                            case 'textbox':
                                $valuetypes = [
                                    \XOBJ_DTYPE_ARRAY   => \_FRM_SONGLIST_FIELDS_ARRAY,
                                    \XOBJ_DTYPE_EMAIL   => \_FRM_SONGLIST_FIELDS_EMAIL,
                                    \XOBJ_DTYPE_INT     => \_FRM_SONGLIST_FIELDS_INT,
            Severity: Major
            Found in class/Form/FormController.php and 1 other location - About 4 hrs to fix
            class/Form/FormController.php on lines 110..126

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

            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