nshimiye/relay

View on GitHub

Showing 6 of 18 total issues

File SlackRelay.js has 255 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

/**
 * Stand for a bot user
 * in charge of carrying messages from a locally confugured bot to slack
Severity: Minor
Found in src/slackRelay/SlackRelay.js - About 2 hrs to fix

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

      connect() {
        let connectionTimeout;
        let _rtm = rtm.get(this);
        let token = token_private.get(this);
        let slackRelayInstance = this;
    Severity: Minor
    Found in src/slackRelay/SlackRelay.js - About 1 hr to fix

      Function initialize has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

         initialize(token) {
      
           // web
           let slackRelayInstance = this;
           let _rtm = rtm.get(this);
      Severity: Minor
      Found in src/botkitRelay/BotkitRelay.js - About 1 hr to fix

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

           initialize(token) {
        
             // web
             let slackRelayInstance = this;
             let _rtm = rtm.get(this);
        Severity: Minor
        Found in src/botkitRelay/BotkitRelay.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 promisedResponse has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            let promisedResponse = new Promise(function(resolve, reject) {
              // @DONE make sure bot is not already connected
              // if so then just return this instance
              if (_rtm.connected) {
                resolve(slackRelayInstance);
        Severity: Minor
        Found in src/slackRelay/SlackRelay.js - About 1 hr to fix

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

            _intializeSlackListener() {
              let _rtm = rtm.get(this);
          
              let self = this;
              _rtm.on(RTM_EVENTS.MESSAGE, function handleRtmMessage(message) {
          Severity: Minor
          Found in src/slackRelay/SlackRelay.js - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language