Showing 165 of 254 total issues

Function handle376or422 has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async function handle376or422(user, msg) {
  const networkInfo = await findOrCreateNetworkInfo(user, msg.network);

  await addSystemMessage(user, msg.network, 'server', msg.params.join(' '));

Severity: Minor
Found in server/backends/irc/controller.js - About 1 hr to fix

    Function exports has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function (environment) {
      const ENV = {
        modulePrefix: 'mas',
        podModulePrefix: 'mas/pods',
        environment,
    Severity: Minor
    Found in client/config/environment.js - About 1 hr to fix

      Function handleSet has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      async function handleSet({ user, command }) {
        const properties = command.settings || {};
        const keys = Object.keys(properties);
      
        if (keys.length === 0) {
      Severity: Minor
      Found in server/controllers/request.js - About 1 hr 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 authLocal has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      async function authLocal(username, password, done) {
        if (!username) {
          return;
        }
      
      
      Severity: Minor
      Found in server/lib/passport.js - About 1 hr 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 runSetters has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      function runSetters(objectProps, setters) {
        const preparedProps = {};
        const errors = {};
      
        for (const prop of Object.keys(objectProps)) {
      Severity: Minor
      Found in server/models/base.js - About 1 hr 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 handleAddMessageServer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        handleAddMessageServer({
          gid = mandatory(),
          userId = mandatory(),
          ts = mandatory(),
          windowId = mandatory(),
      Severity: Minor
      Found in client/app/stores/WindowStore.js - About 1 hr 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 externalLogin has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.externalLogin = function externalLogin(provider) {
        return async ctx => {
          await passport.authenticate(provider, async (err, user, info) => {
            if (user) {
              await createAuthSession(ctx, user);
      Severity: Minor
      Found in server/controllers/login.js - About 1 hr 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 authLocal has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function authLocal(username, password, done) {
        if (!username) {
          return;
        }
      
      
      Severity: Minor
      Found in server/lib/passport.js - About 1 hr to fix

        Function handleUploadFiles has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          handleUploadFiles({ files = mandatory(), window = mandatory() }) {
            if (files.length === 0) {
              return;
            }
        
        
        Severity: Minor
        Found in client/app/stores/WindowStore.js - About 1 hr to fix

          Function addWindow has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            addWindow(windowRecord: WindowRecord): void {
              const window = this.windows.get(windowRecord.windowId);
              const user = windowRecord.userId ? this.rootStore.userStore.users.get(windowRecord.userId) || undefined : undefined;
          
              if (window) {
          Severity: Minor
          Found in new-client/src/stores/WindowStore.ts - About 1 hr to fix

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

              handleAddMessagesServer({ messages = mandatory() }) {
                messages.forEach(({ windowId, messages: windowMessages }) => {
                  const window = this.windows.get(windowId);
                  let newMessages;
            
            
            Severity: Minor
            Found in client/app/stores/WindowStore.js - About 1 hr to fix

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

              module.exports = async function index(ctx) {
                ctx.set('Cache-control', 'private, max-age=0, no-cache');
              
                const user = ctx.mas.user;
              
              
              Severity: Minor
              Found in server/controllers/client.js - About 1 hr to fix

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

                  handleAddMessageServer({
                    gid = mandatory(),
                    userId = mandatory(),
                    ts = mandatory(),
                    windowId = mandatory(),
                Severity: Minor
                Found in client/app/stores/WindowStore.js - About 1 hr to fix

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

                  function createHTTPServers() {
                    let httpServer;
                    let httpsServer;
                    const httpPort = conf.get('frontend:http_port');
                    const httpsPort = conf.get('frontend:https_port');
                  Severity: Minor
                  Found in server/server.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if (cursor.section === 'top' || cursor.section === 'bottom') {
                              deltaY = rowIndex > cursor.y || (rowIndex === cursor.y && cursor.section === 'top') ? 1 : 0;
                            } else {
                              deltaX =
                                rowIndex === cursor.y && (columnIndex > cursor.x || (columnIndex === cursor.x && cursor.section === 'left'))
                    Severity: Major
                    Found in client/app/pods/components/window-grid/component.js - About 1 hr to fix

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

                        log({ level, message, ...meta }, callback) {
                          const [, processName, processExtension] = process.title.split('-');
                          let processColumn;
                          let cat;
                      
                      
                      Severity: Minor
                      Found in server/lib/winstonMasTransport.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 create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        static create(params) {
                          if (!params) {
                            return null;
                          }
                      
                      
                      Severity: Minor
                      Found in server/lib/userGId.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 handleJoin has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                      async function handleJoin(user, msg) {
                        // :neo!i=ilkkao@iao.iki.fi JOIN :#testi4
                        const channel = msg.params[0];
                        const network = msg.network;
                        const targetUser = await nicksService.getUser(msg.nick, network);
                      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 handleProcessLine has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        handleProcessLine({ window = mandatory(), body = mandatory() }) {
                          let command = false;
                          let commandParams;
                      
                          if (body.charAt(0) === '/') {
                      Severity: Minor
                      Found in client/app/stores/WindowStore.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 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

                      Severity
                      Category
                      Status
                      Source
                      Language