octolab/Cleaner

View on GitHub

Showing 7 of 27 total issues

Function clear has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function clear($packagePath, array $devFiles)
    {
        assert(is_string($packagePath));
        assert(is_readable($packagePath));
        $result = array();
Severity: Minor
Found in src/Util/FakeCleaner.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 handlePackage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function handlePackage(PackageInterface $package)
    {
        $packageExtra = $package->getExtra();
        $devFiles = $this->devFiles;
        if (isset($packageExtra[self::EXTRA_KEY])) {
Severity: Minor
Found in src/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 execute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $composer = $this->getComposer();

        // @todo is this a proper way to get current plugin instance?
Severity: Minor
Found in src/Command/ClearCommand.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 optimized has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function optimized(array $patterns)
    {
        $files = array();
        $before = getcwd();
        chdir($cwd = $this->current);
Severity: Minor
Found in src/Util/GlobFinder.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 handlePackage has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function handlePackage(PackageInterface $package)
    {
        $packageExtra = $package->getExtra();
        $devFiles = $this->devFiles;
        if (isset($packageExtra[self::EXTRA_KEY])) {
Severity: Minor
Found in src/Plugin.php - About 1 hr to fix

    Avoid too many return statements within this method.
    Open

                    return array();
    Severity: Major
    Found in src/Util/WeightMatcher.php - About 30 mins to fix

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

          public function normalize(array $devFiles)
          {
              $normalized = array();
              foreach ($devFiles as $i => $value) {
                  if (is_numeric($i) || $i === 'other') {
      Severity: Minor
      Found in src/Util/CategoryNormalizer.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