Asymmetrik/mean2-starter

View on GitHub

Showing 101 of 230 total issues

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

    static format(value: string | number | Moment, format?: string): string {
        if (null != value) {
            let momentDate;
            if (moment.isMoment(value)) {
                momentDate = value;
Severity: Minor
Found in src/client/app/shared/utc-date-pipe/utc-date-utils.service.ts - 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 searchTest has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

exports.searchTest = function(req, res) {
    let query = req.body.q || {};
    let search = req.body.s;

    if (search) {
Severity: Minor
Found in src/server/app/messages/controllers/message.server.controller.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 toTimestamp has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    static toTimestamp(value: string | number): number {
        if (null != value) {
            // If it's a number, assume it's a timestamp
            if (_.isNumber(value)) {
                return value;
Severity: Minor
Found in src/client/app/shared/utc-date-pipe/utc-date-utils.service.ts - 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 search has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

module.exports.search = function(schema, query, searchTerms, limit, offset, sortArr, runCount) {
Severity: Major
Found in src/server/app/util/services/query.server.service.js - About 50 mins to fix

    Function stream has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    module.exports.stream = function(schema, query, searchTerms, limit, offset, sortArr, lean) {
    Severity: Major
    Found in src/server/app/util/services/query.server.service.js - About 50 mins to fix

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

          private getQuery(): any {
              let query: any;
              let elements: any[] = [];
      
              if (this.filters.bypassAC) {
      Severity: Minor
      Found in src/client/app/admin/user-management/admin-list-users.component.ts - 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 audit has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      module.exports.audit = function(message, eventType, eventAction, eventActor, eventObject, eventMetadata) {
      Severity: Minor
      Found in src/server/app/audit/services/audit.server.service.js - About 45 mins to fix

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

        let getGlobbedPaths = (globPatterns, excludes) => {
            // URL paths regex
            let urlRegex = new RegExp('^(?:[a-z]+:)?//', 'i');
        
            // The output array
        Severity: Minor
        Found in src/server/config.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 containsQuery has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        CacheEntrySchema.statics.containsQuery = function(queryTerms, fields, search, limit, offset, sortArr) {
        Severity: Minor
        Found in src/server/app/access-checker/models/cache-entry.server.model.js - About 45 mins to fix

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

          module.exports.search = function(query, queryParams, user) {
              if (!user || !user._id) {
                  return q.reject('Notification Service: user._id must be defined');
              }
          
          
          Severity: Minor
          Found in src/server/app/notifications/services/notification.server.service.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 itemsRaw has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              set itemsRaw(newValue: string) {
                  if (newValue) {
                      let split = new RegExp(this.delimiter, 'g');
                      this._items = _.map(newValue.match(split), (val: string) => {
                          if (
          Severity: Minor
          Found in src/client/app/shared/list-manager.component.ts - 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 transform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              transform(n: number): string {
                  let scale: any = this.getScale(n);
                  let postfix: string = '';
                  let fraction: number = n;
                  let fractionSize: number;
          Severity: Minor
          Found in src/client/app/shared/big-number.pipe.ts - 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 containsQuery has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          UserSchema.statics.containsQuery = function(queryTerms, fields, search, limit, offset, sortArr) {
          Severity: Minor
          Found in src/server/app/admin/models/user.server.model.js - About 45 mins to fix

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

            module.exports.requiresExternalRoles = (req) => {
                let promise;
            
                // If there are required roles, check for them
                if(req.user.bypassAccessCheck === false && null != config.auth && _.isArray(config.auth.requiredRoles) && config.auth.requiredRoles.length > 0) {

            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 deeply nested control flow statements.
            Open

                                            for (let partition in offsets[topic]) {
                                                offsets[topic][partition] = Math.min.apply(null, offsets[topic][partition]);
                                                logger.info(`Kafka Consumer: Connected to topic ${topic}, partition: ${partition}, offset: ${offsets[topic][partition]}`);
                                            }
            Severity: Major
            Found in src/server/lib/kafka-consumer.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      for (let i in excludes) {
                                          file = file.replace(excludes[i], '');
                                      }
              Severity: Major
              Found in src/server/config.js - About 45 mins to fix

                Consider simplifying this complex logical expression.
                Open

                                if (
                                    (val.charAt(0) === '"' || val.charAt(0) === '\'' || val.charAt(0) === '“') &&
                                    (val.charAt(val.length - 1) === '"' || val.charAt(val.length - 1) === '\'' || val.charAt(val.length - 1) === '”')) {
                
                                    val = val.substring(1, val.length - 1);
                Severity: Major
                Found in src/client/app/shared/list-manager.component.ts - About 40 mins to fix

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

                      function updateMemberRole(user, team, role, requester, headers) {
                  Severity: Minor
                  Found in src/server/app/teams/services/teams.server.service.js - About 35 mins to fix

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

                    exports.exportCSV = function(req, res, filename, columns, data) {
                    Severity: Minor
                    Found in src/server/app/util/controllers/export-config.server.controller.js - About 35 mins to fix

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

                      CacheEntrySchema.statics.search = function(queryTerms, searchTerms, limit, offset, sortArr) {
                      Severity: Minor
                      Found in src/server/app/access-checker/models/cache-entry.server.model.js - About 35 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language