Soullivaneuh/php-cs-fixer-styleci-bridge

View on GitHub

Showing 9 of 9 total issues

Method getConfigTreeBuilder has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('styleci');

Severity: Major
Found in src/StyleCI/Configuration.php - About 2 hrs to fix

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

        public function getFinder()
        {
            // PHP-CS-Fixer 1.x BC
            if (class_exists('\Symfony\CS\Finder')) { // PHP-CS-Fixer >=1.12,<2.0
                $finder = \Symfony\CS\Finder::create()->in($this->finderDirs);
    Severity: Minor
    Found in src/ConfigBridge.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 getFinderConfigurationNode has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function getFinderConfigurationNode()
        {
            $treeBuilder = new TreeBuilder();
            $node = $treeBuilder->root('finder');
    
    
    Severity: Minor
    Found in src/StyleCI/Configuration.php - About 1 hr to fix

      Method __construct has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __construct($styleCIConfigDir = null, $finderDirs = null)
          {
              if (!Semver::satisfies(
                  class_exists('Symfony\CS\Fixer') ? Fixer::VERSION : Application::VERSION, // PHP-CS-Fixer 1.x BC
                  sprintf('>=%s', self::CS_FIXER_MIN_VERSION)
      Severity: Minor
      Found in src/ConfigBridge.php - About 1 hr to fix

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

            public function __construct($styleCIConfigDir = null, $finderDirs = null)
            {
                if (!Semver::satisfies(
                    class_exists('Symfony\CS\Fixer') ? Fixer::VERSION : Application::VERSION, // PHP-CS-Fixer 1.x BC
                    sprintf('>=%s', self::CS_FIXER_MIN_VERSION)
        Severity: Minor
        Found in src/ConfigBridge.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 create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function create($styleCIConfigDir = null, $finderDirs = null)
            {
                $bridge = new static($styleCIConfigDir, $finderDirs);
        
                if (class_exists('\Symfony\CS\Config')) { // PHP-CS-Fixer >=1.12,<2.0
        Severity: Minor
        Found in src/ConfigBridge.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 getRules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getRules()
            {
                $fixers = $this->getFixers();
        
                $rules = array();
        Severity: Minor
        Found in src/ConfigBridge.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 $treeBuilder;
        Severity: Major
        Found in src/StyleCI/Configuration.php - About 30 mins to fix

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

              private function resolveAliases(array $fixers)
              {
                  foreach (Fixers::$aliases as $alias => $name) {
                      if (in_array($alias, $fixers, true) && !in_array($name, $fixers, true) && $this->isFixerAvailable($name)) {
                          array_push($fixers, $name);
          Severity: Minor
          Found in src/ConfigBridge.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