BenMusch/nu-tab

View on GitHub

Showing 121 of 137 total issues

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

update = (resourceData, ext) => {
let data = {}
data[this.name] = resourceData
return axios
.put(this.pathTo().update + this._extension(ext), {...data, ...this.authenticityTokenObject()})
Severity: Major
Found in client/app/resources/Resource.js and 1 other location - About 2 hrs to fix
client/app/resources/Resource.js on lines 36..41

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

create = (resourceData, ext) => {
let data = {}
data[this.name] = resourceData
return axios
.post(this.pathTo().create + this._extension(ext), {...data, ...this.authenticityTokenObject()})
Severity: Major
Found in client/app/resources/Resource.js and 1 other location - About 2 hrs to fix
client/app/resources/Resource.js on lines 51..56

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

export const DebaterList = (props) => {
return (
<ul className="debaters">
{props.debaters.map((debater) => {
return <DebaterItem {...debater} key={debater.id} />
Severity: Major
Found in client/app/components/debaters/DebaterList.js and 1 other location - About 2 hrs to fix
client/app/components/schools/SchoolList.js on lines 4..12

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

export const SchoolList = (props) => {
return (
<ul className="schools">
{props.schools.map((school) => {
return <SchoolItem {...school} key={school.id} />
Severity: Major
Found in client/app/components/schools/SchoolList.js and 1 other location - About 2 hrs to fix
client/app/components/debaters/DebaterList.js on lines 4..12

Assignment Branch Condition size for policy_for is too high. [18.81/15]
Open

def self.policy_for(debater, round)
if round.bye? || round.all_win?
AverageStatsPolicy.new debater, round
elsif round.forfeit? || round.all_drop?
klass = round.winner?(debater.team) ? AverageStatsPolicy : self.forfeit_policy
Severity: Minor
Found in app/policies/stats/round.rb by rubocop

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

<FormGroup controlId="novice">
<ControlLabel>Novice</ControlLabel>
<FormControl
type="checkbox"
checked={this.state.novice}
Severity: Major
Found in client/app/components/debaters/DebaterForm.js and 1 other location - About 1 hr to fix
client/app/components/debaters/DebaterForm.js on lines 61..68

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

<FormGroup controlId="name">
<ControlLabel>Name</ControlLabel>
<FormControl
type="text"
value={this.state.name}
Severity: Major
Found in client/app/components/debaters/DebaterForm.js and 1 other location - About 1 hr to fix
client/app/components/debaters/DebaterForm.js on lines 73..80

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

DebaterItem.propTypes = {
name: React.PropTypes.string.isRequired,
id: React.PropTypes.number.isRequired,
school: React.PropTypes.object.isRequired
}
Severity: Major
Found in client/app/components/debaters/DebaterItem.js and 1 other location - About 1 hr to fix
client/app/components/schools/CreateSchool.js on lines 22..26

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

CreateSchool.propTypes = {
handleSubmit: React.PropTypes.func.isRequired,
handleInputChange: React.PropTypes.func.isRequired,
schoolName: React.PropTypes.string.isRequired
}
Severity: Major
Found in client/app/components/schools/CreateSchool.js and 1 other location - About 1 hr to fix
client/app/components/debaters/DebaterItem.js on lines 11..15

Method validate_standard_result has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def validate_standard_result
if all_stats_submitted?
errors.add(:base, 'Ranks are invalid') unless valid_ranks?
errors.add(:base, 'Speaks are invalid') unless valid_speaks?
errors.add(:base, 'Speaks/Ranks are out of order') unless valid_speaks_ranks_order?
Severity: Minor
Found in app/models/round.rb - About 1 hr to fix

Method <=> has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def <=>(other)
if had_rounds? && other.had_rounds?
return other.stats.wins - stats.wins unless stats.wins == other.stats.wins
super(other)
elsif !had_rounds? && !other.had_rounds?
Severity: Minor
Found in app/models/team.rb - About 1 hr to fix

Method policy_for has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def self.policy_for(debater, round)
if round.bye? || round.all_win?
AverageStatsPolicy.new debater, round
elsif round.forfeit? || round.all_drop?
klass = round.winner?(debater.team) ? AverageStatsPolicy : self.forfeit_policy
Severity: Minor
Found in app/policies/stats/round.rb - About 1 hr to fix

Function render has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

render() {
return(
<div className="debater_form">
<form id="debater" onSubmit={this.handleSubmit}>
<FormGroup controlId="name">
Severity: Minor
Found in client/app/components/debaters/DebaterForm.js - About 1 hr to fix

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

new = (ext) => {
return axios.get(this.pathTo().new + this._extension(ext), this.authenticityTokenObject())
}
Severity: Major
Found in client/app/resources/Resource.js and 3 other locations - About 55 mins to fix
client/app/resources/Resource.js on lines 28..30
client/app/resources/Resource.js on lines 43..45
client/app/resources/Resource.js on lines 47..49

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

show = (ext) => {
return axios.get(this.pathTo().show + this._extension(ext), this.authenticityTokenObject())
}
Severity: Major
Found in client/app/resources/Resource.js and 3 other locations - About 55 mins to fix
client/app/resources/Resource.js on lines 28..30
client/app/resources/Resource.js on lines 32..34
client/app/resources/Resource.js on lines 47..49

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

edit = (ext) => {
return axios.get(this.pathTo().edit + this._extension(ext), this.authenticityTokenObject())
}
Severity: Major
Found in client/app/resources/Resource.js and 3 other locations - About 55 mins to fix
client/app/resources/Resource.js on lines 28..30
client/app/resources/Resource.js on lines 32..34
client/app/resources/Resource.js on lines 43..45

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

index = (ext) => {
return axios.get(this.pathTo().index + this._extension(ext), this.authenticityTokenObject())
}
Severity: Major
Found in client/app/resources/Resource.js and 3 other locations - About 55 mins to fix
client/app/resources/Resource.js on lines 32..34
client/app/resources/Resource.js on lines 43..45
client/app/resources/Resource.js on lines 47..49

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

def <=>(other)
RANKING_PRIORITY.each do |attr|
difference = other.stats.send(attr) - stats.send(attr)
next if difference.zero?
return attr.include?('ranks') ? -1 * difference : difference
Severity: Minor
Found in app/models/concerns/rankable.rb - About 25 mins to fix

Add an empty line after magic comments.
Open

module ScratchesHelper
Severity: Minor
Found in app/helpers/scratches_helper.rb by rubocop

Inconsistent indentation detected.
Open

def room_params
params.require(:room).permit(:name, :rank)
end
Severity: Minor
Found in app/controllers/rooms_controller.rb by rubocop
Severity
Category
Status
Source
Language