Showing 1,672 of 1,672 total issues
Function CampaignOresPlot
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const CampaignOresPlot = (props) => {
const [show, setShow] = useState(false);
const [loading, setLoading] = useState(true);
const [filePath, setFilePath] = useState(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
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
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 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
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 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_for_active_courses
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_alerts_for_active_courses
@courses.each do |course|
next unless nontrivial_mainspace_activity?(course)
next if Alert.exists?(course_id: course.id, type: 'SandboxedCourseMainspaceAlert')
alert = Alert.create(type: 'SandboxedCourseMainspaceAlert',
- 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 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
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
Function TagEditable
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const TagEditable = ({ course_id }) => {
const availableTags = useSelector(state => getAvailableTags(state));
const tags = useSelector(state => state.tags.tags);
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 TicketsHandler
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const TicketsHandler = () => {
const [page, setPage] = useState(0);
const [mode, setMode] = useState('filter');
const [searchQuery, setSearchQuery] = useState({ by_email_or_username: '', in_subject: '', in_content: '', by_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_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
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
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 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
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
Method validate_date_attribute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_date_attribute(date_type)
value = send("#{date_type}_before_type_cast")
self[date_type] = value.is_a?(Date) || value.is_a?(Time) ? value : Time.zone.parse(value)
if self[date_type].nil?
errors.add(date_type, I18n.t('error.invalid_date', key: date_type.capitalize))
- 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"