PressLabs/gitium

View on GitHub

Showing 29 of 4,852 total issues

Function _gitium_status has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function _gitium_status( $update_transient = false ) {
    global $git;

    if ( ! $update_transient && ( false !== ( $changes = get_transient( 'gitium_uncommited_changes' ) ) ) ) {
        return $changes;
Severity: Minor
Found in gitium/functions.php - About 45 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 _call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _call(...$args) {
        $args     = join( ' ', array_map( 'escapeshellarg', $args ) );
        $return   = -1;
        $response = array();
        $env      = $this->get_env();
Severity: Minor
Found in gitium/inc/class-git-wrapper.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 is_git_version has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function is_git_version() {
        $git_version = get_transient( 'gitium_git_version' );

        if ( GITIUM_MIN_GIT_VER > substr( $git_version, 0, 3 ) ) {
            global $git;
Severity: Minor
Found in gitium/inc/class-gitium-requirements.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 _log has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    function _log(...$args) {
        if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) { return; }

        $output = '';
        if (isset($args) && $args) foreach ( $args as $arg ) {
Severity: Minor
Found in gitium/inc/class-git-wrapper.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 gitium_hook_plugin_and_theme_editor_page has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function gitium_hook_plugin_and_theme_editor_page( $hook )
{
    switch ($hook) {
        case 'plugin-editor.php':
            if (isset($_GET['a']) && 'te' == $_GET['a']) {
Severity: Minor
Found in gitium/gitium.php - About 25 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 get_last_commits has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    function get_last_commits( $n = 20 ) {
        list( $return, $message )  = $this->_call( 'log', '-n', $n, '--pretty=format:%s' );
        if ( 0 !== $return ) { return false; }

        list( $return, $response ) = $this->_call( 'log', '-n', $n, '--pretty=format:%h|%an|%ae|%ad|%cn|%ce|%cd' );
Severity: Minor
Found in gitium/inc/class-git-wrapper.php - About 25 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 merge_with_accept_mine has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    function merge_with_accept_mine(...$commits) {
        do_action( 'gitium_before_merge_with_accept_mine' );

        if ( 1 == count($commits) && is_array( $commits[0] ) ) {
            $commits = $commits[0];
Severity: Minor
Found in gitium/inc/class-git-wrapper.php - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    function commit( $message, $author_name = '', $author_email = '' ) {
        $author = '';
        if ( $author_email ) {
            if ( empty( $author_name ) ) {
                $author_name = $author_email;
Severity: Minor
Found in gitium/inc/class-git-wrapper.php - About 25 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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct() {
        global $git;

        list( , $git_private_key ) = gitium_get_keypair();
        $git->set_key( $git_private_key );
Severity: Minor
Found in gitium/inc/class-gitium-admin.php - About 25 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