Showing 462 of 1,667 total issues
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 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 CourseApproval
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
const CourseApproval = (props) => {
const [selectedWikiExpert, setSelectedWikiExpert] = useState({});
const [selectedCampaigns, setSelectedCampaigns] = useState([]);
const [selectedTags, setSelectedTags] = useState([]);
const [createdTagOption, setCreatedTagOption] = useState([]);
- 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 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"
Further reading
Function timeline
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function timeline(state = initialState, action) {
switch (action.type) {
case SAVED_TIMELINE:
case RECEIVE_TIMELINE: {
return {
Function renderGraph
has 84 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 },
CourseCreator
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
const CourseCreator = createReactClass({
displayName: 'CourseCreator',
propTypes: {
course: PropTypes.object.isRequired,
Function uploads
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function uploads(state = initialState, action) {
switch (action.type) {
case RECEIVE_UPLOADS: {
const dataUploads = action.data.course.uploads;
// Intial sorting by upload date
File index.js
has 303 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { createSelector } from 'reselect';
import { sortBy, difference, uniq, filter, includes, pickBy, find } from 'lodash-es';
import { getFiltered } from '../utils/model_utils';
import { STUDENT_ROLE, INSTRUCTOR_ROLE, ONLINE_VOLUNTEER_ROLE, CAMPUS_VOLUNTEER_ROLE, STAFF_ROLE, fetchStates, ARTICLES_PER_PAGE, REVIEWING_ROLE } from '../constants';
import UserUtils from '../utils/user_utils.js';
Function render
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
render() {
const modifiers = {
['outrange']: (day) => {
return !this.inrange(day);
},
- 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 AvailableArticles
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
const AvailableArticles = (props) => {
useEffect(() => {
const project = props.course.home_wiki.project;
document.title = `${props.course.title} - ${ArticleUtils.I18n('available', project)}`;
}, []);
Function render
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const dateProps = CourseDateUtils.dateProps(this.props.course);
const step1 = this.props.shouldShowSteps
? <h2><span>1.</span><small> Confirm the course’s start and end dates.</small></h2>
Function render
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const panelCount = this.props.panels.length;
const panels = this.props.panels.map((panel, i) => {
const active = this.props.activePanelIndex === i;
const stepNumber = i + 1;
Function Article
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
const Article = ({ article, index, course, fetchArticleDetails, updateArticleTrackedStatus, articleDetails, wikidataLabel,
showOnMount, setSelectedIndex, lastIndex, selectedIndex, pageLogsMessage, deletedMessage, current_user }) => {
const [tracked, setTracked] = useState(article.tracked);
const fetchMissingArticleDetails = () => {
- 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 EnrollButton
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
const EnrollButton = ({ users, role, course, current_user, allowed, inline }) => {
const usernameRef = useRef(null);
const realNameRef = useRef(null);
const roleDescriptionRef = useRef(null);
- 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 22 (exceeds 5 allowed). Consider refactoring. Open
render() {
const i18nPrefix = this.props.course.string_prefix;
let buttonClass = 'button dark';
buttonClass += this.state.isPersisting ? ' working' : '';
- 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 WikiSelect
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
const WikiSelect = ({ multi, onChange, styles, wikis, homeWiki, readOnly, label, id, options }) => {
// Function to generate URL for a wiki
const url = useCallback((wiki) => {
const subdomain = wiki.language || 'www';
return `${subdomain}.${wiki.project}.org`;
- 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 InputHOC
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
const InputHOC = (Component) => {
const validatingComponent = createReactClass({
displayName: `Input${Component.displayName}`,
// value passed is HOC's state value
Function onload
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.onload = () => {
const createCampaignButton = document.querySelector('.create-campaign-button');
const createModalWrapper = document.querySelector('.create-modal-wrapper');
const wizardPanel = document.querySelector('.wizard__panel');
File article_finder_language_mappings.js
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
export const PageAssessmentGrades = {
wikipedia: {
en: {
FA: {
class: 'fa',