Showing 95 of 132 total issues
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);
}
Method runCommand
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected void runCommand(CommandLine cmdLine) throws Exception {
if (!cmdLine.hasOption(ARG_INPUT)) {
log.error("Missing: -" + ARG_INPUT
+ " [path to input file -- ie. c:\\mturk\\helloworld.input]");
- Read upRead up
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 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()){
- Read upRead up
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 38 lines of code (exceeds 25 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);
Function initialize
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
initialize: function(chatGroup,taskid,rails_mode, type) {
this.type = type;
if(typeof chatGroup == "number"){
this.group = [chatGroup];
} else{
Method update
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def update
@condition = Condition.find(params[:id])
params[:condition][:primary_activity_schema] = (params[:condition][:primary_activity_schema] == "")? nil : ActivitySchema.find(params[:condition][:primary_activity_schema].to_i)
params[:condition][:time_filler] = (params[:condition][:time_filler] == "")? nil : ActivitySchema.find(params[:condition][:time_filler].to_i)
- Read upRead up
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 sessions_show
has a Cognitive Complexity of 12 (exceeds 5 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|
- Read upRead up
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 create
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def create
params[:condition][:primary_activity_schema] = (params[:condition][:primary_activity_schema] == "")? nil : ActivitySchema.find(params[:condition][:primary_activity_schema].to_i)
params[:condition][:time_filler] = (params[:condition][:time_filler] == "")? nil : ActivitySchema.find(params[:condition][:time_filler].to_i)
#to handle the collection_select to object array
- Read upRead up
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 12 (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 + " must be passed");
System.exit(-1);
- Read upRead up
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 current_page
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def current_page(condition=nil)
return nil if @where == :finished
@condition ||= condition
array = array_for_current_subsequence
# boundary condition: zero body iterations => skip to epilogue
- Read upRead up
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()){
Method getFieldValuesFromFile
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected String[] getFieldValuesFromFile(String fileName, String fieldName) throws IOException {
HITDataCSVReader csvReader = new HITDataCSVReader(fileName);
// check that we have a header
Method processAnswers
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void processAnswers(Map<String, String> values) {
String answers = values.get(ORIG_ANSWER_FIELD);
if (answers == null || HITResults.NO_ANSWER.equals(answers)) {
return ; // return if no answers
Method runCommand
has 32 lines of code (exceeds 25 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 + " must be passed");
System.exit(-1);
Method runCommand
has 32 lines of code (exceeds 25 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");
Method getHits
has a Cognitive Complexity of 11 (exceeds 5 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" };
- Read upRead up
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 getSummary
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Map<String, List<String>> getSummary(String resultsFile) throws ParseException {
// hitid is always required.
String[] requiredFields = new String[]{
"annotation", "Answer.inappropriate", "assignments"
Method rewriteHeaders
has 31 lines of code (exceeds 25 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");
Function update
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function update() {
$.ajax({
url:'https://moocchat.herokuapp.com/get_current_timestamp_utc/',
dataType: 'jsonp',
type: 'GET',
Function sendMessages
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
sendMessages: function() {
var self = this;
if(this.isBoth()){
this.sendChatMessageButton.click(function(event) {
event.preventDefault();