Showing 462 of 1,666 total issues
Function alerts
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function alerts(state = initialState, action) {
switch (action.type) {
case RECEIVE_ALERTS: {
const newState = { ...state };
const sortedAlerts = sortByKey(action.data.alerts, 'created_at', null, SORT_DESCENDING.created_at);
Function renderWeekday
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const renderWeekday = (weekday) => {
let dayClassName = 'DayPicker-Weekday';
let customModifiers = [];
if (modifiers) {
Function useBlockDrag
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const useBlockDrag = ({ block, isAnimating, canDrag, onBlockDragOver }) => {
const ref = useRef(null);
// this makes the block draggable
const [{ isDragging }, drag] = useDrag({
- 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 articles
has a Cognitive Complexity of 11 (exceeds 5 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),
- 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 SpecialUser
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const SpecialUser = ({
downgradeSpecialUser, // Prop for downgrading special user (renamed from action creator)
position,
username = 'Not Defined',
realname = 'Not Defined',
- 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 handleCourse
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
handleCourse(course, isValidProp) {
if (this.state.shouldRedirect === true) {
window.location = `/courses/${course.slug}`;
return this.setState({ shouldRedirect: 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 CourseWikiList
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const CourseWikiList = ({ courses, sort }) => {
const dispatch = useDispatch();
if (sort.key) {
// eslint-disable-next-line no-restricted-syntax
for (const key of Object.keys(keys)) {
- 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 run_update
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def run_update
log_start_of_update 'Daily update tasks are beginning.'
update_users
update_commons_uploads
update_article_data
- 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 notification
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def notification(survey_id, curr_user=nil)
if curr_user.nil?
# if curr_user is nil, then we haven't preloaded the user's notifications
notifications = user.survey_notifications.completed.includes(survey_assignment: :survey)
else
- 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 editMode
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const editMode = (e) => {
e.preventDefault();
const $parent = $(e.target).parents('.rails_editable');
$parent.addClass('rails_editable-editing');
$(e.target).hide();
Function wizard
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function wizard(state = initialState, action) {
switch (action.type) {
case RECEIVE_WIZARD_ASSIGNMENT_OPTIONS: {
const assignmentOptions = action.assignmentOptions;
return { ...state, assignmentOptions, panels: panels(assignmentOptions) };
Function assignments
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function assignments(state = initialState, action) {
switch (action.type) {
case RECEIVE_ASSIGNMENTS: {
const dataAssignments = action.data.course.assignments;
// Initial sorting by article title
Function UserProfile
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const UserProfile = () => {
const dispatch = useDispatch();
const stats = useSelector(state => state.userProfile.stats);
const isLoading = useSelector(state => state.userProfile.isLoading);
const userTrainingStatus = useSelector(state => state.userTrainingStatus);
Function TicketShowHandler
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const TicketShowHandler = (props) => {
const { id } = useParams();
const dispatch = useDispatch();
Function fetchAllRevisions
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const fetchAllRevisions = async (API_URL, days, usernames, wiki, course_start, last_date) => {
let ucend;
let exitNext = false;
if (isBefore(subDays(toDate(last_date), days), toDate(course_start))) {
ucend = formatISO(toDate(course_start));
Function updateBlockPosition
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const updateBlockPosition = (movingBlock, newWeekId, targetIndex, blocks) => {
const oldWeekId = movingBlock.id;
const movedBlock = { ...movingBlock };
movedBlock.week_id = newWeekId;
const weekChanged = newWeekId !== oldWeekId;
Function training
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function training(state = initialState, action) {
const data = action.data;
switch (action.type) {
case RECEIVE_TRAINING_MODULE: {
const newState = {
Function AcademicSystem
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const AcademicSystem = (props) => {
const [selectedOption, setSelectedOption] = useState(props.value || 'semester');
useEffect(() => {
props.updateCourseProps({ academic_system: selectedOption });
Function weekNav
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const weekNav = weekNavInfo.map((weekInfo, navIndex) => {
let navClassName = 'week-nav__item';
if (navIndex === 0) {
navClassName += ' is-current';
}
Function DidYouKnowHandler
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const DidYouKnowHandler = () => {
const myCoursesRef = useRef(null);
const dispatch = useDispatch();
const articles = useSelector(state => state.didYouKnow.articles);