sjsucohort6/amigo-chatbot

View on GitHub

Showing 41 of 1,141 total issues

Method execute has 111 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {

        try {
            //message = jobdata params.

    Method execute has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        @Override
        public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
    
            try {
                //message = jobdata params.

    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 brain has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    def brain(name, speech_text, music_path, city_name, city_zip,
              consumer_key, consumer_secret, access_token, access_token_secret, amigo_host_port):
        """
        Virtual Assistant's logic module or BRAIN.
    
    
    Severity: Minor
    Found in ria/brain.py - 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

    Method update has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        @Override
        public synchronized void update(List<User> entityList) throws DBException {
            for (User user: entityList) {
                List<User> users = fetchById(new ArrayList<String>() {{add(user.getEmail());}});
                User existingUser = null;
    Severity: Minor
    Found in user-db/src/main/java/edu/sjsu/amigo/user/db/dao/UserDAO.java - 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

    Method update has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        @Override
        public void update(List<Request> entityList) throws DBException {
            for (Request request: entityList) {
                List<Request> requests = fetchById(new ArrayList<String>() {{add(request.getRequestId());}});
                Request existingRequest = null;

    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

    File MessageProcessorJob.java has 287 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Copyright (c) 2017 San Jose State University.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal

      File amigo.py has 263 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """
      Amigo CLI.
      
      Install Python 3 for your OS.
      Create virtual environment as: python3 -m venv venv
      Severity: Minor
      Found in pycli/amigo.py - About 2 hrs to fix

        Method execute has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
                try {
                    //message = jobdata params.
                    JobDataMap jobDataMap = jobExecutionContext.getMergedJobDataMap();

          Method executeHttpRequestWithBody has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              private Response executeHttpRequestWithBody(Map<String, String> routeParamsMap, Map<String, String> queryStringMap, Map<String, String> headersMap, Object bodyObject, HttpRequestWithBody request) throws HttpClientException {
                  if (user != null && password != null) {
                      request.basicAuth(user, password);
                  }
                  if(routeParamsMap != null) {

          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

          Method update has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public void update(List<Provider> entityList) throws DBException {
                  for (Provider provider : entityList) {
                      List<Provider> providers = fetchById(new ArrayList<String>() {{
                          add(provider.getCloudProvider());

          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

          Method execute has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Override
              public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
                  try {
                      JobDataMap jobDataMap = jobExecutionContext.getMergedJobDataMap();
                      message = (RiaMessage)jobDataMap.get(JobConstants.JOB_PARAM_MESSAGE);

            Method executeGetRequest has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                private <T> Response executeGetRequest(Map<String, String> routeParamsMap, Map<String, String> queryStringMap, Map<String, String> headersMap, Class<T> clazz, GetRequest request) throws HttpClientException {
                    if (user != null && password != null) {
                        request.basicAuth(user, password);
                    }
            
            

            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

            Method executeHttpRequestWithBody has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private Response executeHttpRequestWithBody(Map<String, String> routeParamsMap, Map<String, String> queryStringMap, Map<String, String> headersMap, Object bodyObject, HttpRequestWithBody request) throws HttpClientException {
                    if (user != null && password != null) {
                        request.basicAuth(user, password);
                    }
                    if(routeParamsMap != null) {

              Consider simplifying this complex logical expression.
              Open

                  if check_message([wake_up_word, 'who', 'are', 'you']) or check_message([wake_up_word, "what's", 'your', 'name']):
                      general_conversations.who_are_you()
                  elif check_message([wake_up_word, 'how', 'i', 'look']) or check_message([wake_up_word, 'how', 'am', 'i']):
                      general_conversations.how_am_i()
                  elif check_message([wake_up_word, 'tell', 'joke']):
              Severity: Critical
              Found in ria/brain.py - About 1 hr to fix

                Method sendMessage has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @POST
                    @Produces(MediaType.APPLICATION_JSON)
                    @Consumes(MediaType.APPLICATION_JSON)
                    public Response sendMessage(String messageJson) {
                        try {

                  Function brain has 10 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def brain(name, speech_text, music_path, city_name, city_zip,
                  Severity: Major
                  Found in ria/brain.py - About 1 hr to fix

                    Method invoke has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                            public IntentFinder invoke() throws DBException {
                                List<String> contentWordsList = convertMsgToWordsList(content);
                                // Looking up by hardcoded provider aws.
                                // TODO remove hardcoding and fetch all providers (not by ID).
                                List<Provider> providers = providerDAO.fetchById(new ArrayList<String>() {{

                    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

                    Method execute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        @Override
                        public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
                            try {
                                //message = jobdata params.
                                JobDataMap jobDataMap = jobExecutionContext.getMergedJobDataMap();

                    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 main has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def main():
                        """
                        Amigo CLI main program.
                    
                        :return:
                    Severity: Minor
                    Found in pycli/amigo.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

                    Method executeGetRequest has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private <T> Response executeGetRequest(Map<String, String> routeParamsMap, Map<String, String> queryStringMap, Map<String, String> headersMap, Class<T> clazz, GetRequest request) throws HttpClientException {
                            if (user != null && password != null) {
                                request.basicAuth(user, password);
                            }
                    
                    
                      Severity
                      Category
                      Status
                      Source
                      Language