wow-apps/symfony-proxybonanza

View on GitHub

Showing 16 of 16 total issues

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

        if ($listShow == 'all' || $listShow == 'remote') {
            $symfonyStyle->section(' List of remote proxies: ');

            $pbPlans = $proxyBonanza->getRemotePlans();
            $pbPlans = $proxyBonanza->getRemotePacks($pbPlans);
Severity: Major
Found in Command/ProxybonanzaListCommand.php and 1 other location - About 5 hrs to fix
Command/ProxybonanzaListCommand.php on lines 65..93

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

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 ($listShow == 'all' || $listShow == 'local') {
            $symfonyStyle->section(' List of local proxies: ');

            $pbPlans = $proxyBonanza->getLocalPlans();
            $pbPlans = $proxyBonanza->getLocalPlansProxies($pbPlans);
Severity: Major
Found in Command/ProxybonanzaListCommand.php and 1 other location - About 5 hrs to fix
Command/ProxybonanzaListCommand.php on lines 95..123

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

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

Plan has 30 functions (exceeds 20 allowed). Consider refactoring.
Open

class Plan
{
    const TABLE_NAME = 'proxybonanza_plan';

    /**
Severity: Minor
Found in Entity/Plan.php - About 3 hrs to fix

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

        protected function execute(InputInterface $input, OutputInterface $output)
        {
            $timeStart = microtime(true);
            $listShow = 'all';
    
    
    Severity: Major
    Found in Command/ProxybonanzaListCommand.php - About 2 hrs to fix

      Function execute has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function execute(InputInterface $input, OutputInterface $output)
          {
              $timeStart = microtime(true);
              $listShow = 'all';
      
      
      Severity: Minor
      Found in Command/ProxybonanzaListCommand.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 getRemotePlans has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function getRemotePlans(ProxyBonanza $proxyBonanza, SymfonyStyle $symfonyStyle)
          {
      
              $symfonyStyle->section(' Getting remote data from ProxyBonanza ');
      
      
      Severity: Minor
      Found in Command/ProxybonanzaUpdateCommand.php - About 1 hr to fix

        Method execute has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function execute(InputInterface $input, OutputInterface $output)
            {
                $timeStart = microtime(true);
        
                /** @var ProxyBonanza $proxyBonanza */
        Severity: Minor
        Found in Command/ProxybonanzaTestCommand.php - About 1 hr to fix

          Method getRemotePacks has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getRemotePacks(\ArrayObject $pbPlans): \ArrayObject
              {
                  if (!$pbPlans->count()) {
                      throw new \InvalidArgumentException('Can\'t get ip packs for empty plans');
                  }
          Severity: Minor
          Found in Service/ProxyBonanza.php - About 1 hr to fix

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

                        if ($brokenProxies->count()) {
                            $symfonyStyle->warning(sprintf('%d remote proxies doesn\'t work!', $brokenProxies->count()));
            
                            $header = [
                                'ip',
            Severity: Major
            Found in Command/ProxybonanzaUpdateCommand.php and 1 other location - About 1 hr to fix
            Command/ProxybonanzaTestCommand.php on lines 83..106

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

            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

                    } else {
                        $symfonyStyle->warning(sprintf('%d local proxies doesn\'t work!', $brokenProxies->count()));
            
                        $header = [
                            'ip',
            Severity: Major
            Found in Command/ProxybonanzaTestCommand.php and 1 other location - About 1 hr to fix
            Command/ProxybonanzaUpdateCommand.php on lines 172..197

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

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

                public function getRemotePacks(\ArrayObject $pbPlans): \ArrayObject
                {
                    if (!$pbPlans->count()) {
                        throw new \InvalidArgumentException('Can\'t get ip packs for empty plans');
                    }
            Severity: Minor
            Found in Service/ProxyBonanza.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 testProxies has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                private function testProxies(
                    ProxyBonanza $proxyBonanza,
                    \ArrayObject $pbPlans,
                    SymfonyStyle $symfonyStyle
                ) {
            Severity: Minor
            Found in Command/ProxybonanzaUpdateCommand.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 testProxies has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function testProxies(
                    ProxyBonanza $proxyBonanza,
                    \ArrayObject $pbPlans,
                    SymfonyStyle $symfonyStyle
                ) {
            Severity: Minor
            Found in Command/ProxybonanzaUpdateCommand.php - About 1 hr to fix

              Function execute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function execute(InputInterface $input, OutputInterface $output)
                  {
                      $timeStart = microtime(true);
              
                      /** @var ProxyBonanza $proxyBonanza */
              Severity: Minor
              Found in Command/ProxybonanzaTestCommand.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 insertAuthIps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function insertAuthIps(\ArrayObject $pbPlans): bool
                  {
                      if (!$pbPlans->count()) {
                          return false;
                      }
              Severity: Minor
              Found in Repository/AuthIpsRepository.php - About 35 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 insertProxies has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function insertProxies(\ArrayObject $pbPlans): bool
                  {
                      if (!$pbPlans->count()) {
                          return false;
                      }
              Severity: Minor
              Found in Repository/ProxiesRepository.php - About 35 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