quentinrossetti/ruche

View on GitHub

Showing 21 of 31 total issues

Function install has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var install = function (packages, callback) {
  var i  = 0;
  var i1 = -1;
  var i2 = -1;
  var i3 = -1;
Severity: Major
Found in lib/ruche/install.js - About 2 hrs to fix

Function install has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var install = function (argv, callback) {
  var i1 = -1;
  var i2 = -1;
  var i3 = -1;
  var i4 = -1;
Severity: Major
Found in lib/cli/install.js - About 2 hrs to fix

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

var uninstall = function (packages, callback) {
  var i = 0;
  var i1 = -1;
  var i2 = -1;
  var wanted     = [];
Severity: Minor
Found in lib/ruche/uninstall.js - About 1 hr to fix

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

var uninstall = function (argv, callback) {
  var i1 = -1;
  var i2 = -1;
  var packages = argv.packages;
  var long  = [];
Severity: Minor
Found in lib/cli/uninstall.js - About 1 hr to fix

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

var argv = function (argv) {

  argv = yargs
    .alias('V', 'version')
    .alias('h', 'help')
Severity: Minor
Found in lib/cli/util/argv.js - About 1 hr to fix

Function i has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    repoReq[i] = request(repoOpts, function (err, res, data) {
      i1++;
      if (err || res.statusCode !== 200) {
        callback(new Error('Can\'t reach URL: %s', repoUrl[i1]), undefined);
        return;
Severity: Minor
Found in lib/ruche/install.js - About 1 hr to fix

Function alternatives has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var alternatives = function (pack, callback) {

  var wanted = {
    package: pack.split('-')[0],
    version: pack.split('-')[1] || false,
Severity: Minor
Found in lib/ruche/alternatives.js - About 1 hr to fix

Function extract has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var extract = function (match, k, callback) {

  var long = match.package + '-' + match.version + '-' + match.platform;
  var share = untilde(rc.dir.share + '/' + match.package);

Severity: Minor
Found in lib/ruche/util/extract.js - About 1 hr to fix

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

var match = function match(wanted, data) {

  function calcVersion(item) {
    var calc = '';
    /*jshint unused:false */
Severity: Minor
Found in lib/ruche/util/match.js - About 1 hr to fix

Function argv has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

var argv = function (argv) {

  argv = yargs
    .alias('V', 'version')
    .alias('h', 'help')
Severity: Minor
Found in lib/cli/util/argv.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 alternatives has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var alternatives = function (argv, callback) {

  var share = util.untilde(rc.dir.share + '/' + argv.package);

  // Get local packages
Severity: Minor
Found in lib/cli/alternatives.js - About 1 hr to fix

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

var register  = function (match, l, callback) {

  if (match.bin === undefined) {
    callback(null);
    return;
Severity: Minor
Found in lib/ruche/util/register.js - About 1 hr to fix

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

var cli = function (argv) {
  argv = cliUtil.argv(argv);

  // Mute stdout for quiet execution
  if (argv.quiet) {
Severity: Minor
Found in lib/cli/index.js - About 1 hr to fix

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

var remove = function (match, i, callback) {

  emitter.emit('unreg-start-' + i);
  var long = match.package + '-' + match.version + '-' + match.platform;
  var binPath;
Severity: Minor
Found in lib/ruche/util/remove.js - About 1 hr to fix

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

var remove = function (match, i, callback) {

  emitter.emit('unreg-start-' + i);
  var long = match.package + '-' + match.version + '-' + match.platform;
  var binPath;
Severity: Minor
Found in lib/ruche/util/remove.js - 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 match has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

var match = function match(wanted, data) {

  function calcVersion(item) {
    var calc = '';
    /*jshint unused:false */
Severity: Minor
Found in lib/ruche/util/match.js - 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 install has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

var install = function (packages, callback) {
  var i  = 0;
  var i1 = -1;
  var i2 = -1;
  var i3 = -1;
Severity: Minor
Found in lib/ruche/install.js - 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 uninstall has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

var uninstall = function (packages, callback) {
  var i = 0;
  var i1 = -1;
  var i2 = -1;
  var wanted     = [];
Severity: Minor
Found in lib/ruche/uninstall.js - 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 function.
Open

  return argv;
Severity: Major
Found in lib/cli/index.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return 'alternatives';
Severity: Major
Found in lib/cli/index.js - About 30 mins to fix
Severity
Category
Status
Source
Language