mvanduijker/joomla-cli

View on GitHub

Showing 18 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

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

    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

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

                    protected function installLanguageFiles(\SimpleXMLElement $element, $target)
                    {
                        $folderPrefix = '';
                        if ($element['folder']) {
                            $folderPrefix = (string)$element['folder'];
                Severity: Minor
                Found in src/JoomlaCli/Console/Joomla/Extension/Installer/Adapter/Base.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

                Function install has a Cognitive Complexity of 7 (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));
                        $name = str_replace(' ', '_', $name); // this is done in joomla, probably will never have spaces, becuase of regexp
                Severity: Minor
                Found in src/JoomlaCli/Console/Joomla/Extension/Installer/Adapter/Template.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 installMediaFiles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function installMediaFiles(\SimpleXMLElement $element, $target)
                    {
                        if ($element['folder']) {
                            $mediaFolder = (string)$element['destination'];
                            if (strpos($mediaFolder, '/../') !== false) {
                Severity: Minor
                Found in src/JoomlaCli/Console/Joomla/Extension/Installer/Adapter/Base.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