ucberkeley/moocchat

View on GitHub

Showing 95 of 132 total issues

Method sessions_show has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def sessions_show
    eventlog_sessions = eventlog_sessions(EventLog.where(created_at: parse_datetime_picker_date(params[:datetime_start])..parse_datetime_picker_date(params[:datetime_end])))

    @sessions = []
    eventlog_sessions.each do |session_events|
Severity: Minor
Found in app/controllers/reports_controller.rb - About 1 hr to fix

    Function showWelcomeMessage has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      showWelcomeMessage: function(){
        if (this.group.length == 1) {
          this.showMessage("No one is currently available to chat with you. You may use this chatroom to reflect on the question. Click the end button above when done.", "system");
        } else if (this.group.length == 2) {
          var you_learner = '';
    Severity: Minor
    Found in app/assets/javascripts/web_socket.js - 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 runCommand has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          protected void runCommand(CommandLine cmdLine) throws Exception {
            if (!cmdLine.hasOption(QUAL_TYPE) &&
                !cmdLine.hasOption(INPUT_FILE)) {
        
              log.error("Either -" + QUAL_TYPE + " or -" + INPUT_FILE + " should be passed");
        Severity: Minor
        Found in turk/src/com/amazonaws/mturk/cmd/EvaluateQualificationRequests.java - About 1 hr to fix

          Method getHits has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private String[] getHits() {
              HIT[] hits = null;
              List<String> ret = new ArrayList<String>();
              SearchHITsResult result = null;    
              String[] responseGroup = new String [] { "Minimal", "HITDetail" };
          Severity: Minor
          Found in turk/src/com/amazonaws/mturk/cmd/ResetAccount.java - About 1 hr to fix

            Function keyboardEvent has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                keyboardEvent: function(type, options) {
                    var evt;
            
                    var e = $.extend({ bubbles: true, cancelable: true, view: window,
                        ctrlKey: false, altKey: false, shiftKey: false, metaKey: false,
            Severity: Minor
            Found in app/assets/javascripts/jquery.simulate.js - About 1 hr to fix

              Method approveAssignmentsInFile has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                public void approveAssignmentsInFile(String fileName) throws IOException {
                  if (fileName == null) {
                    throw new IllegalArgumentException("fileName must not be null");
                  }
                  
              Severity: Minor
              Found in turk/src/com/amazonaws/mturk/cmd/ApproveWork.java - About 1 hr to fix

                Method getFieldValuesFromFile has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  protected String[] getFieldValuesFromFile(String fileName, String fieldName) throws IOException {
                    
                    HITDataCSVReader csvReader = new HITDataCSVReader(fileName);    
                    
                    // check that we have a header 
                Severity: Minor
                Found in turk/src/com/amazonaws/mturk/cmd/AbstractCmd.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 approveHitsInFile has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  public void approveHitsInFile(String fileName) throws IOException {
                    if (fileName == null) {
                      throw new IllegalArgumentException("fileName must not be null");
                    }
                    
                Severity: Minor
                Found in turk/src/com/amazonaws/mturk/cmd/ApproveWork.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 getHeaderRow has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  private String[] getHeaderRow(HITResults r) {
                    if (headerFields == null) {
                      headerFields = new ArrayList<String>();
                      
                      for (HITProperties.HITField field : HITProperties.HIT_FIELDS) {
                Severity: Minor
                Found in turk/src/com/amazonaws/mturk/cmd/GetResults.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 ensure_setup_socket_for has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  def ensure_setup_socket_for(env)
                    channel, my_position, my_id = channel_and_position_from_url(env['ORIGINAL_FULLPATH'])
                    unless @groups.has_key?(channel) && @groups[channel][my_position]
                      ws = Faye::WebSocket.new(env, nil, {ping: KEEPALIVE_TIME })
                      @groups[channel] ||= []
                Severity: Minor
                Found in app/middleware/chat_server.rb - 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

                Function initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  initialize: function(chatGroup,taskid,rails_mode, type) {
                    this.type = type;
                    if(typeof chatGroup == "number"){
                      this.group = [chatGroup];
                    } else{
                Severity: Minor
                Found in app/assets/javascripts/web_socket.js - 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 getValues has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static <T> T[] getValues(Class<T> wsdlEnumClass) {
                        List<T> values = new ArrayList<T>();
                        for (Field field : wsdlEnumClass.getFields()) {
                            if (Modifier.isPublic(field.getModifiers()) &&
                                Modifier.isFinal(field.getModifiers()) &&
                Severity: Minor
                Found in turk/src/com/amazonaws/mturk/util/WsdlEnumUtil.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 runCommand has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  protected void runCommand(CommandLine cmdLine) throws Exception {
                
                      if (!cmdLine.hasOption(ARG_QUALTYPE) &&
                          !cmdLine.hasOption(ARG_INPUT_FILE)) {
                          log.error("Either -" + ARG_QUALTYPE + " or -" + ARG_INPUT_FILE + " should be passed");
                Severity: Minor
                Found in turk/src/com/amazonaws/mturk/cmd/UpdateQualificationType.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 runCommand has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  protected void runCommand(CommandLine cmdLine) throws Exception {
                    if (!cmdLine.hasOption(ARG_WORKERID)) {
                
                      log.fatal("Missing: -" + ARG_WORKERID + " [worker to grant bonus to]");
                      System.exit(-1);
                Severity: Minor
                Found in turk/src/com/amazonaws/mturk/cmd/GrantBonus.java - About 1 hr to fix

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

                    def ensure_setup_socket_for(env)
                      channel, my_position, my_id = channel_and_position_from_url(env['ORIGINAL_FULLPATH'])
                      unless @groups.has_key?(channel) && @groups[channel][my_position]
                        ws = Faye::WebSocket.new(env, nil, {ping: KEEPALIVE_TIME })
                        @groups[channel] ||= []
                  Severity: Minor
                  Found in app/middleware/chat_server.rb - About 1 hr to fix

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

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

                        Method loadHITs has 8 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

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

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

                            protected void initService() {
                              if (service == null) {
                                
                                if (ClientConfig.SANDBOX_SERVICE_URL.equalsIgnoreCase(config.getServiceURL())) {
                                  // configure sandbox/throttling friendly settings 
                          Severity: Minor
                          Found in turk/src/com/amazonaws/mturk/cmd/AbstractCmd.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

                          Severity
                          Category
                          Status
                          Source
                          Language