Showing 462 of 1,666 total issues
Function Course
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Course = withRouter((props) => {
useEffect(() => {
// Fetch all the data needed to render a course page
const courseSlug = getCourseSlug();
props.fetchCourse(courseSlug);
Function Panel
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Panel = (props) => {
const persistState = () => {
const step = props.step.toLowerCase().split(' ').slice(0, 2);
step[1] = +step[1] + 1; // Keeping the step in line with the UI
window.history.pushState(
Function OnboardingSupplementary
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const OnboardingSupplementary = (props) => {
const formRef = useRef(null);
const navigate = useNavigate();
const [state, setState] = useState({
heardFrom: '',
Function onreadystatechange
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
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)
Function updateAlerts
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const updateAlerts = () => {
const newAlerts = [];
// //////////////////////////////////
// Admin / Instructor notifications /
Function renderGraph
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Open
render() {
const modifiers = {
['outrange']: (day) => {
return !this.inrange(day);
},
Function render
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
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
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
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
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
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
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
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
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
Open
const ImpactStatsForm = (props) => {
const [stats, setStats] = useState({});
const handleChange = (key, value) => {
setStats({ ...stats, [key]: value });
Function TimelineHandler
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const TimelineHandler = (props) => {
const [reorderable, setReorderable] = useState(false);
const [editableTitles, setEditableTitles] = useState(false);
// Replace componentDidMount with useEffect hook
Class CoursesPresenter
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
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
Open
export default function articles(state = initialState, action) {
switch (action.type) {
case RECEIVE_ARTICLES: {
const wikis = uniqWith(
map(action.data.course.articles, mapWikis),