wol-soft/php-json-schema-model-generator

View on GitHub

Showing 387 of 387 total issues

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

    public function __construct(
        SchemaProcessor $schemaProcessor,
        Schema $schema,
        JsonSchema $itemStructure,
        PropertyInterface $property,
Severity: Minor
Found in src/Model/Validator/ArrayItemValidator.php - About 1 hr to fix

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

        public function process(Schema $schema, GeneratorConfiguration $generatorConfiguration): void
        {
            $json = $schema->getJsonSchema()->getJson();
    
            if ((!$this->addForModelsWithoutAdditionalPropertiesDefinition && !isset($json['additionalProperties']))

      Function addAdditionalPropertiesSerialization has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          public function addAdditionalPropertiesSerialization(
              Schema $schema,
              GeneratorConfiguration $generatorConfiguration,
          ): void {
              $validationProperty = null;

      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 validateEnum has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          private function validateEnum(PropertyInterface $property): bool
          {
              $throw = function (string $message) use ($property): void {
                  throw new SchemaException(
                      sprintf(
      Severity: Minor
      Found in src/SchemaProcessor/PostProcessor/EnumPostProcessor.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 addComposedValueValidator has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function addComposedValueValidator(PropertyInterface $property, JsonSchema $propertySchema): void
          {
              $composedValueKeywords = ['allOf', 'anyOf', 'oneOf', 'not', 'if'];
              $propertyFactory = new PropertyFactory(new ComposedValueProcessorFactory($property instanceof BaseProperty));
      
      
      Severity: Minor
      Found in src/PropertyProcessor/Property/AbstractPropertyProcessor.php - About 1 hr to fix

        Method addSetAdditionalPropertyMethod has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function addSetAdditionalPropertyMethod(
                Schema $schema,
                GeneratorConfiguration $generatorConfiguration,
                ?PropertyInterface $validationProperty,
            ): void {

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

              public function __construct(
                  SchemaProcessor $schemaProcessor,
                  Schema $schema,
                  string $pattern,
                  JsonSchema $propertyStructure,
          Severity: Minor
          Found in src/Model/Validator/PatternPropertiesValidator.php - About 1 hr to fix

            Method process has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function process(string $propertyName, JsonSchema $propertySchema): PropertyInterface
                {
                    $path = [];
                    $reference = $propertySchema->getJson()['$ref'];
                    $dictionary = $this->schema->getSchemaDictionary();
            Severity: Minor
            Found in src/PropertyProcessor/Property/ReferenceProcessor.php - About 1 hr to fix

              Method addEnumValidator has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function addEnumValidator(PropertyInterface $property, array $allowedValues): void
                  {
                      if (empty($allowedValues)) {
                          throw new SchemaException(
                              sprintf(
              Severity: Minor
              Found in src/PropertyProcessor/Property/AbstractPropertyProcessor.php - About 1 hr to fix

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

                    public function __construct(
                        SchemaProcessor $schemaProcessor,
                        Schema $schema,
                        JsonSchema $propertiesStructure,
                        string $propertyName,
                Severity: Minor
                Found in src/Model/Validator/ArrayTupleValidator.php - About 1 hr to fix

                  Method addTransformedValuePassThrough has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function addTransformedValuePassThrough(
                          PropertyInterface $property,
                          TransformingFilterInterface $filter,
                          ReflectionType $filteredType,
                      ): void {
                  Severity: Minor
                  Found in src/PropertyProcessor/Filter/FilterProcessor.php - About 1 hr to fix

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

                        public function addFilter(FilterInterface ...$additionalFilter): self
                        {
                            foreach ($additionalFilter as $filter) {
                                $this->validateFilterCallback(
                                    $filter->getFilter(),
                    Severity: Minor
                    Found in src/Model/GeneratorConfiguration.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 addComposedValueValidator has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function addComposedValueValidator(PropertyInterface $property, JsonSchema $propertySchema): void
                        {
                            $composedValueKeywords = ['allOf', 'anyOf', 'oneOf', 'not', 'if'];
                            $propertyFactory = new PropertyFactory(new ComposedValueProcessorFactory($property instanceof BaseProperty));
                    
                    
                    Severity: Minor
                    Found in src/PropertyProcessor/Property/AbstractPropertyProcessor.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 transferComposedPropertiesToSchema has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function transferComposedPropertiesToSchema(PropertyInterface $property): void
                        {
                            foreach ($property->getValidators() as $validator) {
                                $validator = $validator->getValidator();
                    
                    
                    Severity: Minor
                    Found in src/PropertyProcessor/Property/BaseProcessor.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 resolveReference has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function resolveReference(
                            string $propertyName,
                            array $path,
                            PropertyMetaDataCollection $propertyMetaDataCollection,
                        ): PropertyInterface {
                    Severity: Minor
                    Found in src/Model/SchemaDefinition/SchemaDefinition.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 processSubProperties has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function processSubProperties(
                            string $propertyName,
                            JsonSchema $propertySchema,
                            PropertyInterface $property,
                        ): array {
                    Severity: Minor
                    Found in src/PropertyProcessor/Property/MultiTypeProcessor.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

                    Avoid variables with short names like $b. Configured minimum length is 3.
                    Open

                                        function ($a, $b): int { return $a === $b ? 0 : 1; },

                    ShortVariable

                    Since: 0.2

                    Detects when a field, local, or parameter has a very short name.

                    Example

                    class Something {
                        private $q = 15; // VIOLATION - Field
                        public static function main( array $as ) { // VIOLATION - Formal
                            $r = 20 + $this->q; // VIOLATION - Local
                            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                $r += $this->q;
                            }
                        }
                    }

                    Source https://phpmd.org/rules/naming.html#shortvariable

                    Avoid variables with short names like $di. Configured minimum length is 3.
                    Open

                            $di = new RecursiveDirectoryIterator($modelPath, FilesystemIterator::SKIP_DOTS);
                    Severity: Minor
                    Found in src/ModelGenerator.php by phpmd

                    ShortVariable

                    Since: 0.2

                    Detects when a field, local, or parameter has a very short name.

                    Example

                    class Something {
                        private $q = 15; // VIOLATION - Field
                        public static function main( array $as ) { // VIOLATION - Formal
                            $r = 20 + $this->q; // VIOLATION - Local
                            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                $r += $this->q;
                            }
                        }
                    }

                    Source https://phpmd.org/rules/naming.html#shortvariable

                    Avoid variables with short names like $a. Configured minimum length is 3.
                    Open

                                        function ($a, $b): int { return $a === $b ? 0 : 1; },

                    ShortVariable

                    Since: 0.2

                    Detects when a field, local, or parameter has a very short name.

                    Example

                    class Something {
                        private $q = 15; // VIOLATION - Field
                        public static function main( array $as ) { // VIOLATION - Formal
                            $r = 20 + $this->q; // VIOLATION - Local
                            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                $r += $this->q;
                            }
                        }
                    }

                    Source https://phpmd.org/rules/naming.html#shortvariable

                    Avoid variables with short names like $ri. Configured minimum length is 3.
                    Open

                            $ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST);
                    Severity: Minor
                    Found in src/ModelGenerator.php by phpmd

                    ShortVariable

                    Since: 0.2

                    Detects when a field, local, or parameter has a very short name.

                    Example

                    class Something {
                        private $q = 15; // VIOLATION - Field
                        public static function main( array $as ) { // VIOLATION - Formal
                            $r = 20 + $this->q; // VIOLATION - Local
                            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                $r += $this->q;
                            }
                        }
                    }

                    Source https://phpmd.org/rules/naming.html#shortvariable

                    Severity
                    Category
                    Status
                    Source
                    Language