Jagepard/Rudra-Framework

View on GitHub

Showing 9 of 18 total issues

Method createClass has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function createClass(string $className, string $table, string $namespace, bool $multiline = false): string
    {
        if ($multiline) {
            return <<<EOT
<?php
Severity: Minor
Found in app/Ship/Command/CreateSeedCommand.php - About 1 hr to fix

    Method actionIndex has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function actionIndex(): void
        {
            Cli::printer("Enter table name: ", "magneta");
            $table = str_replace(PHP_EOL, "", Cli::reader());
    
    
    Severity: Minor
    Found in app/Ship/Command/CreateMigrationCommand.php - About 1 hr to fix

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

          public static function renderLinks(array $links, string $page, $pg_limit, $uri)
          {
              $last = array_key_last($links) + 1;
              ?>
              <!-- FIRST -->
      Severity: Minor
      Found in app/Containers/Web/UI/UI.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 createClass has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function createClass(string $controllerPrefix, string $container): string
          {
              $url = strtolower("$container/$controllerPrefix");
      
              if (Rudra::config()->get("attributes")) {
      Severity: Minor
      Found in app/Ship/Command/CreateControllerCommand.php - About 1 hr to fix

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

            public function actionIndex(): void
            {
                Cli::printer("Enter table name: ", "magneta");
                $table = str_replace(PHP_EOL, "", Cli::reader());
        
        
        Severity: Minor
        Found in app/Ship/Command/CreateMigrationCommand.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 actionIndex has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function actionIndex(): void
            {
                Cli::printer("Enter container (empty for Ship): ", "magneta");
                $container = ucfirst(str_replace(PHP_EOL, "", Cli::reader()));
        
        
        Severity: Minor
        Found in app/Ship/Command/SeedCommand.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 actionIndex has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function actionIndex(): void
            {
                Cli::printer("Enter container name: ", "magneta");
                $container = ucfirst(str_replace(PHP_EOL, "", Cli::reader()));
                $className = $container . 'Controller';
        Severity: Minor
        Found in app/Ship/Command/CreateContainerCommand.php - About 1 hr to fix

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

              public function actionIndex(): void
              {
                  Cli::printer("Enter container (empty for Ship): ", "magneta");
                  $container = ucfirst(str_replace(PHP_EOL, "", Cli::reader()));
          
          
          Severity: Minor
          Found in app/Ship/Command/MigrateCommand.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 handle404 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function handle404($data, string $type = 'db', array $page = []): void
              {
                  if ($type == 'db') {
                      if (count($data) < 1 || !$data) {
                          throw new RouterException('404');
          Severity: Minor
          Found in app/Ship/Errors/Controller/HttpErrorsController.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