lappis-unb/tais

View on GitHub

Showing 8 of 8 total issues

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

def process_failed_story(failed_story):
    print('\n')
    for line in failed_story.splitlines():
        is_intent = is_an_intent_line(line)

Severity: Minor
Found in bot/test_stories.py - 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 predict_action_probabilities has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def predict_action_probabilities(self, tracker, domain):
        # type: (DialogueStateTracker, Domain) -> List[float]
        """Predicts a fallback action if NLU confidence is low
            or no other policy has a high-confidence prediction"""

Severity: Minor
Found in coach/fallback.py - About 55 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 train has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def train(self,
Severity: Minor
Found in coach/fallback.py - About 45 mins to fix

    Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self,
    Severity: Minor
    Found in coach/fallback.py - About 45 mins to fix

      Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, domain,
      Severity: Minor
      Found in rabbitmq/consumer/elastic_connector.py - About 35 mins to fix

        Function callback has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def callback(ch, method, properties, body):
            logger.warning(" [x] Received %r" % body)
        
            message = json.loads(body.decode('utf-8'))
        
        
        Severity: Minor
        Found in rabbitmq/consumer/consume_bot_messages.py - 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 api has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def api(endpoint, values=None, is_post=True):
            if endpoint[0] == '/':
                endpoint = endpoint[1:]
        
            url = host + '/api/v1/' + endpoint
        Severity: Minor
        Found in scripts/bot_config.py - 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

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

            def blueprint(self, on_new_message):
                rocketchat_webhook = Blueprint('rocketchat_webhook', __name__)
        
                @rocketchat_webhook.route("/", methods=['GET'])
                def health():
        Severity: Minor
        Found in bot/connector.py - 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