Showing 254 of 254 total issues

Function handleSendText has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  handleSendText({ window = mandatory(), text = mandatory() }) {
    let sent = false;

    setTimeout(() => {
      if (!sent) {
Severity: Minor
Found in client/app/stores/WindowStore.js - About 1 hr to fix

    Function _layoutWindows has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _layoutWindows(animate) {
        const duration = animate ? 600 : 0;
        const windowComponents = this.windowComponents;
        const container = this._containerDimensions();
        const expandedWindow = windowComponents.findBy('expanded', true);
    Severity: Minor
    Found in client/app/pods/components/window-grid/component.js - About 1 hr to fix

      Function _lineAdded has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        _lineAdded(message) {
          if (!message || !windowStore.initDone) {
            return;
          }
      
      
      Severity: Minor
      Found in client/app/pods/components/discussion-window/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 setters has a Cognitive Complexity of 12 (exceeds 5 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

      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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        constructor(rootStore: RootStore, socket: Socket) {
          this.rootStore = rootStore;
          this.socket = socket;
      
          makeObservable(this, {
      Severity: Major
      Found in new-client/src/stores/NetworkStore.ts and 1 other location - About 1 hr to fix
      new-client/src/stores/FriendStore.ts on lines 14..22

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 63.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        constructor(rootStore: RootStore, socket: Socket) {
          this.rootStore = rootStore;
          this.socket = socket;
      
          makeObservable(this, {
      Severity: Major
      Found in new-client/src/stores/FriendStore.ts and 1 other location - About 1 hr to fix
      new-client/src/stores/NetworkStore.ts on lines 11..19

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 63.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function _lineAdded has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _lineAdded(message) {
          if (!message || !windowStore.initDone) {
            return;
          }
      
      
      Severity: Minor
      Found in client/app/pods/components/discussion-window/component.js - About 1 hr to fix

        Function setupTransporter has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function setupTransporter() {
          if (get('mailgun:enabled')) {
            const mailgun = require('nodemailer-mailgun-transport'); // Slow module to require
            const mailgunAuth = {
              auth: {
        Severity: Minor
        Found in server/lib/mailer.ts - About 1 hr to fix

          Function renderMessage has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const renderMessage = () => {
              const color = message.isFromMe ? 'blue.600' : undefined;
              const nickColor = message.isFromMe ? 'blue.600' : '#617eb5';
          
              if (editedBody) {
          Severity: Minor
          Found in new-client/src/components/MessageRenderer.tsx - About 1 hr to fix

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

              constructor(rootStore: RootStore, socket: Socket) {
                this.rootStore = rootStore;
                this.socket = socket;
            
                makeObservable(this, {
            Severity: Minor
            Found in new-client/src/stores/WindowStore.ts - About 1 hr to fix

              Function createInputRules has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                createInputRules(): InputRule[] {
                  const getUniCodeEmoji = (text: string) => {
                    const emojis = emojiIndex.search(text.replace(/^:(.+):$/, (_match, name) => name));
              
                    if (!emojis || emojis.length === 0) {
              Severity: Minor
              Found in new-client/src/lib/remirrorMessageEmojiExtension.ts - About 1 hr to fix

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                    if (response.status !== 'OK') {
                      this.rootStore.modalStore.openModal({ type: ModalType.Info, title: 'Error', body: response.errorMsg as string });
                    }
                Severity: Major
                Found in new-client/src/stores/WindowStore.ts and 2 other locations - About 1 hr to fix
                new-client/src/stores/WindowStore.ts on lines 355..357
                new-client/src/stores/WindowStore.ts on lines 436..442

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 62.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                      const newMessage = this._upsertMessaage(window, {
                        gid,
                        userId,
                        ts,
                        windowId,
                Severity: Major
                Found in client/app/stores/WindowStore.js and 1 other location - About 1 hr to fix
                client/app/stores/WindowStore.js on lines 134..144

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 62.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                          const newMessage = this._upsertMessaage(window, {
                            gid,
                            userId,
                            ts,
                            windowId,
                Severity: Major
                Found in client/app/stores/WindowStore.js and 1 other location - About 1 hr to fix
                client/app/stores/WindowStore.js on lines 103..113

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 62.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                    if (response.status !== 'OK') {
                      this.rootStore.modalStore.openPriorityModal({
                        type: ModalType.Info,
                        title: 'Error',
                        body: response.errorMsg as string
                Severity: Major
                Found in new-client/src/stores/WindowStore.ts and 2 other locations - About 1 hr to fix
                new-client/src/stores/WindowStore.ts on lines 308..310
                new-client/src/stores/WindowStore.ts on lines 355..357

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 62.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                    if (response.status !== 'OK') {
                      this.rootStore.modalStore.openModal({ type: ModalType.Info, title: 'Error', body: response.errorMsg as string });
                    }
                Severity: Major
                Found in new-client/src/stores/WindowStore.ts and 2 other locations - About 1 hr to fix
                new-client/src/stores/WindowStore.ts on lines 308..310
                new-client/src/stores/WindowStore.ts on lines 436..442

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 62.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Consider simplifying this complex logical expression.
                Open

                    if (
                      (y === 0 && cursor === 'top') ||
                      (y === rows - 1 && cursor === 'bottom') ||
                      (x === 0 && cursor === 'left') ||
                      (x === columns - 1 && cursor === 'right')
                Severity: Critical
                Found in client/app/pods/components/window-grid/component.js - About 1 hr to fix

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

                    Function createFrontendApp has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function createFrontendApp() {
                      const app = new Koa();
                    
                      app.on('error', err => {
                        if (err.status !== 404 && !error.errno === 'EPIPE') {
                    Severity: Minor
                    Found in server/server.js - About 1 hr to fix

                      Function main has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function main() {
                        const { mode, fileName: mainEntryFileName } = getMainEntryFileNameAndMode();
                        const googleAuthEnabled = process.env['GOOGLE_AUTH'] === 'true';
                        const serverPort = process.env['WEB_SERVER_PORT'] || 3100;
                      
                      
                      Severity: Minor
                      Found in website/server.ts - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language