Showing 1,205 of 1,252 total issues
Method validate_required_answer
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate_required_answer
return unless response.just_submitted? && question.required?
case question.question_type
when 'text'
- Read upRead up
- Create a ticketCreate a ticket
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 assessment_submitted
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def assessment_submitted(user, course_user, submission)
email_enabled = submission.assessment.
course.email_enabled(:assessments, :new_submission, submission.assessment.tab.category.id)
return unless email_enabled.regular || email_enabled.phantom
- Read upRead up
- Create a ticketCreate a ticket
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
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create
result = @post.transaction do
# Set parent as the topologically last pre-existing post, if it exists.
# @post is in @topic.posts, so we filter out @post, which has no id yet.
@post.parent = @topic.posts.ordered_topologically.flatten.select(&:id).last if @topic.posts.length > 1
- Read upRead up
- Create a ticketCreate a ticket
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 invite
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def invite(users)
new_invitations = nil
existing_invitations = nil
new_instance_users = nil
existing_instance_users = nil
- Read upRead up
- Create a ticketCreate a ticket
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 invite
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def invite(users)
new_invitations = nil
existing_invitations = nil
new_course_users = nil
existing_course_users = nil
- Read upRead up
- Create a ticketCreate a ticket
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 user_enrol_requested_email
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def user_enrol_requested_email(enrol_request)
ActsAsTenant.without_tenant do
@course = enrol_request.course
end
email_enabled = @course.email_enabled(:users, :new_enrol_request)
- Read upRead up
- Create a ticketCreate a ticket
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
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create # rubocop:disable Metrics/MethodLength
if file_is_pdf?
respond_to do |format|
if pdf_import_service.save
format.json { render_success_json t('.success') }
- Read upRead up
- Create a ticketCreate a ticket
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 delete_all_future_stories_personal_times
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def delete_all_future_stories_personal_times(course_user)
future_story_ids = stories_for(course_user).filter_map do |story|
story.id if story.personal_time_for(course_user) && story.submitted_at.blank?
end
- Read upRead up
- Create a ticketCreate a ticket
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 saveActiveData
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
saveActiveData: (
state,
action: PayloadAction<{
conversationId: string;
snapshotId: string;
- Read upRead up
- Create a ticketCreate a ticket
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 TextField
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
(props, ref): JSX.Element => {
const { trims, onPressEnter, onPressEscape, ...textFieldProps } = props;
const handleChange: ChangeEventHandler<HTMLInputElement> = (e): void => {
if (trims) {
- Read upRead up
- Create a ticketCreate a ticket
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 AssessmentCategoriesManager
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const AssessmentCategoriesManager = (props: Props): JSX.Element => {
const { categories } = props;
const { t } = useTranslation();
const { createCategory, settings } = useAssessmentSettings();
- Read upRead up
- Create a ticketCreate a ticket
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 TextResponseForm
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const TextResponseForm = <T extends 'new' | 'edit'>(
props: TextResponseFormProps<T>,
): JSX.Element => {
const { with: data } = props;
- Read upRead up
- Create a ticketCreate a ticket
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 Breadcrumbs
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const Breadcrumbs = (props: BreadcrumbProps): JSX.Element => {
const { in: crumbs } = props;
const { t } = useTranslation();
- Read upRead up
- Create a ticketCreate a ticket
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 ActivityCenter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const ActivityCenter = (props: ActivityCenterProps): JSX.Element => {
const { t } = useTranslation();
const history = useAppSelector(select('history'));
const monitoring = useMonitoring();
- Read upRead up
- Create a ticketCreate a ticket
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 UsersIndex
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const UsersIndex: FC<Props> = (props) => {
const { intl } = props;
const [isLoading, setIsLoading] = useState(false);
const [filter, setFilter] = useState({ active: false, role: '' });
const userCounts = useAppSelector(getAdminCounts);
- Read upRead up
- Create a ticketCreate a ticket
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 ForgotPasswordPage
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const ForgotPasswordPage = (): JSX.Element => {
const { t } = useTranslation();
const [email, setEmail] = useEmailFromAuthPagesContext();
- Read upRead up
- Create a ticketCreate a ticket
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 ResendConfirmationEmailPage
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const ResendConfirmationEmailPage = (): JSX.Element => {
const { t } = useTranslation();
const [email, setEmail] = useEmailFromAuthPagesContext();
- Read upRead up
- Create a ticketCreate a ticket
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 saveAllGrades
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function saveAllGrades(submissionId, grades, exp, published) {
const expParam = published ? 'points_awarded' : 'draft_points_awarded';
const modifiedGrades = grades.map((grade) => ({
id: grade.id,
grade: grade.grade,
- Create a ticketCreate a ticket
Function fetchSubmission
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function fetchSubmission(id, onGetMonitoringSessionId) {
return (dispatch) => {
dispatch({ type: actionTypes.FETCH_SUBMISSION_REQUEST });
return CourseAPI.assessment.submissions
- Create a ticketCreate a ticket
Function FormToggleField
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const FormToggleField = (props) => {
const { field, fieldState, disabled, label, renderIf, ...custom } = props;
const isError = !!fieldState.error;
if (!renderIf) {
return null;
- Create a ticketCreate a ticket