GrafiteInc/Blacksmith

View on GitHub

Showing 17 of 17 total issues

Function handle has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle()
    {
        $forge = new Forge(config('blacksmith.forge_token'));
        $serverIds = [$this->option('server')];

Severity: Minor
Found in src/Commands/UpdateSite.php - About 7 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 handle has 150 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function handle()
    {
        $forge = new Forge(config('blacksmith.forge_token'));
        $serverId = $this->option('server');

Severity: Major
Found in src/Commands/BuildSite.php - About 6 hrs to fix

    Function handle has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        public function handle()
        {
            $forge = new Forge(config('blacksmith.forge_token'));
            $serverId = $this->option('server');
    
    
    Severity: Minor
    Found in src/Commands/BuildSite.php - About 5 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 handle has 92 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function handle()
        {
            // Create the .blacksmith directory
            $basePath = base_path('.blacksmith');
    
    
    Severity: Major
    Found in src/Commands/Setup.php - About 3 hrs to fix

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

          public function handle()
          {
              $forge = new Forge(config('blacksmith.forge_token'));
              $serverIds = [$this->option('server')];
      
      
      Severity: Major
      Found in src/Commands/UpdateSite.php - About 2 hrs to fix

        Method handle has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function handle()
            {
                $forge = new Forge(config('blacksmith.forge_token'));
                $basePath = base_path('.blacksmith');
                $config = null;
        Severity: Major
        Found in src/Commands/Localize.php - About 2 hrs to fix

          Method handle has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function handle()
              {
                  $forge = new Forge(config('blacksmith.forge_token'));
          
                  // Handle Server Build
          Severity: Minor
          Found in src/Commands/BuildServer.php - About 1 hr to fix

            Method handle has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function handle()
                {
                    $forge = new Forge(config('blacksmith.forge_token'));
                    $serverIds = [$this->option('server')];
            
            
            Severity: Minor
            Found in src/Commands/UpdateServer.php - About 1 hr to fix

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

                  public function handle()
                  {
                      if (is_null(config('blacksmith.project'))) {
                          $this->error('Please set the project name in the blacksmith config file.');
              
              
              Severity: Minor
              Found in src/Commands/Backup.php - About 1 hr to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        $this->info('"security": [' . PHP_EOL . '    {' . PHP_EOL . '        "name" : "",' . PHP_EOL . '        "path" : "",' . PHP_EOL . '        "credentials": [ {' . PHP_EOL . '            "username" : "",' . PHP_EOL . '            "password" : ""' . PHP_EOL . '        } ]' . PHP_EOL . '    }' . PHP_EOL . '],');
                Severity: Minor
                Found in src/Commands/AddSecurity.php and 1 other location - About 1 hr to fix
                src/Commands/AddWorker.php on lines 32..32

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 100.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        $this->info('"workers": [' . PHP_EOL . '    {' . PHP_EOL . '        "connection" : "database",' . PHP_EOL . '        "queue" : "default",' . PHP_EOL . '        "tries": 1,' . PHP_EOL . '        "timeout": 0,' . PHP_EOL . '        "processes": 1,' . PHP_EOL . '        "stopwaitsecs": 600,' . PHP_EOL . '        "sleep": 10,' . PHP_EOL . '        "force": false,' . PHP_EOL . '        "daemon": true,' . PHP_EOL . '        "php_version": "php"' . PHP_EOL . '    }' . PHP_EOL . '],');
                Severity: Minor
                Found in src/Commands/AddWorker.php and 1 other location - About 1 hr to fix
                src/Commands/AddSecurity.php on lines 32..32

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 100.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    public function handle()
                    {
                        $forge = new Forge(config('blacksmith.forge_token'));
                        $basePath = base_path('.blacksmith');
                        $config = null;
                Severity: Minor
                Found in src/Commands/Localize.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

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                        if (! $this->option('server')) {
                            $serverIds = collect(glob(base_path('.blacksmith') . '/*' , GLOB_ONLYDIR))->map(function ($server) {
                                return Str::of($server)->replace(base_path('.blacksmith/'), '')->toString();
                            })->toArray();
                        }
                Severity: Major
                Found in src/Commands/UpdateServer.php and 2 other locations - About 50 mins to fix
                src/Commands/BuildSite.php on lines 35..39
                src/Commands/UpdateSite.php on lines 35..39

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 97.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                        if (! $this->option('server')) {
                            $serverId = collect(glob(base_path('.blacksmith') . '/*' , GLOB_ONLYDIR))->map(function ($server) {
                                return Str::of($server)->replace(base_path('.blacksmith/'), '')->toString();
                            })->first();
                        }
                Severity: Major
                Found in src/Commands/BuildSite.php and 2 other locations - About 50 mins to fix
                src/Commands/UpdateServer.php on lines 35..39
                src/Commands/UpdateSite.php on lines 35..39

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 97.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                        if (! $this->option('server')) {
                            $serverIds = collect(glob(base_path('.blacksmith') . '/*' , GLOB_ONLYDIR))->map(function ($server) {
                                return Str::of($server)->replace(base_path('.blacksmith/'), '')->toString();
                            })->toArray();
                        }
                Severity: Major
                Found in src/Commands/UpdateSite.php and 2 other locations - About 50 mins to fix
                src/Commands/BuildSite.php on lines 35..39
                src/Commands/UpdateServer.php on lines 35..39

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 97.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    public function handle()
                    {
                        $forge = new Forge(config('blacksmith.forge_token'));
                        $serverIds = [$this->option('server')];
                
                
                Severity: Minor
                Found in src/Commands/UpdateServer.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 handle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function handle()
                    {
                        if (is_null(config('blacksmith.project'))) {
                            $this->error('Please set the project name in the blacksmith config file.');
                
                
                Severity: Minor
                Found in src/Commands/Backup.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