ridaamirini/PHPQueryBuilder

View on GitHub

Showing 8 of 12 total issues

Function runWithConfig has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    private function runWithConfig($output)
    {
        $filename = getcwd() . '/phpqb.json';

        if (!file_exists($filename)) return $output->writeln('<error>No phpqb.json in current dirctory. Please initialize PHPQueryBuilder.</error>');
Severity: Minor
Found in src/PHPQueryBuilder/Command/CommandDump.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

Method runWithConfig has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function runWithConfig($output)
    {
        $filename = getcwd() . '/phpqb.json';

        if (!file_exists($filename)) return $output->writeln('<error>No phpqb.json in current dirctory. Please initialize PHPQueryBuilder.</error>');
Severity: Major
Found in src/PHPQueryBuilder/Command/CommandDump.php - About 3 hrs to fix

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

        public function __construct($fromArray = null)
        {
            if (!empty($fromArray)) {
                foreach ($fromArray as $key => $value) {
                    if (isset($this->{$key})) $this->{$key} = $value;
    Severity: Minor
    Found in src/PHPQueryBuilder/Schema/ConfigFile.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 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function execute(InputInterface $input, OutputInterface $output)
        {
            $collection = $input->getOption('collection');
            $filename = $input->getOption('filename');
    
    
    Severity: Minor
    Found in src/PHPQueryBuilder/Command/CommandDump.php - About 1 hr to fix

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

          protected function execute(InputInterface $input, OutputInterface $output)
          {
              $collection = $input->getOption('collection');
              $filename = $input->getOption('filename');
      
      
      Severity: Minor
      Found in src/PHPQueryBuilder/Command/CommandDump.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 isExcluded has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          private function isExcluded($paths, $exclude)
          {
              for ($i = 0; $i < count($exclude); $i++) $exclude[$i] = $exclude[$i]->getPath();
      
              if (is_array($paths)) {
      Severity: Minor
      Found in src/PHPQueryBuilder/Command/CommandDump.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 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __construct($fromArray = null)
          {
              if (!empty($fromArray)) {
                  foreach ($fromArray as $key => $value) {
                      if (isset($this->{$key})) $this->{$key} = $value;
      Severity: Minor
      Found in src/PHPQueryBuilder/Schema/BaseConfig.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

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

          public function __construct($fromArray = null)
          {
              if (!empty($fromArray)) {
                  foreach ($fromArray as $key => $value) {
                      if (isset($this->{$key})) $this->{$key} = $value;
      Severity: Minor
      Found in src/PHPQueryBuilder/Schema/Exclude.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