Chatterbox-IRC/Chatterbox

View on GitHub

Showing 10 of 72 total issues

Function tabs has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

cb.tabs = function() {
    "use strict";
    // Stores information relating to tabs
    var tabs = {
        list: [],
Severity: Major
Found in client/javascript/tabs.js - About 3 hrs to fix

    Method Client.Request has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
    Open

    func (c Client) Request(method string, path string, body []byte) ([]byte, int, error) {
        c.Host.Path = path
        httpClient := &http.Client{}
    
        req, err := http.NewRequest(method, c.Host.String(), bytes.NewBuffer(body))
    Severity: Minor
    Found in server/client/client.go - About 3 hrs 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 tabs has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    cb.tabs = function() {
        "use strict";
        // Stores information relating to tabs
        var tabs = {
            list: [],
    Severity: Minor
    Found in client/javascript/tabs.js - About 3 hrs 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 connection has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    cb.connection = function() {
    "use strict";
        var networks = [
            {
                name: "freenode",
    Severity: Major
    Found in client/javascript/connection.js - About 2 hrs to fix

      Method Client.Request has 56 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (c Client) Request(method string, path string, body []byte) ([]byte, int, error) {
          c.Host.Path = path
          httpClient := &http.Client{}
      
          req, err := http.NewRequest(method, c.Host.String(), bytes.NewBuffer(body))
      Severity: Minor
      Found in server/client/client.go - About 1 hr to fix

        Function NewUser has 5 return statements (exceeds 4 allowed).
        Open

        func NewUser(email, password string) (*User, []validate.ValidationMsg, error) {
            id, err := generateUUID()
            if err != nil {
                logger.Error.Print(err)
                return &User{}, []validate.ValidationMsg{}, err
        Severity: Major
        Found in server/models/user.go - About 35 mins to fix

          Method Client.Request has 5 return statements (exceeds 4 allowed).
          Open

          func (c Client) Request(method string, path string, body []byte) ([]byte, int, error) {
              c.Host.Path = path
              httpClient := &http.Client{}
          
              req, err := http.NewRequest(method, c.Host.String(), bytes.NewBuffer(body))
          Severity: Major
          Found in server/client/client.go - About 35 mins to fix

            Avoid too many return statements within this function.
            Open

                        return;
            Severity: Major
            Found in client/javascript/tabs.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return;
              Severity: Major
              Found in client/javascript/tabs.js - About 30 mins to fix

                Function util has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                cb.util = function() {
                    "use strict";
                    // Returns the index of an element amongst its siblings in its parent
                    var indexInParent = function(node) {
                        var children = node.parentNode.childNodes;
                Severity: Minor
                Found in client/javascript/util.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

                Severity
                Category
                Status
                Source
                Language