ucberkeley/moocchat

View on GitHub
turk/src/com/amazonaws/mturk/cmd/summary/SummaryUtils.java

Summary

Maintainability
C
1 day
Test Coverage

Method findMostFrequent has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public static String findMostFrequent(List<String> answers, int[] numMostFreqVotes, int numAssignments) throws UnresolvedAnswerException {
        if(answers == null || answers.size() == 0){
            throw new UnresolvedAnswerException("No answers submitted", ErrorReason.InProgress);
        }

Severity: Minor
Found in turk/src/com/amazonaws/mturk/cmd/summary/SummaryUtils.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 findMostFrequent has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static String findMostFrequent(List<String> answers, int[] numMostFreqVotes, int numAssignments) throws UnresolvedAnswerException {
        if(answers == null || answers.size() == 0){
            throw new UnresolvedAnswerException("No answers submitted", ErrorReason.InProgress);
        }

Severity: Minor
Found in turk/src/com/amazonaws/mturk/cmd/summary/SummaryUtils.java - About 1 hr to fix

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

        public static Map<String, List<String>> summarizeResults(
                Map<String, List<String[]>> hitAssignments, int answerIndex, int numAssignmentsIndex) {
    
            Map<String, List<String>> hitSummaries = new LinkedHashMap<String, List<String>>();
            for(Map.Entry<String,List<String[]>> hitResults : hitAssignments.entrySet()){
    Severity: Minor
    Found in turk/src/com/amazonaws/mturk/cmd/summary/SummaryUtils.java - 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 summarizeResults has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static Map<String, List<String>> summarizeResults(
                Map<String, List<String[]>> hitAssignments, int answerIndex, int numAssignmentsIndex) {
    
            Map<String, List<String>> hitSummaries = new LinkedHashMap<String, List<String>>();
            for(Map.Entry<String,List<String[]>> hitResults : hitAssignments.entrySet()){
    Severity: Minor
    Found in turk/src/com/amazonaws/mturk/cmd/summary/SummaryUtils.java - About 1 hr to fix

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

          public static Map<String, List<String[]>> parseHitAssignments(
                  String resultsFile, String[] requiredFields, int[] fieldIndicesPlaceholder, char fieldSeparator) {
      
              Map<String, List<String[]>> hitAssignments = new LinkedHashMap<String, List<String[]>>();
              try {
      Severity: Minor
      Found in turk/src/com/amazonaws/mturk/cmd/summary/SummaryUtils.java - About 1 hr to fix

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

            public static Map<String, String> extractQuestion(Map<String, List<String[]>> hitAssignments, int questionIndex) {
                Map<String, String> hitQuestions = new LinkedHashMap<String, String>();
                for(Map.Entry<String, List<String[]>> hitResults : hitAssignments.entrySet()){
                    String hitId = hitResults.getKey();
                    List<String[]> assignmentsDetails = hitResults.getValue();
        Severity: Minor
        Found in turk/src/com/amazonaws/mturk/cmd/summary/SummaryUtils.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

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

            public static Map<String, List<String[]>> parseHitAssignments(
                    String resultsFile, String[] requiredFields, int[] fieldIndicesPlaceholder, char fieldSeparator) {
        
                Map<String, List<String[]>> hitAssignments = new LinkedHashMap<String, List<String[]>>();
                try {
        Severity: Minor
        Found in turk/src/com/amazonaws/mturk/cmd/summary/SummaryUtils.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

        There are no issues that match your filters.

        Category
        Status