Showing 78 of 160 total issues
Function retryWithAuth
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
async function retryWithAuth(
registryConfig,
{ url, method, data, headers: _headers = {} }
) {
const headers = {
- Read upRead up
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
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';
Function setup
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function setup(api) {
log('exec => mup meteor setup');
const config = api.getConfig().app;
if (!config) {
Function ssh
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
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,
Function init
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
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);
Function status
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export async function status(api) {
const config = api.getConfig();
const {
StatusDisplay
} = api.statusHelpers;
Function setup
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function setup(api) {
log('exec => mup mongo setup');
const mongoConfig = api.getConfig().mongo;
if (!mongoConfig) {
Function findDestination
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
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'));
Function buildApp
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function buildApp(appPath, buildOptions, verbose, api) {
// Check if the folder exists
try {
fs.statSync(api.resolvePath(appPath));
} catch (e) {
Function destroy
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export async function destroy(api) {
const config = api.getConfig();
const options = api.getOptions();
if (!options.force) {
Function push
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export async function push(api) {
log('exec => mup meteor push');
await api.runCommand('meteor.build');
const {
Function runSSHCommand
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function runSSHCommand(info, command) {
if (info instanceof nodemiral.session) {
return runSessionCommand(info, command);
}
Function runSessionCommand
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function runSessionCommand(session, command) {
return new Promise((resolve, reject) => {
let client;
let done;
Function doCall
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function doCall() {
tries += 1;
try {
const result = await axios({
method,
Function findClusters
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function findClusters(serverInfo) {
const usedNodeIds = [];
const clusters = currentManagers(serverInfo).reduce((result, manager) => {
const {
swarm,
Function scrubUrl
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
scrubUrl(url) {
const {
protocol,
auth,
hostname,
Function locatePluginDir
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
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');
Function login
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function login(registryConfig, authConfig) {
const query = {};
let url = authConfig.parms.realm;
if (authConfig.parms.service) {
query.service = authConfig.parms.service;
Function showClusters
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function showClusters(clusters, nodeIds) {
console.log('');
console.log('=> List of Swarm Clusters:');
Object.keys(clusters).forEach(clusterId => {
Function createBuildArgs
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createBuildArgs(buildOptions, appPath) {
const args = [
'build',
'--directory',
buildOptions.buildLocation,