gdbots/pbjc-php

View on GitHub

Showing 75 of 579 total issues

Function validate has a Cognitive Complexity of 156 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate(SchemaDescriptor $a, SchemaDescriptor $b /* ignored */)
    {
        /** @var FieldDescriptor[] $currentFields */
        /** @var FieldDescriptor[] $inheritedFields */
        $currentFields = $a->getFields();
Severity: Minor
Found in src/Validator/SchemaInheritanceFields.php - About 3 days 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 getSchemas has 193 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getSchemas()
    {
        return [
            [
                'schema' => new SchemaDescriptor(
Severity: Major
Found in tests/Generator/JsonSchemaGeneratorTest.php - About 7 hrs to fix

    Function generateManifest has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        public function generateManifest(array $schemas)
        {
            $response = new GeneratorResponse();
            $manifests = ['all' => []];
    
    
    Severity: Minor
    Found in src/Generator/Generator.php - About 5 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 validate has 121 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function validate(SchemaDescriptor $a, SchemaDescriptor $b /* ignored */)
        {
            /** @var FieldDescriptor[] $currentFields */
            /** @var FieldDescriptor[] $inheritedFields */
            $currentFields = $a->getFields();
    Severity: Major
    Found in src/Validator/SchemaInheritanceFields.php - About 4 hrs to fix

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

          public function __construct()
          {
              $enums = [];
              $schemas = [];
      
      
      Severity: Minor
      Found in src/Compiler.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 parse has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          private function parse(array $data)
          {
              $schemaId = SchemaId::fromString($data['id']);
      
              $parameters = [
      Severity: Minor
      Found in src/SchemaParser.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 convertDomElementToArray has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function convertDomElementToArray(\DomElement $element, $checkPrefix = true)
          {
              $prefix = (string)$element->prefix;
              $empty = true;
              $config = [];
      Severity: Minor
      Found in src/Util/XmlUtils.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

      Method getSchemas has 96 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getSchemas()
          {
              return [
                  [
                      'schema' => new SchemaDescriptor(
      Severity: Major
      Found in tests/Generator/PhpGeneratorTest.php - About 3 hrs to fix

        FieldDescriptor has 30 functions (exceeds 20 allowed). Consider refactoring.
        Open

        final class FieldDescriptor
        {
            /**
             * Regular expression pattern for matching a valid field name.  The pattern allows
             * for camelCase fields name but snake_case is recommend.
        Severity: Minor
        Found in src/FieldDescriptor.php - About 3 hrs to fix

          Method generateManifest has 83 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function generateManifest(array $schemas)
              {
                  $response = new GeneratorResponse();
                  $manifests = ['all' => []];
          
          
          Severity: Major
          Found in src/Generator/Generator.php - About 3 hrs to fix

            Function validate has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                public function validate(SchemaDescriptor $a, SchemaDescriptor $b)
                {
                    $fa = array_merge($a->getInheritedFields(), $a->getFields());
                    $fb = array_merge($b->getInheritedFields(), $b->getFields());
            
            
            Severity: Minor
            Found in src/Validator/FieldAttributeEqualTo.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 __construct has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                public function __construct($name, array $parameters)
                {
                    if (!$name || strlen($name) > 127 || preg_match(self::VALID_NAME_PATTERN, $name) === false) {
                        throw new \InvalidArgumentException(
                            sprintf(
            Severity: Minor
            Found in src/FieldDescriptor.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

            FieldDescriptorTest has 25 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class FieldDescriptorTest extends \PHPUnit_Framework_TestCase
            {
                /** FieldDescriptor */
                protected $field;
            
            
            Severity: Minor
            Found in tests/FieldDescriptorTest.php - About 2 hrs to fix

              Generator has 24 functions (exceeds 20 allowed). Consider refactoring.
              Open

              abstract class Generator
              {
                  const TEMPLATE_DIR = __DIR__ . '/Twig/';
                  const LANGUAGE = 'unknown';
                  const EXTENSION = '.unk';
              Severity: Minor
              Found in src/Generator/Generator.php - About 2 hrs to fix

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

                    public function __construct()
                    {
                        $enums = [];
                        $schemas = [];
                
                
                Severity: Major
                Found in src/Compiler.php - About 2 hrs to fix

                  Function run has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function run($language, CompileOptions $options)
                      {
                          $namespaces = $options->getNamespaces();
                  
                          if (!$namespaces || count($namespaces) === 0) {
                  Severity: Minor
                  Found in src/Compiler.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

                  Function loadFile has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function loadFile($file, $schemaOrCallable = null)
                      {
                          $content = @file_get_contents($file);
                          if ('' === trim($content)) {
                              throw new \InvalidArgumentException(sprintf('File %s does not contain valid XML, it is empty.', $file));
                  Severity: Minor
                  Found in src/Util/XmlUtils.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 __construct has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function __construct($name, array $parameters)
                      {
                          if (!$name || strlen($name) > 127 || preg_match(self::VALID_NAME_PATTERN, $name) === false) {
                              throw new \InvalidArgumentException(
                                  sprintf(
                  Severity: Major
                  Found in src/FieldDescriptor.php - About 2 hrs to fix

                    Function validate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function validate(SchemaDescriptor $a, SchemaDescriptor $b)
                        {
                            $fa = array_merge($a->getInheritedFields(), $a->getFields());
                            $fb = array_merge($b->getInheritedFields(), $b->getFields());
                    
                    
                    Severity: Minor
                    Found in src/Validator/FieldMustContainsAnyOfClasses.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

                    File FieldDescriptor.php has 258 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    namespace Gdbots\Pbjc;
                    
                    use Gdbots\Common\Util\NumberUtils;
                    Severity: Minor
                    Found in src/FieldDescriptor.php - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language