Showing 462 of 1,666 total issues
Method format_assignment_title
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.format_assignment_title(assignment, home_wiki)
# If a page is on the same wiki, no prefix is needed.
title = format_title(assignment.article_title)
return title if assignment.wiki_id == home_wiki.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
Function Affix
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const Affix = ({ className, offset = 0, children }) => {
const [affix, setAffix] = useState(false);
const affixRef = useRef(affix);
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 HamburgerMenu
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const HamburgerMenu = ({ rootUrl, logoPath, exploreUrl, exploreName, userSignedIn, ifAdmin, trainingUrl,
helpDisabled, wikiEd, languageSwitcherEnabled, currentUser, destroyUrl, omniauthUrl }) => {
const [isActive, setIsActive] = useState(false);
const toggleClass = () => {
- 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 initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(course)
return unless Features.wiki_ed?
@course = course
@salesforce_id = @course.flags[:salesforce_id]
return unless @salesforce_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 create_alerts
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_alerts
@courses.each do |course|
next unless high_average_productivity?(course)
next if Alert.exists?(course_id: course.id, type: 'ProductiveCourseAlert')
alert = Alert.create(type: 'ProductiveCourseAlert', course_id: course.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 build_talk_page_update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_talk_page_update
# If a course changed state so that it has no on-wiki course page, don't post.
return nil if @course_page.nil?
initial_page_content = WikiApi.new(@wiki).get_page_content(@talk_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
Method send_email
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def send_email
# In these environments only send emails to the users specified in ENV['survey_test_email']
return if nonsafe_email_environment?
return if email_sent_at.present?
return if user.email.nil?
- 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 Form
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const Form = (props) => {
const [state, setState] = useState({
started: false,
user: props.currentUser,
name: props.currentUser.real_name,
- 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_image_data_and_update_continue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_image_data_and_update_continue(response)
results = response.data['pages']
# Account for the different format returned when only a single, missing
# page is queried, which looks like: [{"pageid"=>0, "missing"=>""}]
results = results.values unless results.is_a?(Array)
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def create_alerts
@courses.each do |course|
next unless too_many_deleted_uploads?(course)
next if Alert.exists?(course_id: course.id, type: 'DeletedUploadsAlert')
alert = Alert.create(type: 'DeletedUploadsAlert', course_id: course.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 eligible?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def eligible?
# screen out courses that weren't persisted
return false unless @course.persisted?
# Only courses happening in --Fall 2024-- Spring 2025
return false unless @course.start > '2025-01-01'.to_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
Method create_alerts
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_alerts
@courses.each do |course|
next unless moderate_productivity?(course)
next if Alert.exists?(course_id: course.id, type: 'ActiveCourseAlert')
alert = Alert.create(type: 'ActiveCourseAlert',
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def create_alerts
@answers.each do |answer|
next unless answer_meets_alert_conditions?(answer)
next if alert_already_exists?(answer)
alert = Alert.create(type: 'SurveyResponseAlert',
- 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 SalesforceLink
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const SalesforceLink = ({
course,
current_user,
linkToSalesforce,
updateSalesforceRecord
- 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 build_assignment_page_content
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_assignment_page_content(new_tag, page_content)
page_content = page_content.dup.force_encoding('utf-8')
# Return if tag already exists on page.
# However, if the tag is empty, that means to blank the prior tag (if any).
if new_tag.present?
- 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 UpdateNews
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const UpdateNews = ({ saveEditedNews, newsId }) => {
const [updateNews, setUpdateNews] = useState(false); // State to manage the icon hover effect
// Retrieve the news item being currently edited from the Redux store based on the provided newsId
const editedNews = useSelector(state => state.news.news_content_list.find(news => news.id === newsId));
- 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 start_of_group?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def start_of_group?
return false unless grouped_question?
return true if @index.zero?
previous_answer = @answers_in_group[@index - 1]
- 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 pluralize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def pluralize(locale, entry, count)
return super unless entry.is_a?(Hash) and count
locale_rules = CLDR_LANGUAGE_PLURAL_RULES[locale]
return super unless locale_rules
key = locale_rules[:i18n][:plural][:rule].call(count)
- 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 assignment_status
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def assignment_status
return unless @training_module.training?
if due_date_manager.blocks_with_module_assigned(@training_module).any?
parenthetical = I18n.t('training_status.due', due_date: overall_due_date)
assingment_status = module_completed? ? I18n.t('training_status.completed') : parenthetical
- 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 add_libr_and_mod_slugs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add_libr_and_mod_slugs(slugs)
slugs.each do |slug|
trningmod = module_of_a_slide(slug[:slide])
next if trningmod.nil?
- 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"