mvanduijker/joomla-cli

View on GitHub

Showing 23 of 23 total issues

Function getVersion has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function getVersion($version)
    {
        if (!is_string($version)) {
            throw new \InvalidArgumentException('Unexpected value, string expected!');
        }
Severity: Minor
Found in src/JoomlaCli/Console/Model/Joomla/Versions.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

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

    protected function installFileFiles(\SimpleXMLElement $element, $target)
    {
        if ($element['folder']) {
            $source = $this->path . '/' . trim((string)$element['folder'], '/');

src/JoomlaCli/Console/Joomla/Extension/Installer/Adapter/Library.php on lines 43..61

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 155.

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

    protected function installLibraryFiles(\SimpleXMLElement $element, $target)
    {
        if ($element['folder']) {
            $source = $this->path . '/' . trim((string)$element['folder'], '/');

src/JoomlaCli/Console/Joomla/Extension/Installer/Adapter/File.php on lines 47..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 155.

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

    protected function retrieveVersions()
    {
        if ($this->versions === null) {
            $repository = escapeshellarg($this->joomlaRepository);
            $result = `git ls-remote $repository | grep -E 'refs/(tags|heads)' | grep -v '{}'`;
Severity: Minor
Found in src/JoomlaCli/Console/Model/Joomla/Versions.php - About 3 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

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

class Application extends JApplicationCli
{
    protected $_messageQueue = array();
    protected $_options      = array();

Severity: Minor
Found in src/JoomlaCli/Console/Joomla/Application.php - About 2 hrs to fix

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

        protected function check(InputInterface $input)
        {
            // check valid joomla installation
            $path = $input->getOption('path');
            if (!file_exists($path)) {
    src/JoomlaCli/Console/Command/Core/UpdateDbCommand.php on lines 64..79
    src/JoomlaCli/Console/Command/Extension/Language/ListCommand.php on lines 75..90

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

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

        protected function check(InputInterface $input)
        {
            // check valid joomla installation
            $path = $input->getOption('path');
            if (!file_exists($path)) {
    Severity: Major
    Found in src/JoomlaCli/Console/Command/Core/UpdateDbCommand.php and 2 other locations - About 2 hrs to fix
    src/JoomlaCli/Console/Command/Extension/Language/InstallCommand.php on lines 69..84
    src/JoomlaCli/Console/Command/Extension/Language/ListCommand.php on lines 75..90

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

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

        protected function check(InputInterface $input)
        {
            // check valid joomla installation
            $path = $input->getOption('path');
            if (!file_exists($path)) {
    src/JoomlaCli/Console/Command/Core/UpdateDbCommand.php on lines 64..79
    src/JoomlaCli/Console/Command/Extension/Language/InstallCommand.php on lines 69..84

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

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

        protected function configure()
        {
            $this
                ->setName('core:install-db')
                ->setDescription('Install default joomla database')
    Severity: Major
    Found in src/JoomlaCli/Console/Command/Core/InstallDbCommand.php - About 2 hrs to fix

      Function installLanguage has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function installLanguage(InputInterface $input, OutputInterface $output)
          {
              $joomlaApp = Bootstrapper::getApplication($input->getOption('path'));
              $joomlaApp->set('list_limit', 10000);
              $lang = $input->getArgument('language');
      Severity: Minor
      Found in src/JoomlaCli/Console/Command/Extension/Language/InstallCommand.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 install has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function install($target)
          {
      
              $client = str_replace('/', '', (string)$this->manifest['client']);
      
      
      Severity: Minor
      Found in src/JoomlaCli/Console/Joomla/Extension/Installer/Adapter/Module.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 installLanguage has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function installLanguage(InputInterface $input, OutputInterface $output)
          {
              $joomlaApp = Bootstrapper::getApplication($input->getOption('path'));
              $joomlaApp->set('list_limit', 10000);
              $lang = $input->getArgument('language');
      Severity: Minor
      Found in src/JoomlaCli/Console/Command/Extension/Language/InstallCommand.php - About 1 hr to fix

        Method createAdminUser has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function createAdminUser()
            {
                $release = array_keys($this->version)[0];
                if (is_numeric(substr($release, 0, 1)) && substr($release, 0, 1) < 3) {
                    // joomla 2.x admin user insert query
        Severity: Minor
        Found in src/JoomlaCli/Console/Command/Core/InstallDbCommand.php - About 1 hr to fix

          Method install has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function install($target)
              {
                  // filter name according to 'cmd' JFilterInput
                  $name = strtolower(preg_replace('/[^A-Z0-9_\.-]/i', '', (string) $this->manifest->name));
          
          

            Method getVersion has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getVersion($version)
                {
                    if (!is_string($version)) {
                        throw new \InvalidArgumentException('Unexpected value, string expected!');
                    }
            Severity: Minor
            Found in src/JoomlaCli/Console/Model/Joomla/Versions.php - About 1 hr to fix

              Method install has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function install($target)
                  {
              
                      $client = str_replace('/', '', (string)$this->manifest['client']);
              
              
              Severity: Minor
              Found in src/JoomlaCli/Console/Joomla/Extension/Installer/Adapter/Module.php - About 1 hr to fix

                Function install has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function install($target)
                    {
                        // filter name according to 'cmd' JFilterInput
                        $name = strtolower(preg_replace('/[^A-Z0-9_\.-]/i', '', (string) $this->manifest->name));
                
                

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

                    public function install($target)
                    {
                
                        $group = str_replace('/', '', (string)$this->manifest['group']);
                
                
                Severity: Minor
                Found in src/JoomlaCli/Console/Joomla/Extension/Installer/Adapter/Plugin.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 installPackageFiles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function installPackageFiles(\SimpleXMLElement $element, $target)
                    {
                        if ($element['folder']) {
                            $source = $this->path . '/' . trim((string)$element['folder'], '/');
                        } else {
                Severity: Minor
                Found in src/JoomlaCli/Console/Joomla/Extension/Installer/Adapter/Package.php - About 55 mins to fix

                Cognitive Complexity

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

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

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

                Further reading

                Function retrieveVersionsFromCache has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function retrieveVersionsFromCache()
                    {
                        // check if file exists and is new enough
                
                        if ($this->cachePath && file_exists($this->cachePath)) {
                Severity: Minor
                Found in src/JoomlaCli/Console/Model/Joomla/Versions.php - About 45 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