gdbots/pbjc-php

View on GitHub

Showing 75 of 579 total issues

Method fromFile has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function fromFile($file)
    {
        if (!array_key_exists($file, $this->files)) {
            $xmlData = $this->getXmlData($file);

Severity: Minor
Found in src/SchemaParser.php - About 1 hr to fix

    Function writePbjSchemaStoresFile has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function writePbjSchemaStoresFile(PackageEvent $event)
        {
            if (!$event->isDevMode()) {
                return;
            }
    Severity: Minor
    Found in src/Composer/ScriptHandler.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 11 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function execute(InputInterface $input, OutputInterface $output)
        {
            $io = new SymfonyStyle($input, $output);
    
            $file = $input->getOption('config') ?: sprintf('%s/pbjc.yml', getcwd());
    Severity: Minor
    Found in src/Command/CompileCommand.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 writePbjSchemaStoresFile has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function writePbjSchemaStoresFile(PackageEvent $event)
        {
            if (!$event->isDevMode()) {
                return;
            }
    Severity: Minor
    Found in src/Composer/ScriptHandler.php - About 1 hr to fix

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

          private function getXmlData($file)
          {
              /** @var \DOMDocument $xmlDomDocument */
              if (!$xmlDomDocument = XmlUtils::loadFile($file, __DIR__ . '/../xsd/schema.xsd')) {
                  throw new \RuntimeException(sprintf(
      Severity: Minor
      Found in src/SchemaParser.php - About 1 hr to fix

        Method validate has 28 lines of code (exceeds 25 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 1 hr to fix

          Method phpize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function phpize($value)
              {
                  $value = (string)$value;
                  $lowercaseValue = strtolower($value);
          
          
          Severity: Minor
          Found in src/Util/XmlUtils.php - About 1 hr to fix

            Method testGenerateEnum has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function testGenerateEnum()
                {
                    $enum = new EnumDescriptor('gdbots:tests:some-enum', 'int', ['K1' => 1, 'K2' => 2, 'K3' => 3]);
                    $expected = <<<OUTPUT
            import Enum from '@gdbots/common/Enum';
            Severity: Minor
            Found in tests/Generator/JsGeneratorTest.php - About 1 hr to fix

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

                  public function __construct($id, array $parameters = [])
                  {
                      $this->id = $id instanceof SchemaId ? $id : SchemaId::fromString($id);
              
                      foreach ($parameters as $key => $value) {
              Severity: Minor
              Found in src/SchemaDescriptor.php - About 1 hr to fix

                Function validate has a Cognitive Complexity of 10 (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/FieldMaxLength.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 validate has a Cognitive Complexity of 10 (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/FieldGreaterOrEqualThan.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 validate has a Cognitive Complexity of 10 (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/FieldLessOrEqualThan.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 validate has a Cognitive Complexity of 10 (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/FieldMinLength.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 extractImportsFromFields has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function extractImportsFromFields(array $fields)
                    {
                        $imports = [];
                
                        foreach ($fields as $field) {
                Severity: Minor
                Found in src/Generator/PhpGenerator.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 getPreviousSchema has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function getPreviousSchema(SchemaId $schemaId)
                    {
                        $id = $schemaId->toString();
                
                        if (isset(self::$schemas[$id])) {
                Severity: Minor
                Found in src/SchemaStore.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 validate has a Cognitive Complexity of 9 (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/FieldValidPattern.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 addSchema has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function addSchema(SchemaId $schemaId, SchemaDescriptor $schema)
                    {
                        $curie = $schemaId->getCurie();
                        $curieMajor = $schemaId->getCurieWithMajorRev();
                
                
                Severity: Minor
                Found in src/SchemaStore.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

                Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function __construct($id, $type, array $values, LanguageBag $languages = null, $deprecated = false)
                Severity: Minor
                Found in src/EnumDescriptor.php - About 35 mins to fix

                  Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      private function __construct($vendor, $package, $category, $message, $version)
                  Severity: Minor
                  Found in src/SchemaId.php - About 35 mins to fix

                    Function validate has a Cognitive Complexity of 7 (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/FieldSameEnum.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

                    Severity
                    Category
                    Status
                    Source
                    Language