Showing 165 of 254 total issues

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

exports.processCookie = async function processCookie(ctx, next) {
  ctx.mas = ctx.mas || {};
  ctx.mas.user = null;

  const sessionCookie = ctx.cookies.get('mas');
Severity: Minor
Found in server/lib/authSessionChecker.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 dispatch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function dispatch(type, data = {}, acceptCb = noopCb, rejectCb = noopCb) {
  let consumed = false;
  const name = type
    .split('_')
    .map(part => part.toLowerCase().capitalize())
Severity: Minor
Found in client/app/utils/dispatcher.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 decoratedTitle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  get decoratedTitle(): string {
    let title = '';
    const type = this.type;
    const network = this.network;
    const name = this.name;
Severity: Minor
Found in new-client/src/models/Window.ts - 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 newMessageAlert has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private newMessageAlert(window: WindowModel, message: Message) {
    if (!message.isNotable || message.isFromMe || !this.initDone) {
      return;
    }

Severity: Minor
Found in new-client/src/stores/WindowStore.ts - 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 server/models/user.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

      return courier.call(backend, 'textCommand', {
        userId: user.id,
        conversationId: conversation.id,
        command: name,
        commandParams: params
    Severity: Major
    Found in server/controllers/request.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return message.body;
      Severity: Major
      Found in new-client/src/components/MessageRenderer.tsx - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          return { status: 'OK' };
        Severity: Major
        Found in server/controllers/request.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return start1on1(user, targetUserGId, targetUserGId.isMASUser ? 'mas' : network);
          Severity: Major
          Found in server/controllers/request.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return { valid: true, value: nickName };
            Severity: Major
            Found in server/models/user.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                return { status: 'OK' };
              Severity: Major
              Found in server/controllers/request.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return <Text color="red.600">{message.body}</Text>;
                Severity: Major
                Found in new-client/src/components/MessageRenderer.tsx - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return null;
                  Severity: Major
                  Found in client/app/pods/components/window-grid/component.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return { status: 'ERROR', errorMsg: 'Nick missing, use e.g. /ircquery john' };
                    Severity: Major
                    Found in server/controllers/request.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return 'left'; // l
                      Severity: Major
                      Found in client/app/pods/components/window-grid/component.js - About 30 mins to fix

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

                        exports.findOrCreate1on1 = async function findOrCreate1on1(user, peerUserGId, network) {
                          assert(user && peerUserGId && network);
                        
                          let conversation = null;
                          const userMembers = await ConversationMember.find({ userGId: user.gIdString });
                        Severity: Minor
                        Found in server/services/conversations.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 setGroupMembers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        exports.setGroupMembers = async function setGroupMembers(conversation, newMembersHash) {
                          const oldMembers = await ConversationMember.find({ conversationId: conversation.id });
                        
                          for (const oldMember of oldMembers) {
                            if (!Object.keys(newMembersHash).some(newMember => newMember === oldMember.gIdString)) {
                        Severity: Minor
                        Found in server/services/conversations.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 verifyPassword has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          async verifyPassword(password) {
                            const encryptedPassword = this.get('password');
                            const encryptionMethod = this.get('passwordType');
                        
                            if (!encryptedPassword) {
                        Severity: Minor
                        Found in server/models/user.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 init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        exports.init = async function init(user, session, maxBacklogLines, cachedUpto) {
                          await settingsService.sendUpdateSettings(user, session.id);
                          await friendsService.sendUpdateFriends(user, session.id);
                          await friendsService.sendConfirmFriends(user, session.id);
                          await friendsService.informStateChange(user, 'login');
                        Severity: Minor
                        Found in server/services/session.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 didInsertElement has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          didInsertElement() {
                            this.sendAction('register', this);
                            this.set('elementInserted', true);
                        
                            this.$messagePanel = this.$('.window-messages');
                        Severity: Minor
                        Found in client/app/pods/components/discussion-window/component.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