ucberkeley/moocchat

View on GitHub

Showing 132 of 132 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    if (!cmdLine.hasOption(ARG_QUALREQ) && !cmdLine.hasOption(ARG_REJECTFILE)) {

      log.error("Missing: you must supply one of -" + ARG_QUALREQ + " or -" + ARG_REJECTFILE + ".");
      System.exit(-1);

turk/src/com/amazonaws/mturk/cmd/AssignQualification.java on lines 65..70
turk/src/com/amazonaws/mturk/cmd/UpdateQualificationType.java on lines 71..75

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  protected void initOptions() {
    opt.addOption(ARG_QUALREQ, true,
        "The ID of the qualification request to reject (separate multiple qualification request IDs with a comma)");
    opt.addOption(ARG_REJECTFILE, true,
        "The name of the file that contains the qualification request IDs to be rejected (the columns must be titled "
turk/src/com/amazonaws/mturk/cmd/RejectWork.java on lines 44..53

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        protected void initOptions() {
          opt.addOption(ARG_ASSIGNMENT, true,
              "The ID of the assignment to reject (separate multiple assignment IDs with a comma)");
          opt.addOption(ARG_REJECTFILE, true,
              "The name of the file that contains the assignment IDs to be rejected (the column must be titled '" +
      Severity: Minor
      Found in turk/src/com/amazonaws/mturk/cmd/RejectWork.java and 1 other location - About 45 mins to fix
      turk/src/com/amazonaws/mturk/cmd/RejectQualificationRequests.java on lines 40..48

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 55.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        public void rejectQualRequestsInFile(String fileName) throws IOException {
          if (fileName == null) {
            throw new IllegalArgumentException();
          }
          
      turk/src/com/amazonaws/mturk/cmd/RejectWork.java on lines 84..96

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 54.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        public void rejectAssignmentsInFile(String fileName) throws IOException {
          if (fileName == null) {
            throw new IllegalArgumentException();
          }
          
      Severity: Minor
      Found in turk/src/com/amazonaws/mturk/cmd/RejectWork.java and 1 other location - About 45 mins to fix
      turk/src/com/amazonaws/mturk/cmd/RejectQualificationRequests.java on lines 75..87

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 54.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          if (!cmdLine.hasOption(ARG_ASSIGNMENTS) && !cmdLine.hasOption(ARG_HOURS)) {
            log.error("Missing parameters: Please specify an option for either -" + ARG_ASSIGNMENTS + " or -" +ARG_HOURS);
            System.exit(-1);
          } 
      Severity: Minor
      Found in turk/src/com/amazonaws/mturk/cmd/ExtendHITs.java and 1 other location - About 40 mins to fix
      turk/src/com/amazonaws/mturk/cmd/GrantQualificationRequests.java on lines 62..68

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 52.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          formatter.printHelp(UpdateQualificationType.class.getName() +
              " -" + ARG_QUALTYPE + " [QualTypeId] " +
              "(-" + ARG_STATUS + " [Active|Inactive]) " +
              "(-" + ARG_QUESTION + " [path to question file]) " +
              "(-" + ARG_PROPERTIES + " [path to properties file]) " +
      Severity: Minor
      Found in turk/src/com/amazonaws/mturk/cmd/UpdateQualificationType.java and 1 other location - About 40 mins to fix
      turk/src/com/amazonaws/mturk/cmd/GrantBonus.java on lines 45..49

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 52.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          if (!cmdLine.hasOption(ARG_QUALREQ) && !cmdLine.hasOption(ARG_APPROVEFILE)) {
      
            log.error("Missing: you must supply one of -" + ARG_QUALREQ 
                + " or -" + ARG_APPROVEFILE);
            System.exit(-1);
      turk/src/com/amazonaws/mturk/cmd/ExtendHITs.java on lines 86..89

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 52.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          formatter.printHelp(GrantBonus.class.getName() + 
              " -" + ARG_WORKERID + " [worker]" +
              " -" + ARG_AMOUNT + " [amount]" +
              " -" + ARG_ASSIGNMENT + " [assignment]" +
              " -" + ARG_REASON + " [reason]", opt);
      Severity: Minor
      Found in turk/src/com/amazonaws/mturk/cmd/GrantBonus.java and 1 other location - About 40 mins to fix
      turk/src/com/amazonaws/mturk/cmd/UpdateQualificationType.java on lines 61..65

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 52.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

        protected void initOptions() {
          opt.addOption(ARG_WORKERID, true,
            "(required) Id of the Worker to grant the bonus to");
          opt.addOption(ARG_REASON, true,
            "(required) Reason for the bonus");
      Severity: Major
      Found in turk/src/com/amazonaws/mturk/cmd/GrantBonus.java and 4 other locations - About 40 mins to fix
      turk/src/com/amazonaws/mturk/cmd/CreateQualificationType.java on lines 49..58
      turk/src/com/amazonaws/mturk/cmd/DeleteHITs.java on lines 43..52
      turk/src/com/amazonaws/mturk/cmd/GetResults.java on lines 71..80
      turk/src/com/amazonaws/mturk/cmd/UpdateQualificationScore.java on lines 37..42

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

        protected void initOptions() {
          opt.addOption(ARG_SUCCESSFILE, true,
              "(required) A path to the success file returned by the call to LoadHITs");
          opt.addOption(ARG_OUTPUTFILE, true,
              "(required) The file to which you'd like your results saved");
      Severity: Major
      Found in turk/src/com/amazonaws/mturk/cmd/GetResults.java and 4 other locations - About 40 mins to fix
      turk/src/com/amazonaws/mturk/cmd/CreateQualificationType.java on lines 49..58
      turk/src/com/amazonaws/mturk/cmd/DeleteHITs.java on lines 43..52
      turk/src/com/amazonaws/mturk/cmd/GrantBonus.java on lines 33..42
      turk/src/com/amazonaws/mturk/cmd/UpdateQualificationScore.java on lines 37..42

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Severity
      Category
      Status
      Source
      Language