gdbots/pbjc-php

View on GitHub

Showing 75 of 579 total issues

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

    public function validate(SchemaDescriptor $a, SchemaDescriptor $b /* ignored */)
    {
        $schemaIds = array_merge(
            $this->getExtendsSchemas($a),
            $this->getMixinSchemas($a)
Severity: Minor
Found in src/Validator/SchemaDependencyVersion.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

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/FieldIsNotRequired.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

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/FieldIsRequired.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

Avoid too many return statements within this method.
Open

                return '0x' === $value[0] . $value[1] ? hexdec($value) : (float)$value;
Severity: Major
Found in src/Util/XmlUtils.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return hexdec($value);
    Severity: Major
    Found in src/Util/XmlUtils.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return (float)$value;
      Severity: Major
      Found in src/Util/XmlUtils.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return $value;
        Severity: Major
        Found in src/Util/XmlUtils.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return bindec($value);
          Severity: Major
          Found in src/Util/XmlUtils.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return false;
            Severity: Major
            Found in src/Util/XmlUtils.php - About 30 mins to fix

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

                  public function validate(SchemaDescriptor $a, SchemaDescriptor $b)
                  {
                      foreach ($a->getMixins() as $mixin) {
                          if ($m = $b->getMixin($mixin->getId()->getCurieWithMajorRev())) {
                              if (!$m->isMixinSchema()) {
              Severity: Minor
              Found in src/Validator/SchemaMixinsMustContainsMixin.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 applyNumericOptions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function applyNumericOptions()
                  {
                      if (null !== $this->min) {
                          if (null !== $this->max) {
                              if ($this->min > $this->max) {
              Severity: Minor
              Found in src/FieldDescriptor.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 getLanguageOptions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function getLanguageOptions(array $data)
                  {
                      $options = new LanguageBag();
              
                      foreach ($data as $key => $value) {
              Severity: Minor
              Found in src/EnumParser.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 getOtherSchemaMajorRev has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function getOtherSchemaMajorRev(SchemaId $schemaId)
                  {
                      if (isset(self::$schemasByCurieMajor[$schemaId->getCurieWithMajorRev()])) {
                          if (preg_match_all(
                                  sprintf('/(%s:v[0-9]+)/', $schemaId->getCurie()),
              Severity: Minor
              Found in src/SchemaStore.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 extractImportsFromFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

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

                  private function getLanguageOptions(array $data)
                  {
                      $options = new LanguageBag();
              
                      foreach ($data as $key => $value) {
              Severity: Minor
              Found in src/SchemaParser.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