ucberkeley/moocchat

View on GitHub

Showing 132 of 132 total issues

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

    public void assignQualification( String[] qualIds, String workerId, String score, Boolean notify ) {
        Integer value = null;
        if (score != null) {
            try {
                // Verify that strValue is an integer and not something else
Severity: Minor
Found in turk/src/com/amazonaws/mturk/cmd/AssignQualification.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 runCommand has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected void runCommand(CommandLine cmdLine) throws Exception {
      if (!cmdLine.hasOption(ARG_QUALTYPE)) {
        log.error("Missing: -" + ARG_QUALTYPE + " [QualTypeId]");
        System.exit(-1);
      } else if (!cmdLine.hasOption(INPUT_FILE)) {
Severity: Minor
Found in turk/src/com/amazonaws/mturk/cmd/UpdateQualificationScore.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

Avoid too many return statements within this method.
Open

      return false;
Severity: Major
Found in turk/src/com/amazonaws/mturk/cmd/CreateQualificationType.java - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

          return current_page
    Severity: Major
    Found in app/models/task/task_sequencer.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

          return false;
      Severity: Major
      Found in turk/src/com/amazonaws/mturk/cmd/CreateQualificationType.java - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

              return false;
        Severity: Major
        Found in turk/src/com/amazonaws/mturk/cmd/CreateQualificationType.java - About 30 mins to fix

          Method parseInt has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            private Integer parseInt(CommandLine cmdLine, String option) {
              Integer ret = null;
              if (cmdLine.hasOption(option)) {
                try {
                  int num = Integer.parseInt(cmdLine.getOptionValue(option));
          Severity: Minor
          Found in turk/src/com/amazonaws/mturk/cmd/ExtendHITs.java - 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

          Method run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            public void run(String[] args) {
              try {  
                BasicParser parser = new BasicParser();
                CommandLine cmdLine = parser.parse(opt, args);
                
          Severity: Minor
          Found in turk/src/com/amazonaws/mturk/cmd/AbstractCmd.java - 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

          Method runCommand has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            protected void runCommand(CommandLine cmdLine) throws Exception {
              if (!cmdLine.hasOption(ARG_ASSIGNMENT) && !cmdLine.hasOption(ARG_APPROVEFILE) && !cmdLine.hasOption(ARG_SUCCESSFILE)) {
          
                log.error("Missing: you must supply one of -" + ARG_ASSIGNMENT 
                    + " or -" + ARG_APPROVEFILE + " or -" + ARG_SUCCESSFILE);
          Severity: Minor
          Found in turk/src/com/amazonaws/mturk/cmd/ApproveWork.java - 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

          Method rewriteHeaders has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            private void rewriteHeaders(String source, String destination) throws IOException {
                BufferedReader reader = null;
                Writer writer = null;
                String newline = System.getProperty("line.separator");
                
          Severity: Minor
          Found in turk/src/com/amazonaws/mturk/util/HITResultProcessor.java - 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

          Method check_consent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def check_consent
              # Do not require request.xhr? because it blocks JSONP
              users = User.where(['name = ?', params[:username]])
              if !users.empty?
                @user = users.first
          Severity: Minor
          Found in app/controllers/users_controller.rb - 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

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

            def update
              @activity_schema = ActivitySchema.find(params[:id])
          
              respond_to do |format|
                @question=params[:activity_schema][:questions]
          Severity: Minor
          Found in app/controllers/activity_schemas_controller.rb - 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