ucberkeley/moocchat

View on GitHub

Showing 95 of 132 total issues

Method close has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  public synchronized void close() {
    realWriter.close();
    // check if headers were dynamically modified
    if (outputFilename != null && this.getFieldNamesSize() != this.realWriter.getFieldNamesSize()) {
      try { 
Severity: Minor
Found in turk/src/com/amazonaws/mturk/util/HITResultProcessor.java - 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 update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function update() {
    $.ajax({
        url:'https://moocchat.herokuapp.com/get_current_timestamp_utc/',
        dataType: 'jsonp',
        type: 'GET',
Severity: Minor
Found in public/moocchat_global_notification.js - 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 receiveMessages has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  receiveMessages: function() {
    var self = this;
    this.ws.onmessage = function(message) {
      var data = JSON.parse(message.data)
      if (data.type == "message" & self.isBoth()) {
Severity: Minor
Found in app/assets/javascripts/web_socket.js - 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 makeTemplate has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

  private void makeTemplate(String template, String target, String type, String os,
      String templateRootDirPath, String targetRootDirPath, String scriptTemplateDir) throws Exception {
Severity: Major
Found in turk/src/com/amazonaws/mturk/cmd/MakeTemplate.java - About 50 mins to fix

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

      private void makeTemplate(String template, String target, String type, String os,
          String templateRootDirPath, String targetRootDirPath, String scriptTemplateDir) throws Exception {
    
        String targetDirPath = targetRootDirPath + File.separator + target;
        File targetDir = new File(targetDirPath);
    Severity: Minor
    Found in turk/src/com/amazonaws/mturk/cmd/MakeTemplate.java - About 45 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 redistribute_message has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def redistribute_message(websocket_data, channel, my_position)
        message = extract_text(websocket_data)
        type = extract_type(websocket_data)
        taskid = extract_taskid(websocket_data)
        if type != "heartbeat"   # Heartbeat too spammy
    Severity: Minor
    Found in app/middleware/chat_server.rb - About 45 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 runCommand has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      protected void runCommand(CommandLine cmdLine) throws Exception {
    
        if (!cmdLine.hasOption(ARG_TEMPLATE)) {
          log.error("Missing: -" + ARG_TEMPLATE);
          printHelp();
    Severity: Minor
    Found in turk/src/com/amazonaws/mturk/cmd/MakeTemplate.java - About 45 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 rejectQualRequests has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      private void rejectQualRequests(String[] qualReqs, String[] comments) {
        
        // If we're not given anything, just no-op
        if (qualReqs == null) {
          return;
    Severity: Minor
    Found in turk/src/com/amazonaws/mturk/cmd/RejectQualificationRequests.java - About 45 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 loadHITs has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      public HIT[] loadHITs(String input, String question, String props, 
          String previewFile, int maxHITs, boolean preview) throws Exception {
    Severity: Minor
    Found in turk/src/com/amazonaws/mturk/cmd/LoadHITs.java - About 45 mins to fix

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

        public void grantQualRequestsInFile(String fileName, Integer defaultValue) throws IOException {
          if (fileName == null) {
            throw new IllegalArgumentException("fileName must not be null");
          }
          
      Severity: Minor
      Found in turk/src/com/amazonaws/mturk/cmd/GrantQualificationRequests.java - About 45 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

      Avoid deeply nested control flow statements.
      Open

                    if (learners == '') {
                      learners = i + 1;
                    } else {
                      learners = learners + " and " + (i + 1);
                    }
      Severity: Major
      Found in app/assets/javascripts/web_socket.js - About 45 mins to fix

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

          public HIT[] updateHITs(String successFile, String props) throws Exception {
        
            HITProperties hc = new HITProperties(props);
        
            // Output initializing message
        Severity: Minor
        Found in turk/src/com/amazonaws/mturk/cmd/UpdateHITs.java - About 45 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 rejectAssignments has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          private void rejectAssignments(String[] assignments, String[] comments) {
            
            // If we're not given anything, just no-op
            if (assignments == null) {
              return;
        Severity: Minor
        Found in turk/src/com/amazonaws/mturk/cmd/RejectWork.java - About 45 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 generateScript has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          private static void generateScript(String scriptTemplateDir, String target, 
              String targetDirPath, String command, CreateScriptUtil.ScriptType type) throws Exception {
        Severity: Minor
        Found in turk/src/com/amazonaws/mturk/cmd/MakeTemplate.java - About 35 mins to fix

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

            public void updateQualificationType( String qualTypeId, String statusString,
                String questionFile, String answerFile, 
                String propertiesFile ) throws Exception
          Severity: Minor
          Found in turk/src/com/amazonaws/mturk/cmd/UpdateQualificationType.java - About 35 mins to fix

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

                private static void generateScripts(List<String> commands, String scriptDir, CreateScriptUtil.ScriptType type)
                    throws Exception
                {
                    for (String command : commands) {
                        if (type == null) { // All
            Severity: Minor
            Found in turk/src/com/amazonaws/mturk/build/CreateScripts.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 grantQualRequests has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              private void grantQualRequests(String[] qualReqs, Integer[] values) {
                
                // If we're not given anything, just no-op
                if (qualReqs == null) {
                  return;
            Severity: Minor
            Found in turk/src/com/amazonaws/mturk/cmd/GrantQualificationRequests.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 eventlog_sessions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def eventlog_sessions(eventlog)
                result = []
                eventlog_ordered = eventlog.joins(:task).order('tasks.original_chat_group', :created_at)
                current_session = []
                prev_orig_chat_group = nil
            Severity: Minor
            Found in app/controllers/reports_controller.rb - 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 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 copyTemplateFile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              private void copyTemplateFile(String sourceRoot, String targetRoot, String extension) throws Exception {
                String inputFileName = sourceRoot + extension;
                String outputFileName = targetRoot + extension;
                
                System.out.println("Copying resource file: " + outputFileName);
            Severity: Minor
            Found in turk/src/com/amazonaws/mturk/cmd/MakeTemplate.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

            Severity
            Category
            Status
            Source
            Language