deployphp/deployer

View on GitHub

Showing 202 of 202 total issues

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

task('chatwork:notify:failure', function () {
    if (!get('chatwork_token', false)) {
        return;
    }
      
Severity: Major
Found in contrib/chatwork.php and 2 other locations - About 45 mins to fix
contrib/chatwork.php on lines 127..139
contrib/chatwork.php on lines 142..155

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

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

Consider simplifying this complex logical expression.
Open

    if (!is_array($config) ||
        !isset($config['host']) ||
        !isset($config['port']) ||
        !isset($config['username']) ||
        !isset($config['token']) ||
Severity: Major
Found in contrib/cpanel.php - About 40 mins to fix

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

    task('workplace:notify:success', function () {
        if (!get('workplace_webhook', false)) {
            return;
        }
        $url = get('workplace_webhook') . '&message=' . urlencode(get('workplace_success_text'));
    Severity: Minor
    Found in contrib/workplace.php and 1 other location - About 40 mins to fix
    contrib/workplace.php on lines 113..121

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

    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

    task('workplace:notify:failure', function () {
        if (!get('workplace_webhook', false)) {
            return;
        }
        $url = get('workplace_webhook') . '&message=' . urlencode(get('workplace_failure_text'));
    Severity: Minor
    Found in contrib/workplace.php and 1 other location - About 40 mins to fix
    contrib/workplace.php on lines 102..110

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

    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

    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            int $major = 0,
            int $minor = 0,
            int $patch = 0,
            array $pre = array(),
            array $build = array()
    Severity: Minor
    Found in src/Component/PharUpdate/Version/Version.php - About 35 mins to fix

      Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              string $name,
              string $sha1,
              string $url,
              Version $version,
              string $key = null
      Severity: Minor
      Found in src/Component/PharUpdate/Update.php - About 35 mins to fix

        Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                Host $host,
                string $command,
                int $exitCode,
                string $output,
                string $errorOutput
        Severity: Minor
        Found in src/Exception/RunException.php - About 35 mins to fix

          Method option has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function option(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null): void
          Severity: Minor
          Found in src/functions.php - About 35 mins to fix

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

                public static function apply(?array $conditions, Host $host): bool
                {
                    if (empty($conditions)) {
                        return true;
                    }
            Severity: Minor
            Found in src/Selector/Selector.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 send has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function send(?array &$info = null): string
                {
                    if($this->url === '') {
                        throw new \RuntimeException('URL must not be empty to Httpie::send()');
                    }
            Severity: Minor
            Found in src/Utility/Httpie.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 commit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function commit(array $hosts, Task $task): void
                {
                    $row = [];
                    foreach ($this->template as $alias) {
                        $on = "-";
            Severity: Minor
            Found in src/Executor/Planner.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 expand has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function expand(array $hostnames): array
                {
                    $expanded = [];
                    foreach ($hostnames as $hostname) {
                        if (preg_match(self::PATTERN, $hostname, $matches)) {
            Severity: Minor
            Found in src/Host/Range.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 host has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function host(string ...$hostname)
            {
                $deployer = Deployer::get();
                if (count($hostname) === 1 && $deployer->hosts->has($hostname[0])) {
                    return $deployer->hosts->get($hostname[0]);
            Severity: Minor
            Found in src/functions.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 extend has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function extend(string $id, callable $callable)
                {
                    if (!isset($this->keys[$id])) {
                        throw new UnknownIdentifierException($id);
                    }
            Severity: Minor
            Found in src/Component/Pimple/Container.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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function run(Host $host, string $command, array $config = []): string
                {
                    $defaults = [
                        'timeout' => $host->get('default_timeout', 300),
                        'idle_timeout' => null,
            Severity: Minor
            Found in src/Component/Ssh/Client.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

            Avoid too many return statements within this method.
            Open

                            return $y;
            Severity: Major
            Found in src/Component/PharUpdate/Version/Comparator.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return new ProcessRunner($c['pop'], $c['logger']);
              Severity: Major
              Found in src/Deployer.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return new TaskCollection();
                Severity: Major
                Found in src/Deployer.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return !empty($this['log'])
                                  ? new FileHandler($this['log'])
                                  : new NullHandler();
                  Severity: Major
                  Found in src/Deployer.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return "$tag$alias\x1b[0m";
                    Severity: Major
                    Found in src/Support/helpers.php - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language