Showing 454 of 1,606 total issues
Function onreadystatechange
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
document.onreadystatechange = () => {
if (document.readyState === 'complete') {
// Find tables with rows with data-link attribute, then make them clickable
document.querySelector('tr[data-link]')?.addEventListener('click', (e) => {
// skip if a button was clicked (used for other actions)
File course_approval.jsx
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
import { difference, uniq } from 'lodash-es';
Function updateAlerts
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
const updateAlerts = () => {
const newAlerts = [];
// //////////////////////////////////
// Admin / Instructor notifications /
Function renderGraph
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
const renderGraph = () => {
const vegaSpec = {
width: props.graphWidth,
height: props.graphHeight,
padding: 5,
Function render
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const modifiers = {
['outrange']: (day) => {
return !this.inrange(day);
},
Function render
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
if (!this.shouldShowDiff(this.props) || !this.props.revision) {
return (
<div className={`tooltip-trigger ${this.props.showButtonClass}`}>
<button onClick={this.showDiff} aria-label="Open Diff Viewer" className="icon icon-diff-viewer"/>
Function render
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
render() {
if (this.props.loadingUserCourses) {
return <div />;
}
// There are four fundamental states: NewOrClone, CourseForm, wizardForm and CloneChooser
- 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
Function TrainingSlideHandler
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
const TrainingSlideHandler = () => {
const training = useSelector(state => state.training);
const routeParams = useParams();
const navigate = useNavigate();
const dispatch = useDispatch();
- 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
Function render
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const dateCalc = new DateCalculator(this.props.timeline_start, this.props.timeline_end, this.props.index, { zeroIndexed: false });
let weekDatesContent;
let meetDates;
if (this.props.meetings && this.props.meetings.length > 0) {
Function render
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const course = this.props.course;
if (!course) { return <div />; }
const dateProps = CourseDateUtils.dateProps(course);
let courseLinkClass = 'dark button ';
Function NamespaceSelect
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
const NamespaceSelect = (props) => {
const [selectedNamespaces, setSelectedNamespaces] = useState([]);
const [options, setOptions] = useState([]);
useEffect(() => {
File course_quality_progress_graph.jsx
has 321 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* global vegaEmbed */
import React, { useEffect } from 'react';
import PropTypes from 'prop-types';
File ArticleViewer.jsx
has 321 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useEffect, useRef, useState } from 'react';
import PropTypes from 'prop-types';
import { useSelector, useDispatch } from 'react-redux';
// Utilities
Class WikidataSummaryParser
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class WikidataSummaryParser
REVISION_CLASSIFICATIONS = {
'claims created' => :created_claim?,
'claims changed' => :changed_claim?,
'claims removed' => :removed_claim?,
Function ImpactStatsForm
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ImpactStatsForm = (props) => {
const [stats, setStats] = useState({});
const handleChange = (key, value) => {
setStats({ ...stats, [key]: value });
Class CoursesPresenter
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class CoursesPresenter
attr_reader :current_user, :campaign_param
def initialize(current_user:, campaign_param: nil, courses_list: nil, page: nil, tag: nil)
@current_user = current_user
Function articles
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function articles(state = initialState, action) {
switch (action.type) {
case RECEIVE_ARTICLES: {
const wikis = uniqWith(
map(action.data.course.articles, mapWikis),
Function renderGraph
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
const renderGraph = (statsData, graphWidth, graphHeight, courseStringPrefix) => {
const vegaSpec = {
width: graphWidth,
height: graphHeight,
padding: { top: 40, left: 70, right: 20, bottom: 35 },
Function render
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
assignments, course, current_user, editable,
showRecent, student
} = this.props;
Function Block
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
const Block = (props) => {
const updateBlock = (valueKey, value) => {
const toPass = { ...props.block };
toPass[valueKey] = value;
delete toPass.deleteBlock;
- 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"