Showing 462 of 1,666 total issues
Function CourseScoping
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const CourseScoping = ({ show, wizardController, showCourseDates }) => {
const selectedScopingMethods = useSelector(state => state.scopingMethods.selected);
const scopingMethods = [
'index',
...selectedScopingMethods
- 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 NewAccountModal
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const NewAccountModal = ({ course, passcode, currentUser, closeModal, newAccount, actions }) => {
const checkAvailability = () => (actions.checkAvailability(newAccount));
const createRequestedAccountImmediately = currentUser.isInstructor;
const requestAccount = () => {
actions.requestAccount(passcode, course, newAccount, createRequestedAccountImmediately);
- 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
Avoid deeply nested control flow statements. Open
if (moveUp) {
const toWeekBlocks = this.getBlocksInWeek(toWeek.id);
atIndex = toWeekBlocks.length;
}
Function InstructorStats
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const InstructorStats = ({ username, stats, maxProject, statsGraphsData, graphWidth, graphHeight, isStudent }) => {
const [selectedGraph, setSelectedGraph] = useState('courses_count');
const [coursesGraph, setCoursesGraph] = useState(true);
const setCoursesCountGraph = () => {
- 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 SyllabusUpload
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const SyllabusUpload = ({ course }) => {
const [isUploadingSyllabus, setIsUploadingSyllabus] = useState(false);
const dispatch = useDispatch();
const onDrop = (files) => {
- 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 Reply
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const Reply = ({ message }) => {
const { sender, details } = message;
let delivered_message;
let failed_message;
if (details.delivered) {
- 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 Sidebar
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const Sidebar = ({ createdAt, currentUser, ticket }) => {
const dispatch = useDispatch();
const navigate = useNavigate();
const notifyOwner = () => {
- 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 TrainingModuleHandler
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const TrainingModuleHandler = (props) => {
useEffect(() => {
const moduleId = document.getElementById('react_root').getAttribute('data-module-id');
props.fetchTrainingModule({ module_id: moduleId });
}, []);
- 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 calculate_week_meeting_dates
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def calculate_week_meeting_dates
meetings = []
@timeline_week_count.times do |wk|
week_start = @beginning_of_first_week + wk.weeks
# This excludes Sunday, putting the end of the week at Saturday.
- 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 Quiz
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const Quiz = (props) => {
const [selectedAnswerId, setSelectedAnswerId] = useState(null);
const setAnswer = (e) => {
return setSelectedAnswerId(e.currentTarget.getAttribute('data-answer-id'));
- 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 perform
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def perform
Course.current.each do |course|
next unless course.flags[:salesforce_id]
next unless course.approved?
PushCourseToSalesforce.new(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 set_articles_edited
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_articles_edited
@articles_edited = {}
individual_courses.each do |course|
individual_mainspace_edits(course).each do |edit|
article_edits = @articles_edited[edit.article_id] || { new_article: 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 YesNoSelector
has a Cognitive Complexity of 8 (exceeds 5 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) => {
- 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 getSlideInfo
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const getSlideInfo = (training, locale) => {
let slideTitle;
let assessment;
let rawHtml;
if (training.currentSlide.translations && training.currentSlide.translations[locale]) {
- 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 SlideMenu
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const SlideMenu = (props) => {
useEffect(() => {
window.addEventListener('click', props.closeMenu, false);
return () => {
- 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 index
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def index # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
@query = params[:search] if params[:search].present?
@topic_slug = params[:topic] || DEFAULT_TOPIC unless @query || params[:all]
@faqs = if @query
log_to_sentry
- 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 Footer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const Footer = ({
article, colors, failureMessage, showArticleFinder, highlightedHtml, isWhocolorLang,
whoColorFailed, users, unhighlightedContributors, revisionId, toggleRevisionHandler, pendingRequest
}) => {
// Determine the Article Viewer Legend status based on what information
- 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 find_recent_plagiarism
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.find_recent_plagiarism
suspected_diffs = api_get('suspected_diffs')
suspected_diffs.each do |rev|
wiki = Wiki.find_by(language: rev['lang'], project: rev['project'])
next unless 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
Consider simplifying this complex logical expression. Open
if platform.platform().lower().find('ubuntu') != -1 \
or platform.platform().lower().find('wsl2') != -1 \
or platform.platform().lower().find('debian') != -1 \
or platform.platform().lower().find('elementary') != -1 \
or platform.uname().version.lower().find('ubuntu') != -1:
Consider simplifying this complex logical expression. Open
if (this.state.value === nextState.value
&& this.state.id === nextState.id
&& this.state.invalid === nextState.invalid
&& this.props.editable === nextProps.editable
&& nextProps.rerenderHoc !== true