sjsucohort6/amigo-chatbot

View on GitHub

Showing 41 of 1,141 total issues

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

    public String execute(String dockerImage, List<String> envList, List<String> commandList, String entryPoint) throws CommandExecutionException {
        try( DockerClient dockerClient = new DefaultDockerClient("unix:///var/run/docker.sock")) {
            String response = null;
            //pullImage(dockerClient, dockerImage);
            dockerClient.pull(dockerImage);

    Method update has 27 lines of code (exceeds 25 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;

      Method update has 27 lines of code (exceeds 25 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 1 hr to fix

        Method getIntent has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public List<String> getIntent(String message) {
                try(HttpClient httpClient = new HttpClient()) {
                    String url = WIT_AI_URL_PREFIX + WIT_AI_MESSAGE_URI;
                    queryStringMap.put("q", message);

          Function main has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def main():
              """
              Amigo CLI main program.
          
              :return:
          Severity: Minor
          Found in pycli/amigo.py - About 1 hr to fix

            Method execute has a Cognitive Complexity of 9 (exceeds 5 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);

            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 9 (exceeds 5 allowed). Consider refactoring.
            Open

            def main():
                r = sr.Recognizer()
                while True:
                    # obtain audio from the microphone
                    with sr.Microphone() as source:
            Severity: Minor
            Found in ria/main.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

            Method processMessage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public static void processMessage(Message msg) throws Exception {
                    // Get the intent from wit.ai and attach it to the message.
                    /*
                        Intent will be a sorted list of tokens.
                        intent: [aws, ec2, list]

            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 put has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public Response<Object> put(String url,
                                  Map<String, String> routeParamsMap,
                                  Map<String, String> queryStringMap,
                                  Map<String, String> headersMap,
                                  Object bodyObject) throws HttpClientException {

              Method executeHttpRequestWithBody has 5 arguments (exceeds 4 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 {

                Method delete has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public Response<Object> delete(String url,
                                         Map<String, String> routeParamsMap,
                                         Map<String, String> queryStringMap,
                                         Map<String, String> headersMap,
                                         Object bodyObject) throws HttpClientException {

                  Method scheduleJob has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public JobDetail scheduleJob(Class<? extends Job> jobClazz,
                                                   String jobName,
                                                   String tenantName,
                                                   JobDataMap jobDataMap, int intervalInMins) throws SchedulerException {

                    Method executeGetRequest has 5 arguments (exceeds 4 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 {

                      Method get has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public <T> Response<T> get(String url,
                                            Map<String, String> routeParamsMap,
                                            Map<String, String> queryStringMap,
                                            Map<String, String> headersMap,
                                            Class<T> clazz) throws HttpClientException {

                        Method head has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public <T> Response<T> head(String url,
                                             Map<String, String> routeParamsMap,
                                             Map<String, String> queryStringMap,
                                             Map<String, String> headersMap,
                                             Class<T> clazz) throws HttpClientException {

                          Method post has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public Response<Object> post(String url,
                                               Map<String, String> routeParamsMap,
                                               Map<String, String> queryStringMap,
                                               Map<String, String> headersMap,
                                               Object bodyObject) throws HttpClientException {

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

                            def post_tweet(speech_text, consumer_key, consumer_secret, access_token, access_token_secret):
                            Severity: Minor
                            Found in ria/GreyMatter/twitter_interaction.py - About 35 mins to fix

                              Method sendMessageToUser has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private void sendMessageToUser(String userEmail, SlackSession session, String channelId, String message) {
                                      if (channelId != null && !channelId.trim().isEmpty()) {
                                          SlackChannel channel = session.findChannelById(channelId);
                                          session.sendMessage(channel, message);
                                      } else {

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

                                  @Override
                                  public boolean isValid() throws ValidationException {
                                      boolean isValid = isReqd(cloudProvider);
                                      if (isValid) {
                                          for (Command command: commands) {
                              Severity: Minor
                              Found in command-db/src/main/java/edu/sjsu/amigo/command/db/model/Provider.java - 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 mp3gen has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                              def mp3gen(music_path):
                                  """
                                  This function finds all the MP3 files in a folder and its subfolders and
                                  returns a list:
                                  """
                              Severity: Minor
                              Found in ria/GreyMatter/play_music.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