pixelink/typo3-simplepoll

View on GitHub

Showing 17 of 17 total issues

SimplePoll has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

class SimplePoll extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {

    /**
     * The question of the poll
     *
Severity: Minor
Found in Classes/Domain/Model/SimplePoll.php - About 2 hrs to fix

    Function listAction has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function listAction()
        {
    
            // Use stdWrap for settings.simplepoll.uid
            if (isset($this->settings['simplepoll']['useStdWrap']) && !empty($this->settings['simplepoll']['useStdWrap'])) {
    Severity: Minor
    Found in Classes/Controller/SimplePollController.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

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

            'starttime' => [
                'exclude' => true,
                'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
                'config' => [
                    'type' => 'input',
    Severity: Major
    Found in Configuration/TCA/tx_simplepoll_domain_model_iplock.php and 5 other locations - About 2 hrs to fix
    Configuration/TCA/tx_simplepoll_domain_model_answer.php on lines 93..110
    Configuration/TCA/tx_simplepoll_domain_model_answer.php on lines 111..128
    Configuration/TCA/tx_simplepoll_domain_model_iplock.php on lines 108..125
    Configuration/TCA/tx_simplepoll_domain_model_simplepoll.php on lines 87..104
    Configuration/TCA/tx_simplepoll_domain_model_simplepoll.php on lines 105..122

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

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

            'endtime' => [
                'exclude' => true,
                'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
                'config' => [
                    'type' => 'input',
    Severity: Major
    Found in Configuration/TCA/tx_simplepoll_domain_model_answer.php and 5 other locations - About 2 hrs to fix
    Configuration/TCA/tx_simplepoll_domain_model_answer.php on lines 93..110
    Configuration/TCA/tx_simplepoll_domain_model_iplock.php on lines 90..107
    Configuration/TCA/tx_simplepoll_domain_model_iplock.php on lines 108..125
    Configuration/TCA/tx_simplepoll_domain_model_simplepoll.php on lines 87..104
    Configuration/TCA/tx_simplepoll_domain_model_simplepoll.php on lines 105..122

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

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

            'endtime' => [
                'exclude' => true,
                'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
                'config' => [
                    'type' => 'input',
    Severity: Major
    Found in Configuration/TCA/tx_simplepoll_domain_model_simplepoll.php and 5 other locations - About 2 hrs to fix
    Configuration/TCA/tx_simplepoll_domain_model_answer.php on lines 93..110
    Configuration/TCA/tx_simplepoll_domain_model_answer.php on lines 111..128
    Configuration/TCA/tx_simplepoll_domain_model_iplock.php on lines 90..107
    Configuration/TCA/tx_simplepoll_domain_model_iplock.php on lines 108..125
    Configuration/TCA/tx_simplepoll_domain_model_simplepoll.php on lines 87..104

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

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

            'starttime' => [
                'exclude' => true,
                'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
                'config' => [
                    'type' => 'input',
    Severity: Major
    Found in Configuration/TCA/tx_simplepoll_domain_model_answer.php and 5 other locations - About 2 hrs to fix
    Configuration/TCA/tx_simplepoll_domain_model_answer.php on lines 111..128
    Configuration/TCA/tx_simplepoll_domain_model_iplock.php on lines 90..107
    Configuration/TCA/tx_simplepoll_domain_model_iplock.php on lines 108..125
    Configuration/TCA/tx_simplepoll_domain_model_simplepoll.php on lines 87..104
    Configuration/TCA/tx_simplepoll_domain_model_simplepoll.php on lines 105..122

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

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

            'endtime' => [
                'exclude' => true,
                'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
                'config' => [
                    'type' => 'input',
    Severity: Major
    Found in Configuration/TCA/tx_simplepoll_domain_model_iplock.php and 5 other locations - About 2 hrs to fix
    Configuration/TCA/tx_simplepoll_domain_model_answer.php on lines 93..110
    Configuration/TCA/tx_simplepoll_domain_model_answer.php on lines 111..128
    Configuration/TCA/tx_simplepoll_domain_model_iplock.php on lines 90..107
    Configuration/TCA/tx_simplepoll_domain_model_simplepoll.php on lines 87..104
    Configuration/TCA/tx_simplepoll_domain_model_simplepoll.php on lines 105..122

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

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

            'starttime' => [
                'exclude' => true,
                'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
                'config' => [
                    'type' => 'input',
    Severity: Major
    Found in Configuration/TCA/tx_simplepoll_domain_model_simplepoll.php and 5 other locations - About 2 hrs to fix
    Configuration/TCA/tx_simplepoll_domain_model_answer.php on lines 93..110
    Configuration/TCA/tx_simplepoll_domain_model_answer.php on lines 111..128
    Configuration/TCA/tx_simplepoll_domain_model_iplock.php on lines 90..107
    Configuration/TCA/tx_simplepoll_domain_model_iplock.php on lines 108..125
    Configuration/TCA/tx_simplepoll_domain_model_simplepoll.php on lines 105..122

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

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

        public function listAction()
        {
    
            // Use stdWrap for settings.simplepoll.uid
            if (isset($this->settings['simplepoll']['useStdWrap']) && !empty($this->settings['simplepoll']['useStdWrap'])) {
    Severity: Minor
    Found in Classes/Controller/SimplePollController.php - About 1 hr to fix

      Function checkVoteOkFromIp has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function checkVoteOkFromIp(\Pixelink\Simplepoll\Domain\Model\SimplePoll $simplePoll, $onlyCheck = false)
          {
              $ipBlock = $this->settings['ipBlock'];
              if (!(strtolower($ipBlock) == 'true' || $ipBlock == '1')) {
                  // IPs are not blocked, so the user can vote
      Severity: Minor
      Found in Classes/Controller/SimplePollController.php - About 1 hr 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 voteAction has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public function voteAction(\Pixelink\Simplepoll\Domain\Model\SimplePoll $simplePoll)
          {
              if ($this->request->hasArgument('simplePollRadio')) {
                  $voteId = $this->request->getArgument('simplePollRadio');
              } else {
      Severity: Minor
      Found in Classes/Controller/SimplePollController.php - About 1 hr 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 checkVoteOkFromCookie has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function checkVoteOkFromCookie(\Pixelink\Simplepoll\Domain\Model\SimplePoll $simplePoll, $onlyCheck = false)
          {
              // get the settings for cookie blocking
              $cookieBlock = $this->settings['cookieBlock'];
              if (!(strtolower($cookieBlock) == 'true' || $cookieBlock == '1')) {
      Severity: Minor
      Found in Classes/Controller/SimplePollController.php - About 1 hr 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 checkVoteOkFromIp has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function checkVoteOkFromIp(\Pixelink\Simplepoll\Domain\Model\SimplePoll $simplePoll, $onlyCheck = false)
          {
              $ipBlock = $this->settings['ipBlock'];
              if (!(strtolower($ipBlock) == 'true' || $ipBlock == '1')) {
                  // IPs are not blocked, so the user can vote
      Severity: Minor
      Found in Classes/Controller/SimplePollController.php - About 1 hr to fix

        Method voteAction has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function voteAction(\Pixelink\Simplepoll\Domain\Model\SimplePoll $simplePoll)
            {
                if ($this->request->hasArgument('simplePollRadio')) {
                    $voteId = $this->request->getArgument('simplePollRadio');
                } else {
        Severity: Minor
        Found in Classes/Controller/SimplePollController.php - About 1 hr to fix

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

              'ctrl' => [
                  'title'    => 'LLL:EXT:simplepoll/Resources/Private/Language/locallang_db.xlf:tx_simplepoll_domain_model_simplepoll',
                  'label' => 'question',
                  'tstamp' => 'tstamp',
                  'crdate' => 'crdate',
          Severity: Minor
          Found in Configuration/TCA/tx_simplepoll_domain_model_simplepoll.php and 1 other location - About 55 mins to fix
          Configuration/TCA/tx_simplepoll_domain_model_iplock.php on lines 5..24

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

          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

              'ctrl' => [
                  'title'    => 'LLL:EXT:simplepoll/Resources/Private/Language/locallang_db.xlf:tx_simplepoll_domain_model_iplock',
                  'label' => 'address',
                  'tstamp' => 'tstamp',
                  'crdate' => 'crdate',
          Severity: Minor
          Found in Configuration/TCA/tx_simplepoll_domain_model_iplock.php and 1 other location - About 55 mins to fix
          Configuration/TCA/tx_simplepoll_domain_model_simplepoll.php on lines 5..24

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

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

              protected function cleanupIpLocks(\Pixelink\Simplepoll\Domain\Model\SimplePoll $simplePoll)
              {
                  // get the interval from the settigs which tell how long a user is not allowed to vote again
                  $garbageCollectorInterval = $this->settings['garbageCollectorInterval'];
                  $currentTime = new \DateTime;
          Severity: Minor
          Found in Classes/Controller/SimplePollController.php - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Severity
          Category
          Status
          Source
          Language