REBELinBLUE/deployer

View on GitHub

Showing 76 of 2,695 total issues

File InstallApp.php has 400 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace REBELinBLUE\Deployer\Console\Commands;

use Illuminate\Config\Repository as ConfigRepository;
Severity: Minor
Found in app/Console/Commands/InstallApp.php - About 5 hrs to fix

Function submit has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Uploader.prototype.submit = function() {
  const self = this;

  if (window.FormData && self._files) {
    // build a FormData
Severity: Major
Found in resources/assets/src/handlers/uploader.js - About 2 hrs to fix

Function setProjectMembers has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function setProjectMembers(array $members, Project $project)
    {
        $sync = [];

        // Attaching the members to the projects
Severity: Minor
Found in app/Repositories/EloquentProjectRepository.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 getInstallInformation has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getInstallInformation()
    {
        $this->header('Installation details');

        $regions = $this->getTimezoneRegions();
Severity: Major
Found in app/Console/Commands/InstallApp.php - About 2 hrs to fix

Project has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class Project extends Model implements HasPresenter
{
    use SoftDeletes, BroadcastChanges, ProjectRelations;

    const FINISHED     = 0;
Severity: Minor
Found in app/Project.php - About 2 hrs to fix

Deployment has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class Deployment extends Model implements HasPresenter, RuntimeInterface
{
    use SoftDeletes;

    const COMPLETED             = 0;
Severity: Minor
Found in app/Deployment.php - About 2 hrs to fix

File uploader.js has 260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// TODO: Convert to ES6
let iframeCount = 0;

function Uploader(options) {
  if (!(this instanceof Uploader)) {
Severity: Minor
Found in resources/assets/src/handlers/uploader.js - About 2 hrs to fix

Function updateDeployment has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function updateDeployment(data) {
  const container = $(`#deployment_${data.model.id}`);

  if (container.length > 0) {
    const deployment = new Deployment(data.model);
Severity: Major
Found in resources/assets/src/views/Project.js - About 2 hrs to fix

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

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

        $config = base_path('.env');
Severity: Major
Found in app/Console/Commands/InstallApp.php - About 2 hrs to fix

Function save has a Cognitive Complexity of 16 (exceeds 5 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 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

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

    public function handle(Process $process, RefRepositoryInterface $repository)
    {
        $mirror_dir = $this->project->mirrorPath();

        $this->project->refs()->delete();
Severity: Minor
Found in app/Jobs/UpdateGitReferences.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 updateDeployment has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

function updateDeployment(data) {
  const container = $(`#deployment_${data.model.id}`);

  if (container.length > 0) {
    const deployment = new Deployment(data.model);
Severity: Minor
Found in resources/assets/src/views/Project.js - 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 setup has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Uploader.prototype.setup = function() {
  this.form = $(`<form method="post" enctype="multipart/form-data" target="" action="${this.settings.action}" />`);

  this.iframe = newIframe();
  this.form.attr('target', this.iframe.attr('name'));
Severity: Minor
Found in resources/assets/src/handlers/uploader.js - About 1 hr to fix

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

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

Severity
Category
Status
Source
Language