cksource/mgit2

View on GitHub

Showing 24 of 39 total issues

Function afterExecute has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    afterExecute( processedPackages, commandResponses ) {
        if ( !processedPackages.size || !commandResponses.size ) {
            return;
        }

Severity: Minor
Found in lib/commands/status.js - About 5 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 exports has 124 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function( args, options ) {
    const command = getCommandInstance( args[ 0 ] );

    if ( !command ) {
        return;
Severity: Major
Found in lib/index.js - About 4 hrs to fix

    Function afterExecute has 102 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        afterExecute( processedPackages, commandResponses ) {
            if ( !processedPackages.size || !commandResponses.size ) {
                return;
            }
    
    
    Severity: Major
    Found in lib/commands/status.js - About 4 hrs to fix

      Function handleCli has 101 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function handleCli() {
          const meowOptions = {
              autoHelp: false,
              flags: {
                  version: {
      Severity: Major
      Found in index.js - About 4 hrs to fix

        Function execute has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            execute( data ) {
                const log = require( '../utils/log' )();
                const execCommand = require( './exec' );
        
                if ( !data.isRootRepository ) {
        Severity: Major
        Found in lib/commands/sync.js - About 3 hrs to fix

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

          module.exports = function( args, options ) {
              const command = getCommandInstance( args[ 0 ] );
          
              if ( !command ) {
                  return;
          Severity: Minor
          Found in lib/index.js - 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 enqueue has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function enqueue( packageName ) {
                  if ( processedPackages.has( packageName ) ) {
                      return;
                  }
          
          
          Severity: Major
          Found in lib/index.js - About 2 hrs to fix

            Function gitStatusParser has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function gitStatusParser( branchStatus, currentTag ) {
                const responseAsArray = branchStatus.split( '\n' );
                const branchData = responseAsArray.shift();
            
                const branch = branchData.split( '...' )[ 0 ].match( /## (.*)$/ )[ 1 ];
            Severity: Minor
            Found in lib/utils/gitstatusparser.js - About 1 hr to fix

              Function createSingleRow has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      function createSingleRow( data ) {
                          const { packageName, status, commit, mrgitBranch, mrgitTag, latestTag } = data;
                          const statusColumn = [];
              
                          const shouldUseTag = mrgitTag !== undefined;
              Severity: Minor
              Found in lib/commands/status.js - About 1 hr to fix

                Function execute has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    execute( data ) {
                        const log = require( '../utils/log' )();
                        const execCommand = require( './exec' );
                        const branch = data.arguments[ 0 ];
                
                
                Severity: Minor
                Found in lib/commands/close.js - About 1 hr to fix

                  Function _clonePackage has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      _clonePackage( packageDetails, toolOptions, options ) {
                          const log = options.log;
                  
                          return shell( `git clone --progress "${ packageDetails.url }" "${ packageDetails.path }"` )
                              .then( async output => {
                  Severity: Minor
                  Found in lib/commands/sync.js - About 1 hr to fix

                    Function getOptions has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    module.exports = function getOptions( callOptions, cwd ) {
                        const mrgitJsonPath = path.resolve( cwd, 'mrgit.json' );
                    
                        // Default options.
                        let options = {
                    Severity: Minor
                    Found in lib/utils/getoptions.js - About 1 hr to fix

                      Function createForkPool has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      module.exports = function createForkPool( childPath ) {
                          const forkPoolFactory = {
                              create() {
                                  return new Promise( resolve => {
                                      resolve( childProcess.fork( childPath ) );
                      Severity: Minor
                      Found in lib/utils/createforkpool.js - About 1 hr to fix

                        Function afterExecute has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            afterExecute( parsedPackages, commandResponses, toolOptions ) {
                                console.log( chalk.cyan( `${ parsedPackages.size } packages have been processed.` ) );
                        
                                const repositoryResolver = require( toolOptions.resolverPath );
                        
                        
                        Severity: Minor
                        Found in lib/commands/sync.js - About 1 hr to fix

                          Function log has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          module.exports = function log() {
                              const logs = new Map( [
                                  [ 'info', [] ],
                                  [ 'error', [] ]
                              ] );
                          Severity: Minor
                          Found in lib/utils/log.js - About 1 hr to fix

                            Function execute has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                async execute( data ) {
                                    const execCommand = require( './exec' );
                            
                                    let latestTag = null;
                                    let currentTag = null;
                            Severity: Minor
                            Found in lib/commands/status.js - About 1 hr to fix

                              Function execute has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  execute( data ) {
                                      const log = require( '../utils/log' )();
                                      const execCommand = require( './exec' );
                              
                                      let promise;
                              Severity: Minor
                              Found in lib/commands/save.js - About 1 hr to fix

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

                                    afterExecute( processedPackages, commandResponses, toolOptions ) {
                                        const cwd = require( '../utils/getcwd' )();
                                        const mrgitJsonPath = path.join( cwd, 'mrgit.json' );
                                
                                        const tagPattern = /@([^ ~^:?*\\]*?)$/;
                                Severity: Minor
                                Found in lib/commands/save.js - About 1 hr to fix

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

                                  module.exports = function displayLog( packageName, logs, options ) {
                                      const infoLogs = logs.info.filter( l => l.length ).join( '\n' ).trim();
                                      const errorLogs = logs.error.filter( l => l.length ).join( '\n' ).trim();
                                  
                                      const progressPercentage = Math.round( ( options.current / options.all ) * 100 );
                                  Severity: Minor
                                  Found in lib/utils/displaylog.js - About 1 hr to fix

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

                                        execute( data ) {
                                            const log = require( '../utils/log' )();
                                            const execCommand = require( './exec' );
                                    
                                            return execCommand.execute( getExecData( 'git status --branch --porcelain' ) )
                                    Severity: Minor
                                    Found in lib/commands/commit.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language