quentinrossetti/ruche

View on GitHub

Showing 31 of 31 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  for (i = 0; i < packages.length; i++) {
    wanted.push({
      package: packages[i].split('-')[0],
      version: packages[i].split('-')[1] || false,
      platform: packages[i].split('-')[2] || false,
Severity: Major
Found in lib/ruche/install.js and 1 other location - About 3 hrs to fix
lib/ruche/uninstall.js on lines 22..28

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 112.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  for (i = 0; i < packages.length; i++) {
    wanted.push({
      package: packages[i].split('-')[0],
      version: packages[i].split('-')[1] || false,
      platform: packages[i].split('-')[2] || false,
Severity: Major
Found in lib/ruche/uninstall.js and 1 other location - About 3 hrs to fix
lib/ruche/install.js on lines 26..32

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 112.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    util.emitter.on('tar-start-' + i, function (length) {
      i3++;
      var _len = humanize.filesize(length);
      var _clr = 'c' + (i3 % 6).toString();
      console.log('Extracting %s %s...', long[i3][_clr], _len);
Severity: Major
Found in lib/cli/install.js and 1 other location - About 2 hrs to fix
lib/cli/install.js on lines 35..40

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 89.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    util.emitter.on('dl-start-' + i, function (length) {
      i2++;
      var _len = humanize.filesize(length);
      var _clr = 'c' + (i2 % 6).toString();
      console.log('Downloading %s %s...', long[i2][_clr], _len);
Severity: Major
Found in lib/cli/install.js and 1 other location - About 2 hrs to fix
lib/cli/install.js on lines 41..46

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 89.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  ruche(packages, function (err, data) {
    if (err) {
      cliUtil.error(err);
      if (callback !== undefined) {
        callback(undefined);
Severity: Major
Found in lib/cli/install.js and 1 other location - About 2 hrs to fix
lib/cli/uninstall.js on lines 39..52

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 88.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  ruche(packages, function (err, data) {
    if (err) {
      cliUtil.error(err);
      if (callback !== undefined) {
        callback(undefined);
Severity: Major
Found in lib/cli/uninstall.js and 1 other location - About 2 hrs to fix
lib/cli/install.js on lines 54..67

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 88.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    util.emitter.on('install-' + i, function (res) {
      i1++;
      long[i1]  = res.package + '-' + res.version + '-' + res.platform;
      match[i1] = res;
    });
Severity: Major
Found in lib/cli/install.js and 1 other location - About 2 hrs to fix
lib/cli/uninstall.js on lines 27..31

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 81.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    util.emitter.on('uninstall-' + i, function (res) {
      i1++;
      long[i1]  = res.package + '-' + res.version + '-' + res.platform;
      match[i1] = res;
    });
Severity: Major
Found in lib/cli/uninstall.js and 1 other location - About 2 hrs to fix
lib/cli/install.js on lines 30..34

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 81.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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
Severity
Category
Status
Source
Language