Showing 462 of 1,666 total issues
Function render
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
render() {
let description;
if (this.props.source === 'pileid') {
description = (
<p>
- 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 set_revisions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_revisions
@new_revisions = {}
@course.revisions.includes(:wiki, :article, :user).map do |edit|
# Skip if the Article record is missing
next unless edit.article
- 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 AssignCell
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const AssignCell = (props) => {
const {
assignments, course, current_user,
editable, isStudentsPage, prefix, student
} = props;
- 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 ThisWeek
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const ThisWeek = ({ course, weeks, current_user }) => {
let weekIndex;
let thisWeekMeetings;
let weekMeetings;
let week;
- 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 MyArticlesContainer
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const MyArticlesContainer = ({ current_user }) => {
const dispatch = useDispatch();
const assignments = useSelector(state => state.assignments.assignments);
const course = useSelector(state => state.course);
- 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_assignment
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create_assignment
set_clean_title
set_article_from_database
check_wiki_edu_discouraged_article
import_article_from_wiki unless @article
- 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 answer_meets_alert_conditions?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def answer_meets_alert_conditions?(answer)
conditions = answer.question.alert_conditions
if conditions[:equals]
return true if answer.answer_text == conditions[:equals]
- 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 option
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
option: (styles, { isDisabled, isFocused, isSelected }) => {
let backgroundColor;
let color;
if (isDisabled) {
backgroundColor = 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 getWikiMap
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const getWikiMap = (revisions) => {
const wikiMap = new Map();
for (const revision of revisions) {
if (supportsPageAssessments(revision.wiki) || isSupportedORESWiki(revision.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 updateCourseDates
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
updateCourseDates(prevCourse, valueKey, value) {
const updatedCourse = Object.assign({}, prevCourse); // clone the course
updatedCourse[valueKey] = value;
// Just return with the new value if it doesn't pass validation
// or if it it lacks timeline dates
- 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 range
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function* range(left, right, inclusive) {
const ascending = left < right;
let endOfRange;
if (!inclusive) {
- 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 claimAssignment
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const claimAssignment = (assignment, successNotification) => (dispatch) => {
return claimAssignmentPromise(assignment)
.then((resp) => {
if (resp.assignment) {
if (successNotification) { dispatch(addNotification(successNotification)); }
- 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 searchForPages
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
async searchForPages(wiki, search_term, namespace, map=(el)=>el, depth, limit=10){
Function createNewsContent
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const createNewsContent = (newsContent, post = false) => async (dispatch, getState) => {
if (post) {
try {
// If `post` is true, create news on the server
const newsDetails = await API.createNews(getState().news.create_news);
- 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 a Cognitive Complexity of 8 (exceeds 5 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 });
- 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 option
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
option: (styles, { isDisabled, isFocused, isSelected }) => {
let backgroundColor;
let color;
if (isDisabled) {
backgroundColor = 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 NamespaceSelect
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const NamespaceSelect = (props) => {
const [selectedNamespaces, setSelectedNamespaces] = useState([]);
const [options, setOptions] = useState([]);
useEffect(() => {
- 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 Revision
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const Revision = ({ revision, index, wikidataLabel, course, setSelectedIndex, lastIndex, selectedIndex }) => {
const ratingClass = `rating ${revision.rating}`;
const ratingMobileClass = `${ratingClass} tablet-only`;
const formattedTitle = CourseUtils.formattedArticleTitle({ title: revision.title, project: revision.wiki.project, language: revision.wiki.language }, course.home_wiki, wikidataLabel);
const subtitle = wikidataLabel ? `(${CourseUtils.removeNamespace(revision.title)})` : '';
- 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 selectDay
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
selectDay(day) {
let exceptions;
if (!this.inrange(day)) { return; }
const { course } = this.props;
if (course.day_exceptions === undefined) {
- 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 CourseForm
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const CourseForm = (props) => {
const handleWikiChange = (wiki) => {
const home_wiki = wiki.value;
const prev_wiki = { ...props.course.home_wiki };
const wikis = CourseUtils.normalizeWikis(
- 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"