bq/corbel-composr

View on GitHub

Showing 59 of 59 total issues

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

Worker.prototype._removePhrase = function (domain, id) {
  this.engine.composr.Phrase.unregister(domain, id)
}
Severity: Minor
Found in src/lib/rabbitMQworker.js and 1 other location - About 30 mins to fix
src/lib/rabbitMQworker.js on lines 70..72

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 45.

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

  return currentProps.reduce(function (obj, property) {
    if (!obj[property]) throw new Error('Property does not exists in obj: ' + property)
    return obj[property]
  }, obj)
Severity: Minor
Found in src/utils/proxify.js and 1 other location - About 30 mins to fix
src/utils/proxify.js on lines 4..7

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 45.

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

  prop.reduce(function (obj, property) {
    if (!obj[property]) throw new Error('Property does not exists in obj: ' + property)
    return obj[property]
  }, obj)
Severity: Minor
Found in src/utils/proxify.js and 1 other location - About 30 mins to fix
src/utils/proxify.js on lines 20..23

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 45.

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 _doWorkWithPhraseOrSnippet has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

Worker.prototype._doWorkWithPhraseOrSnippet = function (itemIsPhrase, id, action) {
  var domain = utils.extractDomainFromId(id)
  switch (action) {
    case 'DELETE':
      logger.info('[RabbitMQ Eworker]', 'RabbitMQ-worker triggered DELETE event', id, 'domain:' + domain)
Severity: Minor
Found in src/lib/rabbitMQworker.js - About 25 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 exports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function (restify, server, logger) {
  /* *************************************
    Sanitize Path
  **************************************/
  var sanitize = require('../utils/prePath')
Severity: Minor
Found in src/middlewares/http.js - About 25 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 outputSystemInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  outputSystemInfo: function (localMode) {
    logger.info('[Engine]', '=========== System information ===========')

    if (localMode) {
      logger.info('[Engine]', '    >>> Launching server in local mode')
Severity: Minor
Found in src/lib/engine.js - About 25 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

TODO found
Open

// TODO: Only support for v4 schema!
Severity: Minor
Found in src/lib/phraseHooks/mockHook.js by fixme

TODO found
Open

// TODO: Maybe we can find better packages than these
Severity: Minor
Found in src/lib/phraseHooks/validateHook.js by fixme

TODO found
Open

          // @TODO: If cannot create channel, retry N times to create channel.
Severity: Minor
Found in src/lib/rabbitMQworker.js by fixme

TODO found
Open

      // @TODO: log error in metrics
Severity: Minor
Found in src/lib/router.js by fixme

TODO found
Open

### TODO LIST
Severity: Minor
Found in README.md by fixme

TODO found
Open

 * TODO: Implement the the delete mechanism using the core driver
Severity: Minor
Found in src/routes/BaseResource.endpoint.js by fixme

TODO found
Open

    // TODO: remove
Severity: Minor
Found in src/utils/bunyanLogger.js by fixme

TODO found
Open

    // TODO: We don't validate uriParameters for now, since they are outside the methodDoc
Severity: Minor
Found in src/lib/phraseHooks/validateHook.js by fixme

TODO found
Open

  // TODO: We only support json by now
Severity: Minor
Found in src/lib/phraseHooks/validateHook.js by fixme

TODO found
Open

      // TODO: We only support json by now
Severity: Minor
Found in src/lib/phraseHooks/mockHook.js by fixme

TODO found
Open

    // TODO: make it work
Severity: Minor
Found in src/utils/bunyanLogger.js by fixme

TODO found
Open

      // @TODO: check if req.domain is setted by some middleware.
Severity: Minor
Found in src/metrics/newrelic.js by fixme

TODO found
Open

    // TODO: temporal patch for not having duplicate events on tests
Severity: Minor
Found in src/lib/engine.js by fixme
Severity
Category
Status
Source
Language