phonetworks/pho-compiler

View on GitHub

Showing 11 of 11 total issues

Function mapPrototypeVars has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
Open

    protected function mapPrototypeVars(): array
    {
        $prototype_vars = $this->prototype->toArray();
        $new_array = [];
        $is_volatile = false;
Severity: Minor
Found in src/Pho/Compiler/Transcoders/NodeTranscoder.php - About 1 day 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 save has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

    public function save(string $output_dir): void
    {
        $this->logger()->info("Saving begins"); 
        if(!file_exists($output_dir)) {
            mkdir($output_dir);
Severity: Minor
Found in src/Pho/Compiler/Compiler.php - About 6 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 mapPrototypeVars has 159 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function mapPrototypeVars(): array
    {
        $prototype_vars = $this->prototype->toArray();
        $new_array = [];
        $is_volatile = false;
Severity: Major
Found in src/Pho/Compiler/Transcoders/NodeTranscoder.php - About 6 hrs to fix

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

        protected function mapPrototypeVars(): array
        {
            $prototype_vars = $this->prototype->toArray();
            $new_array = [];
            $may_be_persistent = true;
    Severity: Minor
    Found in src/Pho/Compiler/Transcoders/EdgeTranscoder.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 mapPrototypeVars has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function mapPrototypeVars(): array
        {
            $prototype_vars = $this->prototype->toArray();
            $new_array = [];
            $may_be_persistent = true;
    Severity: Major
    Found in src/Pho/Compiler/Transcoders/EdgeTranscoder.php - About 3 hrs to fix

      Method save has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function save(string $output_dir): void
          {
              $this->logger()->info("Saving begins"); 
              if(!file_exists($output_dir)) {
                  mkdir($output_dir);
      Severity: Major
      Found in src/Pho/Compiler/Compiler.php - About 2 hrs to fix

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

            public function assertParity(): void
            {
                $ignored_classes = [];
                $object_exists = false;
                $actor_exists = false;
        Severity: Minor
        Found in src/Pho/Compiler/Inspector.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 _checkFieldDirectives has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected static function _checkFieldDirectives(array $directives): array
            {
                $dirs = [
                    "sha1" => false,
                    "md5" => false,
        Severity: Major
        Found in src/Pho/Compiler/V1/FieldAnalyzer.php - About 2 hrs to fix

          Function _checkFieldDirectives has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              protected static function _checkFieldDirectives(array $directives): array
              {
                  $dirs = [
                      "sha1" => false,
                      "md5" => false,
          Severity: Minor
          Found in src/Pho/Compiler/V1/FieldAnalyzer.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 assertParity has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function assertParity(): void
              {
                  $ignored_classes = [];
                  $object_exists = false;
                  $actor_exists = false;
          Severity: Major
          Found in src/Pho/Compiler/Inspector.php - About 2 hrs to fix

            Method addField has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function addField(string $name, string $type, bool $is_nullable, bool $is_list, bool $is_native, array $constraints, array $directives): void
            Severity: Major
            Found in src/Pho/Compiler/Prototypes/EntityPrototype.php - About 50 mins to fix
              Severity
              Category
              Status
              Source
              Language