zodern/meteor-up

View on GitHub

Showing 78 of 160 total issues

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

async function retryWithAuth(
  registryConfig,
  { url, method, data, headers: _headers = {} }
) {
  const headers = {
Severity: Minor
Found in src/plugins/meteor/docker-registry.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 status has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function status(api) {
  const servers = Object.values(api.getConfig().servers || {});
  const lines = [];
  let overallColor = 'green';
  const command = 'lsb_release -r -s || echo "false"; lsb_release -is; apt-get -v &> /dev/null && echo "true" || echo "false"; echo $BASH';
Severity: Minor
Found in src/plugins/default/command-handlers.js - About 1 hr to fix

    Function setup has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function setup(api) {
      log('exec => mup meteor setup');
      const config = api.getConfig().app;
    
      if (!config) {
    Severity: Minor
    Found in src/plugins/meteor/command-handlers.js - About 1 hr to fix

      Function ssh has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function ssh(api) {
        const servers = api.getConfig().servers;
        let serverOption = api.getArgs()[1];
      
        // Check how many sessions are enabled. Usually is all servers,
      Severity: Minor
      Found in src/plugins/default/command-handlers.js - About 1 hr to fix

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

        export default function init(api) {
          const configSource = api.resolvePath(__dirname, 'template/mup.js.sample');
          const settingsSource = api.resolvePath(__dirname, 'template/settings.json');
        
          const { appPath, dest, createFolder } = findDestination(api);
        Severity: Minor
        Found in src/plugins/default/init.js - About 1 hr to fix

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

          export async function status(api) {
            const config = api.getConfig();
            const {
              StatusDisplay
            } = api.statusHelpers;
          Severity: Minor
          Found in src/plugins/meteor/command-handlers.js - About 1 hr to fix

            Function setup has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function setup(api) {
              log('exec => mup mongo setup');
              const mongoConfig = api.getConfig().mongo;
            
              if (!mongoConfig) {
            Severity: Minor
            Found in src/plugins/mongo/command-handlers.js - About 1 hr to fix

              Function findDestination has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function findDestination(api) {
                const base = process.cwd();
              
                const inMeteorApp = fs.existsSync(api.resolvePath(base, '.meteor/release'));
                const parentMeteorApp = fs.existsSync(api.resolvePath(base, '../.meteor/release'));
              Severity: Minor
              Found in src/plugins/default/init.js - About 1 hr to fix

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

                export default function buildApp(appPath, buildOptions, verbose, api) {
                  // Check if the folder exists
                  try {
                    fs.statSync(api.resolvePath(appPath));
                  } catch (e) {
                Severity: Minor
                Found in src/plugins/meteor/build.js - About 1 hr to fix

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

                  export async function destroy(api) {
                    const config = api.getConfig();
                    const options = api.getOptions();
                  
                    if (!options.force) {
                  Severity: Minor
                  Found in src/plugins/meteor/command-handlers.js - About 1 hr to fix

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

                    export async function push(api) {
                      log('exec => mup meteor push');
                    
                      await api.runCommand('meteor.build');
                      const {
                    Severity: Minor
                    Found in src/plugins/meteor/command-handlers.js - About 1 hr to fix

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

                      export function runSSHCommand(info, command) {
                        if (info instanceof nodemiral.session) {
                          return runSessionCommand(info, command);
                        }
                      
                      
                      Severity: Minor
                      Found in src/utils.js - About 1 hr to fix

                        Function runSessionCommand has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function runSessionCommand(session, command) {
                          return new Promise((resolve, reject) => {
                            let client;
                            let done;
                        
                        
                        Severity: Minor
                        Found in src/utils.js - About 1 hr to fix

                          Function doCall has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            async function doCall() {
                              tries += 1;
                              try {
                                const result = await axios({
                                  method,
                          Severity: Minor
                          Found in src/plugins/meteor/docker-registry.js - About 1 hr to fix

                            Function findClusters has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function findClusters(serverInfo) {
                              const usedNodeIds = [];
                              const clusters = currentManagers(serverInfo).reduce((result, manager) => {
                                const {
                                  swarm,
                            Severity: Minor
                            Found in src/swarm-utils.js - About 1 hr to fix

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

                                scrubUrl(url) {
                                  const {
                                    protocol,
                                    auth,
                                    hostname,
                              Severity: Minor
                              Found in src/scrub-config.js - About 1 hr to fix

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

                                export function locatePluginDir(name, configPath, appPath) {
                                  log(`loading plugin ${name}`);
                                
                                  if (name.indexOf('.') === 0 || name.indexOf('/') === 0 || name.indexOf('~') === 0) {
                                    log('plugin name is a path to the plugin');
                                Severity: Minor
                                Found in src/load-plugins.js - About 1 hr to fix

                                  Function login has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  async function login(registryConfig, authConfig) {
                                    const query = {};
                                    let url = authConfig.parms.realm;
                                    if (authConfig.parms.service) {
                                      query.service = authConfig.parms.service;
                                  Severity: Minor
                                  Found in src/plugins/meteor/docker-registry.js - About 1 hr to fix

                                    Function showClusters has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export function showClusters(clusters, nodeIds) {
                                      console.log('');
                                      console.log('=> List of Swarm Clusters:');
                                    
                                      Object.keys(clusters).forEach(clusterId => {
                                    Severity: Minor
                                    Found in src/swarm-utils.js - About 1 hr to fix

                                      Function createBuildArgs has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      function createBuildArgs(buildOptions, appPath) {
                                        const args = [
                                          'build',
                                          '--directory',
                                          buildOptions.buildLocation,
                                      Severity: Minor
                                      Found in src/plugins/meteor/build.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language