Showing 24 of 102 total issues
Function render
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
let classrooms;
let spinner;
if (this.state.isLoading) {
spinner = (
Function render
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const deleteButton = (
<DeleteClassroomModal classroom_id = { this.state.classroom.id } />
);
Function render
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div className="card-col">
<div type="button" className="add-course">
<div data-toggle="modal" data-target="#newClassroomModal" >
Function render
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
let emptyState;
if (this.state.students.length == 0) {
emptyState = (
<div className="empty-table-container">
Function render
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
deactivate_button_value = this.state.program.is_active ? "Deactivate Program" : "Activate Program";
const programType = `program-${this.state.program.id}`;
return (
Function render
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
let radioValue;
const uniqueId = `${this.props.name}_${this.props.value}`;
if (this.props.editable) {
radioValue = (
Function render
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const radioOptions = this.state.question.options.map((option, index) => {
const checked = (this.state.question.answer == index);
return (
<div className="input-container" key={`input_${this.props.question.id}_${index}`}>
Function render
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div className="card-col">
<div type="button" className="add-course">
<div data-toggle="modal" data-target="#newProgramModal" >
Function render
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div>
<div className="login-title">
<span className="fa fa-angle-left back"
Function render
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div className="onboarding-container">
<div className="onboarding-overlay"></div>
<div className="modal fade" id="onboarding-modal" tabIndex={-1}
Function render
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const spanClass = "fa " + (this.state.submit ? "fa-check-circle-o" : "fa-upload");
return (
<div>
<div className="modal-body">
Function render
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div className="action-item delete-item">
<button data-toggle="modal" data-target="#removeClassroomModal"
className="button button-small delete-button">
Function render
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div className="action-item create-item">
<div data-toggle="modal" data-target="#newStudentModal" >
<button onClick={this._focusInputField} type="button" className="student-card add-card submit-button-o button-small">
Function render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
var old_password = <div></div>;
if (this.props.reset_token == null) {
old_password = (
<fieldset className="input-container">
Function render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div className="action-item additional-info-item">
<button data-toggle="modal" data-target="#additionalInfoModal"
className="button button-small additional-info-item-button">
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
let inputVal;
if (this.props.editable) {
inputVal = (
<input name={this.props.name} type="text"
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const questions = this.state.questions.map((question) => {
return <AdminAdditionalInfoQuestion question = {question}
key = {question.id}
success = {this._fetchQuestions} />
Function render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div>
<div className="login-title">
<h1>Educator Portal</h1>
Function render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
let classpage, onboard;
if (this.props.onboarding && !this.props.isAdmin) {
onboard = <ClassroomOnboard teacher_id = {this.props.teacher_id} />
Method update_question
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def update_question(question)
question.options = params[:options].reject(&:empty?) if params.key?(:options)
if params.key?(:answer)
question.answer = (params[:answer] == '-1') ? nil : params[:answer]
end
- 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"