notduncansmith/summit

View on GitHub

Showing 51 of 96 total issues

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

function sendMail (opts) {
  var toEmail = opts.toEmail
    , body = opts.body
    , fromEmail = opts.fromEmail
    , fromName = opts.fromName
Severity: Minor
Found in lib/services/mailer.js - About 1 hr to fix

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

    Database.prototype.attach = function (name, filePaths) {
      var self = this
        , doc = (typeof name === 'string' ? this.get(name) : Promise.resolve([name]));
    
      if (filePaths.length === 0) {
    Severity: Minor
    Found in lib/drivers/database/nano.js - About 1 hr to fix

      Function validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      UserCollection.prototype.validate = function (user) {
        var services = ['password', 'facebook', 'twitter']
          , identifiers = ['email', 'facebookId', 'twitterId', 'username']
          , userIdentifiers = [];
      
      
      Severity: Minor
      Found in lib/collection/user.js - About 55 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 8 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = function (app) {
        return app.collection({
          name: 'Post',
          isPostType: true,
          timestamps: true,
      Severity: Minor
      Found in cms/post.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 search has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      Collection.prototype.search = function (opts, filtered) {
        /*
          Only supports ElasticSearch since
          that's what apps currently in
          production were using before the
      Severity: Minor
      Found in lib/collection.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 send has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      Mailer.prototype.send = function (templateName, toUser, withData, fromEmail, fromName) {
      Severity: Minor
      Found in lib/services/mailer.js - About 35 mins to fix

        Function savePost has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          function savePost (req, _, Post, app, uuid){
        Severity: Minor
        Found in cms/router.js - About 35 mins to fix

          Function save has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          Item.prototype.save = function () {
            var self = this
              , fields = this._collection.fields
              , uploadFields
              , attachmentPaths;
          Severity: Minor
          Found in lib/collection/item.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 doSearch({
                index: collection.name,
                type: collection.name,
                body: {query: esQuery}
              });
          Severity: Major
          Found in lib/drivers/search/elasticsearch.js - About 30 mins to fix

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

            module.exports = function (app) {
              return app.collection({
                name: 'Page',
                isPostType: true,
                timestamps: true,
            Severity: Minor
            Found in cms/page.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 follow has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            Collection.prototype.follow = function (opts, handler) {
              var opts = opts || {}
                , args = {}
                , handler = handler || function(){}
                , feed;
            Severity: Minor
            Found in lib/collection.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