Showing 462 of 1,667 total issues
Function default
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function (state = initialState, action) {
switch (action.type) {
case DELETE_TICKET: {
const all = removeTicket(state.all, action.id);
return {
File diff_viewer.jsx
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import SalesforceMediaButtons from '../articles/salesforce_media_buttons.jsx';
import Loading from '../common/loading.jsx';
File date_picker.jsx
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import DayPicker from 'react-day-picker';
import OnClickOutside from 'react-onclickoutside';
Function CourseTypeSelector
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
const CourseTypeSelector = (props) => {
const _getFormattedCourseType = (type) => {
return {
ClassroomProgramCourse: 'Wikipedia Student Program',
VisitingScholarship: 'Visiting Scholarship',
Function revisions
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
export default function revisions(state = initialState, action) {
switch (action.type) {
case INCREASE_LIMIT: {
let revisionsDisplayed = state.revisionsDisplayed.concat(
state.revisions.slice(
- 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 NewsPopoverContent
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
const NewsPopoverContent = ({ createNews }) => {
// Retrieve the news content list from the Redux store
const newsContentList = useSelector(state => state.news.news_content_list);
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 FinalArticleChecklist
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
const FinalArticleChecklist = () => {
const checklistItems = [
{ key: '1', label: "The title is short and simple. It doesn't look like an essay, or ask a question." },
{ key: '2', label: 'The first sentence is direct and useful; it clearly defines the subject, with the topic of the article in bold.' },
{ key: '3', label: 'The lead section is a clear summary, not an introduction or argument. A reader could stop at the end of the lead and have a good overview of the most important aspects of the topic.' },
DiffViewer
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
const DiffViewer = createReactClass({
displayName: 'DiffViewer',
// Diff viewer takes a main (final) revision, and optionally a first revision.
// If a first revision is supplied, it fetches a diff from the parent of the
Class DashboardPresenter
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class DashboardPresenter
include Rails.application.routes.url_helpers
attr_reader :courses, :current, :past, :submitted, :strictly_current, :current_user
Function panels
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
const panels = this.props.panels.map((panel, i) => {
const active = this.props.activePanelIndex === i;
const stepNumber = i + 1;
let outOf;
if (i > 1) {
Function Course
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
const Course = withRouter((props) => {
useEffect(() => {
// Fetch all the data needed to render a course page
const courseSlug = getCourseSlug();
props.fetchCourse(courseSlug);
- 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 Assignment
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
const Assignment = (props) => {
if (!props.course.home_wiki) { return <div />; }
const article = props.article || CourseUtils.articleFromAssignment(props.assignmentGroup[0], props.course.home_wiki);
if (!article.formatted_title) {
article.formatted_title = CourseUtils.formattedArticleTitle(article, props.course.home_wiki, props.wikidataLabel);
- 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 19 (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 unless course.students.empty?
- 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 course
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function course(state = initialState, action) {
switch (action.type) {
case TOGGLE_SCOPING_METHOD: {
if (state.selected.includes(action.method)) {
return {
Function render
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
let description;
if (this.props.source === 'pileid') {
description = (
<p>
Function YesNoSelector
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
const YesNoSelector = (props) => {
const initialState = props.course[props.courseProperty] ? I18n.t('application.opt_yes') : I18n.t('application.opt_no');
const [selectedOption, setSelectedOption] = useState({ value: initialState, label: initialState });
const _handleChange = (e) => {
Function ArticlesHandler
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ArticlesHandler = (props) => {
const [loading, setLoading] = useState(true);
useEffect(() => {
delayFetchAssignmentsAndArticles(props, () => setLoading(false));
File course_form.jsx
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import TextAreaInput from '../common/text_area_input.jsx';
import CreatableInput from '../common/creatable_input.jsx';
import TextInput from '../common/text_input.jsx';
import CourseLevelSelector from './course_level_selector.jsx';
File article_list.jsx
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
Function Quiz
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Quiz = (props) => {
const [selectedAnswerId, setSelectedAnswerId] = useState(null);
const setAnswer = (e) => {
return setSelectedAnswerId(e.currentTarget.getAttribute('data-answer-id'));