Showing 462 of 1,666 total issues
Function CategoriesScoping
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
const CategoriesScoping = () => {
const depth = useSelector(state => state.scopingMethods.categories.depth);
const categories = useSelector(state => state.scopingMethods.categories.tracked);
const home_wiki = useSelector(state => state.course.home_wiki);
const dispatch = useDispatch();
File training_slide_handler.jsx
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useEffect, useState } from 'react';
import { useNavigate, useParams } from 'react-router';
import { extend } from 'lodash-es';
import { useDispatch, useSelector } from 'react-redux';
import { fetchTrainingModule, setSlideCompleted, setCurrentSlide, toggleMenuOpen } from '../../actions/training_actions.js';
Function articleFromTitleInput
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
static articleFromTitleInput(articleTitleInput) {
const articleTitle = articleTitleInput;
if (!/http/.test(articleTitle)) {
const title = articleTitle.replace(/_/g, ' ');
return {
Function SettingsHandler
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
const SettingsHandler = () => {
const dispatch = useDispatch();
const adminUsers = useSelector(state => state.settings.adminUsers);
const specialUsers = useSelector(state => state.settings.specialUsers);
Function newsContent
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
const newsContent = newsContentList.map((news, index) => {
const isCurrentlyEditedNews = editNewsId === news.id;
const isHovered = newsHoverId === news.id;
const confirmDelete = confirmDeleteNewsId === news.id;
// Opaque text area input when admin selects delete news
Function downgradeSpecialUser
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const downgradeSpecialUser = (username, position) => (dispatch) => {
// remove a user's admin status
// username: user's username
dispatch({
type: REVOKING_SPECIAL_USER,
Function TrainingModulesViewMode
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
const TrainingModulesViewMode = (props) => {
const block = props.block;
const modules = [];
const length = block.training_modules.length;
Function TrainingModuleHandler
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
const TrainingModuleHandler = (props) => {
useEffect(() => {
const moduleId = document.getElementById('react_root').getAttribute('data-module-id');
props.fetchTrainingModule({ module_id: moduleId });
}, []);
Function articleFinder
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export default function articleFinder(state = initialState, action) {
switch (action.type) {
case UPDATE_FINDER_FIELD: {
const newState = { ...state };
newState[action.data.key] = action.data.value;
- 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 a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
render() {
let content;
let faqLink;
let wikipediaHelpButton;
- 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 CourseOresPlot
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
const CourseOresPlot = ({ course }) => {
const [show, setShow] = useState(false);
const [refreshedData, setRefreshedData] = useState(null);
const [loading, setLoading] = useState(true);
const [refresh, setRefresh] = useState(false);
- 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 PetScanScoping
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
const PetScanScoping = () => {
const [inputValue, setInputValue] = React.useState('');
const petscanIDs = useSelector(state => state.scopingMethods.petscan.psids);
const dispatch = useDispatch();
const home_wiki = useSelector(state => state.course.home_wiki);
- 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 PagePileScoping
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
const PagePileScoping = () => {
const [inputValue, setInputValue] = useState('');
const pagePileIds = useSelector(state => state.scopingMethods.pagepile.ids);
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
Method create_alerts
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def create_alerts
@courses.each do |course|
next unless course.type == 'ClassroomProgramCourse'
next unless course.approved? # No alerts needed for unapproved courses
next if Alert.exists?(course_id: course.id, type: 'UntrainedStudentsAlert')
- 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 InlineUsers
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
const InlineUsers = (props) => {
const lastUserIndex = props.users.length - 1;
let userList = props.users.map((user, index) => {
let extraInfo = '';
const link = `/users/${user.username}`; // User profile page
- 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 fetchCourseScopedRevisions
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const fetchCourseScopedRevisions = (course, limit) => async (dispatch, getState) => {
const state = getState();
const users = state.users.users.filter(user => user.role === STUDENT_ROLE);
dispatch({ type: COURSE_SCOPED_REVISIONS_LOADING });
Function downgradeAdmin
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const downgradeAdmin = username => (dispatch) => {
// remove a user's admin status
// username: user's username
dispatch({
type: REVOKING_ADMIN,
Function render
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<tr>
<td>
<form onSubmit={this.handleSubmit}>
Function moduleByExercises
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
const moduleByExercises = (modules) => {
const orderedSteps = [
'Complete your Bibliography',
'Create in the sandbox',
'Expand your Draft',
Function SlideMenu
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
const SlideMenu = (props) => {
useEffect(() => {
window.addEventListener('click', props.closeMenu, false);
return () => {