Showing 165 of 254 total issues

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

async function disconnectIfIdle(user, network) {
  const windows = await windowsService.getWindowsForNetwork(user, network);
  let onlyServer1on1Left = false;

  if (windows.length === 1) {
Severity: Minor
Found in server/backends/irc/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 processLine has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  processLine(window: WindowModel, body: string, doc: RemirrorJSON): void {
    let command;
    let commandParams;

    if (body.charAt(0) === '/') {
Severity: Minor
Found in new-client/src/stores/WindowStore.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 moveWindow has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  moveWindow(movingWindow: Window, direction: WindowMoveDirection): void {
    const windowRowIndex = this.visibleWindowsGrid.findIndex(row => row.includes(movingWindow));
    const windowRow = this.visibleWindowsGrid[windowRowIndex];

    if (!windowRow) {
Severity: Minor
Found in new-client/src/stores/WindowStore.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

Avoid deeply nested control flow statements.
Open

          if (oper === '+') {
            // Non-oper got voice
            newClass = VOICE;
          } else {
            // Non-oper lost voice
Severity: Major
Found in server/backends/irc/controller.js - About 45 mins to fix

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

    async function handleJoin({ user, command, backend, network }) {
      if (!command.name || !command.network) {
        return { status: 'PARAMETER_MISSING', errorMsg: 'Name or network missing.' };
      }
    
    
    Severity: Minor
    Found in server/controllers/request.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 broadcast has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    async function broadcast(conversation, ntf, excludeSession, options = {}) {
      const members = await ConversationMember.find({ conversationId: conversation.id });
    
      for (const member of members) {
        const userGId = UserGId.create(member.get('userGId'));
    Severity: Minor
    Found in server/services/conversations.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

    Avoid deeply nested control flow statements.
    Open

                if (re) {
                  inSeconds = parseInt(re[1] || 0) * 3600 + parseInt(re[2] || 0) * 60 + parseInt(re[3] || 0);
                }
    Severity: Major
    Found in client/app/models/Message.js - About 45 mins to fix

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

      async function deleteConversationMember(conversation, member, options) {
        log.info(`User: ${member.get('userGId')} removed from conversation: ${conversation.id}`);
      
        if (!options.silent && conversation.get('type') === 'group') {
          await broadcastAddMessage(conversation, {
      Severity: Minor
      Found in server/services/conversations.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

      Avoid deeply nested control flow statements.
      Open

                for (const network of networks) {
                  const currentNick = await nicksService.getNick(foundUser.gId, network);
      
                  // Fallback to default nick. This solves the situation where the user joins
                  // a new IRC network during the session. In that case his own userGId is in
      Severity: Major
      Found in server/lib/userIntroducer.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                  for (const network of networks) {
                    entry.nick[network] = 'UNKNOWN';
                  }
        Severity: Major
        Found in server/lib/userIntroducer.js - About 45 mins to fix

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

          async function sendUpdateFriendsNtf(user, sessionId) {
            const command = {
              type: 'UPDATE_FRIENDS',
              reset: true,
              friends: []
          Severity: Minor
          Found in server/services/friends.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

          Consider simplifying this complex logical expression.
          Open

              } else if (
                cursor.y === y &&
                ((section === 'right' && cursor.x === x) || (x < columnCount - 1 && cursor.x - 1 === x && section === 'left'))
              ) {
                masWindow.cursor = 'right';
          Severity: Major
          Found in client/app/pods/components/window-grid/component.js - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                } else if (
                  cursor.y === y &&
                  ((section === 'left' && cursor.x === x) || (x > 0 && cursor.x === x - 1 && section === 'right'))
                ) {
                  masWindow.cursor = 'left';
            Severity: Major
            Found in client/app/pods/components/window-grid/component.js - About 40 mins to fix

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

              async function disconnectInactiveIRCUsers() {
                log.info('Running disconnectInactiveIRCUsers job');
              
                const cutOffDate = new Date();
                cutOffDate.setDate(cutOffDate.getDate() - conf.get('irc:inactivity_timeout'));
              Severity: Minor
              Found in server/backends/irc/scheduler.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 _whichSection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                _whichSection(windowDim, x, y) {
                  // -----------------
                  // |\      t      /|
                  // | \           / |
                  // |  -----------  |
              Severity: Minor
              Found in client/app/pods/components/window-grid/component.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 _goToBottom has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                _goToBottom(animate, callback) {
                  if (this.scrollLock || !this.$messagesEndAnchor) {
                    return;
                  }
              
              
              Severity: Minor
              Found in client/app/pods/components/discussion-window/component.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 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 _addScrollHandler has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                _addScrollHandler() {
                  const handler = function () {
                    if (this.animating) {
                      return;
                    }
              Severity: Minor
              Found in client/app/pods/components/discussion-window/component.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 _calculateSpaceForCursor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                _calculateSpaceForCursor(x, y, cursor) {
                  let width = Math.round(CURSORWIDTH / 2);
                  const rows = this.dimensions.length;
                  const columns = this.dimensions[y].length;
              
              
              Severity: Minor
              Found in client/app/pods/components/window-grid/component.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

              Severity
              Category
              Status
              Source
              Language