REBELinBLUE/deployer

View on GitHub

Showing 2,695 of 2,695 total issues

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/UrlRecovered.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/HeartbeatRecovered.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

Function Uploader has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Uploader(options) {
  if (!(this instanceof Uploader)) {
    return new Uploader(options);
  }

Severity: Minor
Found in resources/assets/src/handlers/uploader.js - About 1 hr to fix

Method fail has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function fail(Exception $error)
    {
        $this->deployment->project->status = Project::FAILED;
        $this->deployment->status          = Deployment::FAILED;

Severity: Minor
Found in app/Jobs/DeployProject.php - About 1 hr to fix

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

      if (users[i].pivot.role === 'manager') {
        // This user is a manager
        $(`#${element}_managers`).tagsinput('add', { value: users[i].id, text: users[i].name });
      } else if (users[i].pivot.role === 'user') {
        // This user is a simple user
Severity: Major
Found in resources/assets/src/views/admin/Projects.js and 1 other location - About 1 hr to fix
resources/assets/src/views/admin/Projects.js on lines 92..95

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

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

      } else if (users[i].pivot.role === 'user') {
        // This user is a simple user
        $(`#${element}_users`).tagsinput('add', { value: users[i].id, text: users[i].name });
      }
Severity: Major
Found in resources/assets/src/views/admin/Projects.js and 1 other location - About 1 hr to fix
resources/assets/src/views/admin/Projects.js on lines 89..95

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

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

  listener.onUpdate('project', (data) => {
    $(`#sidebar_project_${data.model.id}`).html(data.model.name);
  });
Severity: Major
Found in resources/assets/src/views/Navigation.js and 1 other location - About 1 hr to fix
resources/assets/src/views/Navigation.js on lines 72..74

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

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

  listener.onUpdate('group', (data) => {
    $(`#sidebar_group_${data.model.id}`).html(data.model.name);
  });
Severity: Major
Found in resources/assets/src/views/Navigation.js and 1 other location - About 1 hr to fix
resources/assets/src/views/Navigation.js on lines 76..78

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

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

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

    let css = 'primary';
    let icon = 'question';
Severity: Minor
Found in resources/assets/src/views/CheckUrls.js - About 1 hr to fix

Method listing has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function listing($target_id, $action)
    {
        $types = [
            'clone'    => Command::DO_CLONE,
            'install'  => Command::DO_INSTALL,
Severity: Minor
Found in app/Http/Controllers/Admin/TemplateController.php - About 1 hr to fix

Function showLogDialog has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function showLogDialog(event) {
  const button = $(event.relatedTarget);
  const dialog = $(event.target);

  const logId = button.attr('id').replace('log_', '');
Severity: Minor
Found in resources/assets/src/views/Logs.js - About 1 hr to fix

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

    public function handle(Process $process, Parser $parser, Filesystem $filesystem)
    {
        $private_key = $filesystem->tempnam(storage_path('app/tmp/'), 'key');
        $filesystem->put($private_key, $this->project->private_key);
        $filesystem->chmod($private_key, 0600);
Severity: Minor
Found in app/Jobs/UpdateGitMirror.php - About 1 hr to fix

Method update has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function update()
    {
        $prev     = base_path('.env.prev');
        $current  = base_path('.env');
        $dist     = base_path('.env.dist');
Severity: Minor
Found in app/Console/Commands/Installer/EnvFile.php - About 1 hr to fix

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

    public function handle(Filesystem $filesystem)
    {
        $this->filesystem = $filesystem;

        $this->waitIfMirroring();
Severity: Minor
Found in app/Jobs/DeployProject.php - About 1 hr to fix

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

    private function runDeploymentStepOnServer(ServerLog $log)
    {
        $process = $this->builder->buildScript($log->server);

        if (!empty($process)) {
Severity: Minor
Found in app/Jobs/DeployProject/RunDeploymentStep.php - About 1 hr to fix

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

    protected function buildSlackMessage($translation, Channel $notification)
    {
        $message = $this->translator->trans($translation, ['job' => $this->heartbeat->name]);
        $url     = route('projects', ['id' => $this->heartbeat->project_id]);

Severity: Minor
Found in app/Notifications/Configurable/HeartbeatChanged.php - About 1 hr to fix

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

    private function verifyDatabaseDetails(array $database)
    {
        if ($database['connection'] === 'sqlite') {
            return $this->filesystem->touch(database_path('database.sqlite'));
        }
Severity: Minor
Found in app/Console/Commands/InstallApp.php - About 1 hr to fix

Function viewData has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    let css = 'primary';
    let icon = 'question';
Severity: Minor
Found in resources/assets/src/views/Servers.js - About 1 hr to fix

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

        return (new SlackMessage())
            ->from(null, $notification->config->icon)
            ->to($notification->config->channel)
            ->attachment(function (SlackAttachment $attachment) use ($message, $fields) {
                $attachment
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 104..114

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

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

        return (new SlackMessage())
            ->from(null, $notification->config->icon)
            ->to($notification->config->channel)
            ->attachment(function (SlackAttachment $attachment) use ($message, $fields) {
                $attachment
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 106..116

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

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