Showing 165 of 254 total issues

Function DesktopMenu has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const DesktopMenu: FunctionComponent = () => {
  const navigate = useNavigate();
  const { windowStore, profileStore } = useContext(ServerContext);

  const handleLogout = (allSessions: boolean) => windowStore.handleLogout(allSessions);
Severity: Minor
Found in new-client/src/components/SidebarMenu.tsx - About 2 hrs to fix

    Function connect has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function connect(userId, nick, network) {
      if (sockets[`${userId}:${network}`]) {
        log.warn({ id: userId }, `Impossible happened. Already connected to IRC network: ${network}`);
        return;
      }
    Severity: Minor
    Found in server/backends/irc/connection-manager/connectionManager.js - About 2 hrs to fix

      Function handlePrivmsg has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function handlePrivmsg(user, msg, command) {
        // :ilkkao!~ilkkao@127.0.0.1 NOTICE buppe :foo
        const target = msg.params[0];
        const currentNick = await nicksService.getNick(user.gId, msg.network);
        let conversation;
      Severity: Minor
      Found in server/backends/irc/controller.js - About 1 hr to fix

        Function scanMentions has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.scanMentions = async function scanMentions(conversation, message) {
          if (!message.get('userGId') || message.get('userGId') === 'i0' || !message.get('body')) {
            return;
          }
        
        
        Severity: Minor
        Found in server/services/windows.js - About 1 hr to fix

          Function configTransports has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function configTransports() {
            const transports = [];
          
            if (get('log:file')) {
              let logDirectory = path.normalize(get('log:directory'));
          Severity: Minor
          Found in server/lib/log.ts - About 1 hr to fix

            Function Search has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const Search: FunctionComponent = () => {
              const navigate = useNavigate();
              const toast = useToast();
              const { windowStore } = useContext(ServerContext);
              const [name, setName] = useState<string>('');
            Severity: Minor
            Found in new-client/src/components/JoinIRCChannel.tsx - About 1 hr to fix

              Function constructor has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                constructor({
                  id,
                  peerUser,
                  network,
                  operators,
              Severity: Minor
              Found in new-client/src/models/Window.ts - About 1 hr to fix

                Function sendNotifications has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                async function sendNotifications(user, sessionId, excludeSessionId, ntfs) {
                  assert(ntfs);
                
                  const ntfsArray = (util.isArray(ntfs) ? ntfs : [ntfs]).map(ntf =>
                    typeof ntf === 'string' ? ntf : JSON.stringify(ntf)
                Severity: Minor
                Found in server/lib/notification.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 _drawCursor has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                  _drawCursor(cursor) {
                    if (cursor.x === null) {
                      $('#window-cursor').hide();
                      return;
                    }
                Severity: Minor
                Found in client/app/pods/components/window-grid/component.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 buildRouter has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = function buildRouter() {
                  log.info('Registering app routes');
                
                  const router = new Router();
                
                
                Severity: Minor
                Found in server/routes/router.js - About 1 hr to fix

                  Function createWindow has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  async function createWindow(user, conversation) {
                    let peerMember = null;
                  
                    assert(conversation);
                  
                  
                  Severity: Minor
                  Found in server/services/windows.js - About 1 hr to fix

                    Function _parseLinks has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      _parseLinks(text) {
                        const imgSuffixes = ['png', 'jpg', 'jpeg', 'gif', 'webp'];
                        const media = [];
                        let body = '';
                    
                    
                    Severity: Minor
                    Found in client/app/models/Message.js - About 1 hr to fix

                      Function handleJoin has 44 lines of code (exceeds 25 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 1 hr to fix

                        Function handlerServerNotification has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          handlerServerNotification(ntf: Notification): boolean {
                            switch (ntf.type) {
                              case 'ADD_MESSAGE': {
                                const { type: _, windowId, ...message } = ntf;
                                this.addMessage(windowId, message);
                        Severity: Minor
                        Found in new-client/src/stores/WindowStore.ts - About 1 hr to fix

                          Function process has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                          exports.process = async function process(session, command) {
                            const { windowId } = command;
                            const network = typeof command.network === 'string' ? command.network.toLowerCase() : null;
                            const user = session.user;
                          
                          
                          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 constructor has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            constructor(rootStore: RootStore) {
                              this.rootStore = rootStore;
                          
                              this.emitInit();
                          
                          
                          Severity: Minor
                          Found in new-client/src/lib/socket.ts - About 1 hr to fix

                            Function setters has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              static get setters() {
                                return {
                                  name: function name(realName) {
                                    if (!realName || realName.length < 6) {
                                      return { valid: false, error: 'Please enter at least 6 characters.' };
                            Severity: Minor
                            Found in server/models/user.js - About 1 hr to fix

                              Function handleUpdate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                              Open

                              async function handleUpdate({ user, command, window, session }) {
                                const accepted = ['row', 'column', 'minimizedNamesList', 'desktop'];
                                const acceptedAlerts = ['email', 'notification', 'sound', 'title'];
                              
                                if (!window) {
                              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 _markWindow has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                              Open

                                _markWindow(masWindow, x, y, cursor) {
                                  masWindow.cursor = 'none';
                              
                                  const rowCount = this.dimensions.length;
                                  const columnCount = this.dimensions[y].length;
                              Severity: Minor
                              Found in client/app/pods/components/window-grid/component.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 parseIrcMessage has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                              Open

                              async function parseIrcMessage({ userId, line, network }) {
                                const parts = line.trim().split(' ');
                                const msg = {
                                  params: [],
                                  numericReply: false,
                              Severity: Minor
                              Found in server/backends/irc/controller.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

                              Severity
                              Category
                              Status
                              Source
                              Language