REBELinBLUE/deployer

View on GitHub

Showing 76 of 2,695 total issues

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

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

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

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

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

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

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

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

    public function getBranchUrlAttribute($alternative = null)
    {
        $info = $this->accessDetails();

        if (isset($info['domain']) && isset($info['reference'])) {
Severity: Minor
Found in app/Project.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

Severity
Category
Status
Source
Language