Showing 1,672 of 1,672 total issues
Function nameHasChanged
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const nameHasChanged = () => (_dispatch, getState) => {
const { course, persistedCourse } = getState();
if (course.title !== persistedCourse.title) { return true; }
if (course.term !== persistedCourse.term) { return true; }
if (course.school !== persistedCourse.school) { return true; }
- 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 toDate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const toDate = (date, suppressError) => {
if (date instanceof Date) {
return date;
}
// should not really happen in production, but it's here for making the tests pass
- 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 createAdminCourseNote
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const createAdminCourseNote = (courseId, adminCourseNoteDetails) => async (dispatch) => {
if ((adminCourseNoteDetails.title.trim().length === 0) || (adminCourseNoteDetails.text.trim().length === 0)) {
return sendNotification(dispatch, 'Error', 'notes.empty_fields');
}
- 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 getList
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const getList = (assignments, currentUserId, ROLE) => {
return assignments.reduce((acc, { article_title, role, user_id, username }) => {
if (!user_id || role === ROLE || user_id === currentUserId) return acc;
if (acc[article_title]) {
acc[article_title].push(username);
- 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 getFiltered
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const getFiltered = (models, options) => {
const filteredModels = [];
for (let i = 0; i < models.length; i += 1) {
const model = models[i];
let add = true;
- 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 CourseNavbar
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const CourseNavbar = ({ course, location, currentUser, courseLink }) => {
// ///////////////
// Course title //
// ///////////////
let courseLinkElement;
- 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 isDayDisabled
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
isDayDisabled(currentDate) {
if (this.props.date_props) {
const minDate = startOfDay(this.props.date_props.minDate);
if (isValid(minDate) && isAfter(minDate, currentDate)) {
return true;
- 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 RandomPeerAssignButton
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const RandomPeerAssignButton = ({
randomPeerAssignments: assignRandomPeer,
initiateConfirm: confirmInitiate,
course,
current_user,
- 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 ActivityTableRow
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const ActivityTableRow = ({ isOpen, diffUrl, revisionDateTime,
revisionScore, reportUrl, revision, rowId, articleUrl, title, talkPageLink,
author }) => {
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 Resources
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const Resources = ({ weeks, current_user, course }) => {
// setting page title
useEffect(() => {
document.title = `${course.title} - ${I18n.t('resources.label')}`;
}, []);
- 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 NotesRow
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const NotesRow = ({ notesList }) => {
// State variables to keep track of the currently edited note and the note with expanded text
const [editNoteId, setEditNoteId] = useState(null);
const [showNoteTextId, setShowNoteTextId] = useState(null);
const [noteText, setNoteText] = 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
Method send_email
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.send_email(alert)
return unless Features.email?
return if alert.user.email.blank?
email(alert).deliver_now
alert.update(email_sent_at: Time.zone.now)
- 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 training_very_overdue?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def training_very_overdue?(course)
return false if course.user_count.zero?
completion_rate = course.trained_count.to_f / course.user_count
return false unless completion_rate < EXPECTED_COMPLETION_RATE
latest_training_assignment_date = dates_of_overdue_trainings(course).last
- 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 AllPeerReviewLinks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const AllPeerReviewLinks = ({ assignment, reviewAssignments }) => {
const title = <span key="title">Reviews: </span>;
const reviewLinks = assignment.reviewers.map((reviewer) => {
let linkClass = '';
let mouseoverText;
- 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 StatisticsUpdateInfo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const StatisticsUpdateInfo = ({ course }) => {
const [showModal, setShowModal] = useState(false);
const toggleModal = () => {
setShowModal(!showModal);
- 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 fetch_all_uploads
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fetch_all_uploads
@uploads = []
@continue = true
until @continue.nil?
response = api_get
- 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 StatisticsUpdateModal
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const StatisticsUpdateModal = (props) => {
const course = props.course;
const helpMessage = Features.wikiEd ? I18n.t('metrics.wiki_ed_help') : I18n.t('metrics.outreach_help');
const updatesEndMoment = toDate(course.update_until);
const futureUpdatesRemaining = isAfter(updatesEndMoment, new Date());
- 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 Permissions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const Permissions = ({ currentUser, returnToParam }) => {
const [isHovered, setIsHovered] = useState(false);
let slide;
- 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 import_articles_by_title
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def import_articles_by_title(titles)
# Slice size is limited by max URI length.
# 40 is too much for some languages, such as bn.wipedia.org
titles.each_slice(30) do |some_article_titles|
query = { prop: 'info', titles: some_article_titles }
- 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 parse_api_response
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_api_response
# {"edit"=>
# {"result"=>"Success",
# "pageid"=>11543696,
# "title"=>"User:Ragesock",
- 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"