Showing 32 of 54 total issues

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

  constructor (config, options) {
    options = _.extend({
      context: null,
      state: null,
    }, options);
Severity: Minor
Found in src/support/forms/form.js - About 1 hr to fix

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

    module.exports = function(App, options) {
      let enabledFormats = {};
    
      let formatNames = Object.keys(options.formats);
    
    
    Severity: Minor
    Found in src/support/middleware/outputFormats.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 can has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      can (resource, user) {
        this.logger.debug('can', resource, user.id);
    
        // if resource name is "public" then everyone has access
        if ('public' === resource) {
    Severity: Minor
    Found in src/support/acl.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 process has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      * process (token, options) {
        options = options || {};
        
        this.logger.debug(`Processing action token: ${token}`);
    
    
    Severity: Minor
    Found in src/support/actionTokens.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 record has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      record: function*(verb, actor, details) {
        this._logger().debug('Recording activity', verb, actor.id || actor, details);
    
        if (!actor || !actor.id) {
          actor = {
    Severity: Minor
    Found in src/models/activity.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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      * validate () {
        let fields = this.fields,
          errors = null;
    
        for (let fieldName in fields) {
    Severity: Minor
    Found in src/support/forms/form.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 false;
    Severity: Major
    Found in src/support/acl.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return true;
      Severity: Major
      Found in src/support/acl.js - About 30 mins to fix

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

        module.exports = function(_) {
          _.mixin({
            bindGen: genomatic.bind,
            isGenFn: genomatic.isGenFn,
            classnames: require('classnames'),
        Severity: Minor
        Found in src/support/lodashMixins.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 copyFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          * copyFile (src, dst, overwrite) {
            let fullDstPath = path.join(this._getProjectFolder(), dst);
        
            let fileExistsAlready = !!shell.test('-f', fullDstPath);
        
        
        Severity: Minor
        Found in src/support/cliCommand.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 _prepareMailOptions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          * _prepareMailOptions (mailOptions) {
            mailOptions = _.extend({
              from: this.config.from,
              subject: null,
              body: null,
        Severity: Minor
        Found in src/support/mailer/base.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 _staticUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        function _staticUrl(logger, resourcePath) {
          let pos = resourcePath.indexOf(':'),
            owner =  (0 <= pos) ? resourcePath.substr(0, pos) : '',
            theUrl = (0 <= pos) ? resourcePath.substr(pos+1) : resourcePath;
        
        
        Severity: Minor
        Found in src/support/startup/staticResources.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