michaelleeallen/reducto

View on GitHub

Showing 5 of 5 total issues

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

module.exports = function (config, services) {
  return function service (req, res, next) {
    var parts = config.name.split(':');
    var serviceConfig = services[parts[1]][parts[0]];
    var context = _.has(config, 'context') ? config.context : _.merge({}, req.body, req.query, req.params, res.locals);
Severity: Minor
Found in lib/service.js - About 1 hr to fix

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

      return function service (req, res, next) {
        var parts = config.name.split(':');
        var serviceConfig = services[parts[1]][parts[0]];
        var context = _.has(config, 'context') ? config.context : _.merge({}, req.body, req.query, req.params, res.locals);
        var uri = utils.replaceStringTokens(context, serviceConfig.uri);
    Severity: Minor
    Found in lib/service.js - About 1 hr to fix

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

        render() {
          return (
            <html>
              <head>
                <title>{this.props.message}</title>
      Severity: Minor
      Found in examples/views/weather.jsx - About 1 hr to fix

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

        module.exports = function (config, req) {
          if (config.headers) {
            return Object.keys(config.headers)
              .reduce((result, key) => {
                if (config.headers[key] === 'FROM_REQUEST') {
        Severity: Minor
        Found in lib/map-headers.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 exports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = function (config) {
          return new Promise((resolve, reject) => {
            request(config, (error, res, body) => {
              if (error) return reject(error);
              if (res.statusCode >= 400) return reject({statusCode: res.statusCode, message: body});
        Severity: Minor
        Found in lib/service-call.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

        Severity
        Category
        Status
        Source
        Language