REBELinBLUE/deployer

View on GitHub

Showing 2,695 of 2,695 total issues

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

    public function handle(Dispatcher $dispatcher, Requirements $requirements, EnvFile $writer)
    {
        $this->line('');

        if (!$this->checkCanInstall() || !$requirements->check($this)) {
Severity: Minor
Found in app/Console/Commands/UpdateApp.php - About 1 hr to fix

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

    public function save(array $input)
    {
        $path   = base_path('.env');
        $config = $this->filesystem->get($path);

Severity: Minor
Found in app/Console/Commands/Installer/EnvFile.php - About 1 hr to fix

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

    private function shareFileCommands($release_dir, $shared_dir, $project_dir)
    {
        /** @var Collection $files */
        $files = $this->deployment->project->sharedFiles;
        if (!$files->count()) {
Severity: Minor
Found in app/Jobs/DeployProject/ScriptBuilder.php - About 1 hr to fix

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

    public function handle()
    {
        $tmp_dir = storage_path('app/tmp');

        // Clear out old SSH key files and archives
Severity: Minor
Found in app/Console/Commands/ClearOldKeys.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 getTokens has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getTokens(Server $server)
    {
        $releases_dir       = $server->clean_path . '/releases';
        $latest_release_dir = $releases_dir . '/' . $this->deployment->release_id;
        $release_shared_dir = $server->clean_path . '/shared';
Severity: Minor
Found in app/Jobs/DeployProject/ScriptBuilder.php - About 1 hr to fix

Method getEmailInformation has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getEmailInformation()
    {
        $this->header('Email details');

        $email = [];
Severity: Minor
Found in app/Console/Commands/InstallApp.php - About 1 hr to fix

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

    protected function buildTwilioMessage($translation)
    {
        if (is_null($this->url->last_seen)) {
            $last_seen = $this->translator->trans('app.never');
        } else {
Severity: Major
Found in app/Notifications/Configurable/UrlChanged.php and 1 other location - About 1 hr to fix
app/Notifications/Configurable/HeartbeatChanged.php on lines 148..162

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 106.

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

    protected function buildTwilioMessage($translation)
    {
        if (is_null($this->heartbeat->last_activity)) {
            $heard_from = $this->translator->trans('app.never');
        } else {
Severity: Major
Found in app/Notifications/Configurable/HeartbeatChanged.php and 1 other location - About 1 hr to fix
app/Notifications/Configurable/UrlChanged.php on lines 146..160

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 106.

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 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle(Dispatcher $dispatcher, Requirements $requirements, EnvFile $writer)
    {
        $this->line('');

        if (!$this->checkCanInstall() || !$requirements->check($this)) {
Severity: Minor
Found in app/Console/Commands/UpdateApp.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 handle has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle($request, Closure $next, $guard = null)
    {
        $authenticated_user = $this->auth->guard($guard)->user();

        $has_valid_token = false;
Severity: Minor
Found in app/Http/Middleware/RefreshJsonWebToken.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 appendProjectSettings has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    private function appendProjectSettings($payload, Request $request, Project $project)
    {
        // If the payload is empty return false
        if (!is_array($payload) || !count($payload)) {
            return false;
Severity: Minor
Found in app/Http/Controllers/WebhookController.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 handle has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function handle(Dispatcher $dispatcher, Validation $validation)
    {
        $arguments = [
            'name'     => $this->argument('name'),
            'email'    => $this->argument('email'),
Severity: Minor
Found in app/Console/Commands/CreateUser.php - About 1 hr to fix

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

    public function handle(Process $process, Filesystem $filesystem, LogFormatter $formatter)
    {
        $this->server->status      = Server::TESTING;
        $this->server->connect_log = null;
        $this->server->save();
Severity: Minor
Found in app/Jobs/TestServerConnection.php - About 1 hr to fix

Method buildSlackMessage has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function buildSlackMessage($translation, Channel $notification)
    {
        $message = $this->translator->trans($translation);

        $fields = [
Severity: Minor
Found in app/Notifications/Configurable/DeploymentFinished.php - About 1 hr to fix

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

    public function handle()
    {
        $tmp_dir = storage_path('app/tmp');

        // Clear out old SSH key files and archives
Severity: Minor
Found in app/Console/Commands/ClearOldKeys.php - About 1 hr to fix

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

  editModel() {
    super.editModel();

    $(`#${element}_period_${this.model.get('period')}`).prop('checked', true);
  }
Severity: Major
Found in resources/assets/src/views/CheckUrls.js and 1 other location - About 1 hr to fix
resources/assets/src/views/Heartbeats.js on lines 47..51

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 59.

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 viewData has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  viewData() {
    const data = this.model.toJSON();

    let css = 'info';
    let icon = 'clock-o';
Severity: Minor
Found in resources/assets/src/views/Logs.js - About 1 hr to fix

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

  editModel() {
    super.editModel();

    $(`#${element}_interval_${this.model.get('interval')}`).prop('checked', true);
  }
Severity: Major
Found in resources/assets/src/views/Heartbeats.js and 1 other location - About 1 hr to fix
resources/assets/src/views/CheckUrls.js on lines 63..67

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 59.

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 4 locations. Consider refactoring.
Open

<?php

namespace REBELinBLUE\Deployer\Notifications\Configurable;

use Illuminate\Notifications\Messages\MailMessage;
Severity: Major
Found in app/Notifications/Configurable/HeartbeatRecovered.php and 3 other locations - About 1 hr to fix
app/Notifications/Configurable/DeploymentFailed.php on lines 1..68
app/Notifications/Configurable/DeploymentSucceeded.php on lines 1..68
app/Notifications/Configurable/UrlRecovered.php on lines 1..68

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 104.

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 4 locations. Consider refactoring.
Open

<?php

namespace REBELinBLUE\Deployer\Notifications\Configurable;

use Illuminate\Notifications\Messages\MailMessage;
Severity: Major
Found in app/Notifications/Configurable/DeploymentFailed.php and 3 other locations - About 1 hr to fix
app/Notifications/Configurable/DeploymentSucceeded.php on lines 1..68
app/Notifications/Configurable/HeartbeatRecovered.php on lines 1..68
app/Notifications/Configurable/UrlRecovered.php on lines 1..68

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 104.

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

Severity
Category
Status
Source
Language