client/app/pods/components/discussion-window/component.js

Summary

Maintainability
D
2 days
Test Coverage

File component.js has 480 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//
//   Copyright 2009-2014 Ilkka Oksanen <iao@iki.fi>
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
Severity: Minor
Found in client/app/pods/components/discussion-window/component.js - About 7 hrs to fix

    `` has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export default Component.extend({
      init(args) {
        this._super(args);
    
        this.content = EmberObject.create();
    Severity: Minor
    Found in client/app/pods/components/discussion-window/component.js - About 3 hrs to fix

      Function didInsertElement has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        didInsertElement() {
          this.sendAction('register', this);
          this.set('elementInserted', true);
      
          this.$messagePanel = this.$('.window-messages');
      Severity: Major
      Found in client/app/pods/components/discussion-window/component.js - About 2 hrs to fix

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

          init(args) {
            this._super(args);
        
            this.content = EmberObject.create();
        
        
        Severity: Minor
        Found in client/app/pods/components/discussion-window/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 _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 _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 _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 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

            There are no issues that match your filters.

            Category
            Status