Saiyan/selim

View on GitHub

Showing 23 of 23 total issues

Function readVersion has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    private function readVersion()
    {
        $this->version = null;
        if ($this->path_ssversion) {
            $content_ssv = file_get_contents($this->path_ssversion);
Severity: Minor
Found in src/classes/SilverstripePage.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

Function readEnvironmentType has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    private function readEnvironmentType()
    {
        $et = $this->matchInConfigPhp("/\\s*Director::set_environment_type\\(\\s*['\"](?<env>dev|live|test*)['\"]\\s*\\);/m");
        if ($et && $et["env"]) {
            $this->envtype = $et["env"][0];
Severity: Minor
Found in src/classes/SilverstripePage.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

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

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $cfg = $this->getSelimConfig($input);
        $skippaths = $input->getOption("skip-known-paths") ? true : false;
        $path = realpath($input->getArgument("path"));
Severity: Minor
Found in src/classes/Commands/FindSitesCommand.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

Method configure has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function configure()
    {
        parent::configure();
        $this
            ->setName('start')
Severity: Minor
Found in src/classes/Commands/DefaultCommand.php - About 1 hr to fix

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

        private function readEmailLogging()
        {
            $m = $this->matchInConfigPhp("/\\s*SS_Log::add_writer\\(\\s*new\\s*SS_LogEmailWriter/m");
            $this->maillog = $m && $m[0] && $m[0][0] ? true : false;
            if ($this->path_configyml) {
    Severity: Minor
    Found in src/classes/SilverstripePage.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 execute has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function execute(InputInterface $input, OutputInterface $output)
        {
            $cfg = $this->getSelimConfig($input);
            $sites = $cfg->getSites();
    
    Severity: Minor
    Found in src/classes/Commands/DefaultCommand.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 execute has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function execute(InputInterface $input, OutputInterface $output)
        {
            $cfg = $this->getSelimConfig($input);
            $sites = $cfg->getSites();
    
    Severity: Minor
    Found in src/classes/Commands/DefaultCommand.php - About 1 hr to fix

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

          protected function execute(InputInterface $input, OutputInterface $output)
          {
              $cfg = $this->getSelimConfig($input);
              $skippaths = $input->getOption("skip-known-paths") ? true : false;
              $path = realpath($input->getArgument("path"));
      Severity: Minor
      Found in src/classes/Commands/FindSitesCommand.php - About 1 hr to fix

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

            public static function filterPagesByEnvironmentType($sspages, $env) {
                $arr = array();
                if(preg_match("/^(dev|test|live)$/",$env) === 1){
                    foreach ($sspages as $sspage) {
                        if (!$sspage instanceof SilverstripePage) {
        Severity: Minor
        Found in src/classes/Util.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 readModules has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            private function readModules()
            {
                $modules = array();
                $proj = basename($this->path_project);
        
        Severity: Minor
        Found in src/classes/SilverstripePage.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 readVersion has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function readVersion()
            {
                $this->version = null;
                if ($this->path_ssversion) {
                    $content_ssv = file_get_contents($this->path_ssversion);
        Severity: Minor
        Found in src/classes/SilverstripePage.php - About 1 hr to fix

          Function setPath has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public function setPath($config_path = "",$is_cli = true) {
                  $dir = dirname($config_path);
                  if(file_exists($dir)) {
                      if(!file_exists($config_path) && $is_cli){
                          echo "The file $config_path doesn't exist. Do you want to create it? yes/[no]";
          Severity: Minor
          Found in src/classes/SelimConfig.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 execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function execute(InputInterface $input, OutputInterface $output)
              {
                  $name = $input->getArgument('name');
                  $cfg = $this->getSelimConfig($input);
          
          
          Severity: Minor
          Found in src/classes/Commands/SecurityCommand.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 __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function __construct()
              {
                  $request = Request::createFromGlobals();
                  $server = $request->server;
                  $selim_foldername = "/.selim/";
          Severity: Minor
          Found in src/classes/SelimConfig.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

          Avoid too many return statements within this method.
          Open

                          return $sspage ? $sspage->getConfigYmlPath() : "_config/config.yml";
          Severity: Major
          Found in src/classes/ConsoleOutputTable.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return "";
            Severity: Major
            Found in src/classes/ConsoleOutputTable.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return $sspage ? $sspage->getEnvironmentType() : "EnvironmentType";
              Severity: Major
              Found in src/classes/ConsoleOutputTable.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return $sspage ? $sspage->getConfigPhpPath() : "_config.php";
                Severity: Major
                Found in src/classes/ConsoleOutputTable.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return $sspage ? self::ModuleText($sspage) : "Modules";
                  Severity: Major
                  Found in src/classes/ConsoleOutputTable.php - About 30 mins to fix

                    Function filterPagesByModules has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function filterPagesByModules(array $sspages, $filterRegex)
                        {
                            $arr = array();
                            foreach ($sspages as $sspage) {
                                if (!$sspage instanceof SilverstripePage) {
                    Severity: Minor
                    Found in src/classes/Util.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