Showing 97 of 178 total issues
Function makeSortable
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
Open
makeSortable: function(table) {
if (table.getElementsByTagName('thead').length == 0) {
// table doesn't have a tHead. Since it should have, create one and
// put the first table row in it.
the = document.createElement('thead');
- 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 change
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def change
execute "drop view participant_challenges;"
add_column :challenges, :description_markdownx, :text, after: :end_time
add_column :challenges, :descriptionx, :text, after: :description_markdownx
add_column :challenges, :evaluation_markdownx, :text, after: :descriptionx
File external_graders_controller.rb
has 360 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class Api::ExternalGradersController < Api::BaseController
before_action :auth_by_api_key, only: [:show, :update]
before_action :auth_by_api_key_and_client_id, only: [:create]
def show #GET
Method challenge_params
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def challenge_params
params
.require(:challenge)
.permit(
:id,
Method create_leaderboard
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create_leaderboard(leaderboard_type:)
post_challenge, cuttoff_dttm = leaderboard_params(leaderboard_type: leaderboard_type)
sql = %Q[
INSERT INTO base_leaderboards (
File sorttable.js
has 338 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
SortTable
version 2
7th April 2007
Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
File calculate_leaderboard_service.rb
has 322 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class CalculateLeaderboardService
def initialize(challenge_round_id:)
@round = ChallengeRound.find(challenge_round_id)
@order_by = get_order_by
Method change
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def change
execute "drop rule update_challenge_views on challenge_views;"
drop_view :challenge_views
create_view :challenge_views, "
Method change
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def change
execute "drop rule update_challenge_views on challenge_views;"
drop_view :challenge_views
create_view :challenge_views, "
Method change
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def change
execute "update submissions set score = 0, score_secondary = 0 where challenge_id = 12;"
execute "update submissions set score = 30.1795168296, score_secondary = 32.6215108021 where id = 3530;"
execute "update submissions set score = 29.7315225146, score_secondary = 32.2190151623 where id = 3532;"
execute "update submissions set score = 28.9940347595, score_secondary = 31.520271205 where id = 3535;"
Method change
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def change
create_view :challenge_views, "
SELECT
c.id,
c.organizer_id,
Function makeSortable
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
makeSortable: function(table) {
if (table.getElementsByTagName('thead').length == 0) {
// table doesn't have a tHead. Since it should have, create one and
// put the first table row in it.
the = document.createElement('thead');
Method change
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def change
drop_view :leaderboards
create_view :leaderboards,
"
SELECT l.row_num,
Method change
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def change
execute "update submissions set score = 0, score_secondary = 0 where challenge_id = 12;"
execute "update submissions set score = 28.5914468, score_secondary = 31.01892051 where id = 3530;"
execute "update submissions set score = 28.17302633, score_secondary = 30.62651468 where id = 3532;"
execute "update submissions set score = 27.08935975, score_secondary = 29.55906082 where id = 3535;"
Method create
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create #POST
Rails.logger.info "[api] Api::ExternalGradersController#create"
Rails.logger.info "[api] params: #{params}"
message = nil
status = nil
Method insert_baseline_rows
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def insert_baseline_rows(leaderboard_type:)
post_challenge, cuttoff_dttm = leaderboard_params(leaderboard_type: leaderboard_type)
sql = %Q[
INSERT INTO base_leaderboards (
id,
Method update
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def update #PATCH
Rails.logger.info "[api] Api::ExternalGradersController#update"
Rails.logger.info "[api] params: #{params}"
message = nil
status = nil
Method create
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
def create #POST
Rails.logger.info "[api] Api::ExternalGradersController#create"
Rails.logger.info "[api] params: #{params}"
message = nil
status = nil
- 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 change
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def change
drop_view :participant_challenges
create_view :participant_challenges, "
SELECT p.id,
pc.challenge_id, -- fk to challenges
Method change
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def change
drop_view :participant_challenges
create_view :participant_challenges, "
SELECT p.id,
pc.challenge_id, -- fk to challenges