Showing 1,205 of 1,252 total issues
Method create_new_submission
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def create_new_submission(new_submission, current_user)
success = false
if randomization == 'prepared'
Course::Assessment::Submission.transaction do
qbas = question_bundle_assignments.where(user: current_user).lock!
- 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 post_replied
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def post_replied(user, course_user, post)
course = post.topic.course
email_enabled = course.email_enabled(:forums, :post_replied)
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 hash_compre_lifted_word
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def hash_compre_lifted_word(question)
hash = {}
question.groups.each do |group|
group.points.each do |point|
# for all TextResponseComprehensionSolution where solution_type == compre_lifted_word
- 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 define_attachment_references_readers
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.define_attachment_references_readers(attachable_columns)
attachable_columns.each do |column|
email_method_name = "#{column}#{FOR_EMAIL_SUFFIX}"
unless method_defined?(email_method_name)
- 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 buildCrumbsData
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const buildCrumbsData = (
matches: Match[],
location: Location,
state: CrumbState,
): CrumbsDataBuilderResult => {
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def create
result = @submission_question.class.transaction do
@post.title = @assessment.title
# Set parent as the topologically last pre-existing post, if it exists.
@post.parent = last_post_from(@submission_question) if @submission_question.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 hash_compre_keyword
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def hash_compre_keyword(question)
hash = {}
question.groups.each do |group|
group.points.each do |point|
# for all TextResponseComprehensionSolution where solution_type == compre_keyword
- 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 InlineEditTextField
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const InlineEditTextField: FC<Props> = (props): JSX.Element | null => {
const {
updateValue,
value,
disabled,
- 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 ForumTopicShow
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const ForumTopicShow: FC = () => {
const { t } = useTranslation();
const { forumId, topicId } = useParams();
// Need to get the topic Id number below as sometimes, the topicId in the URL is in the form of slug.
// The topic id number is required to to select the entity from the redux store.
- 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 StudentMarksPerQuestionTable
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const StudentMarksPerQuestionTable: FC<Props> = (props) => {
const { t } = useTranslation();
const { courseId, assessmentId } = useParams();
const { includePhantom } = 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 deleteProgrammingFile
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function deleteProgrammingFile(answer, fileId, onDeleteSuccess) {
const answerId = answer.id;
const payload = {
answer: { id: answerId, file_id: fileId },
};
- Create a ticketCreate a ticket
Function Editor
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Editor = (props) => {
const {
file,
fieldName,
language,
- Create a ticketCreate a ticket
Function render
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { assessment, isActive } = this.props;
const tableHeaderColumnFor = (field) => (
<TableCell style={styles.tableCell}>
- Create a ticketCreate a ticket
Method correctness_hash
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def correctness_hash
query = CourseUser.find_by_sql(<<-SQL.squish
SELECT
id,
AVG(correctness) AS correctness
- Create a ticketCreate a ticket
Function LevelCondition
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
const LevelCondition = (
props: AnyConditionProps<LevelConditionData>,
): JSX.Element => {
const { control, handleSubmit, setError, formState } = useForm({
defaultValues: props.condition ?? { minimumLevel: 1 },
- Create a ticketCreate a ticket
Function Page
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Page = (props: PageProps): JSX.Element => {
const { backTo: route } = props;
const navigate = useNavigate();
- Create a ticketCreate a ticket
Function reducer
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
(draft: AchievementsState, action: AchievementsActionType) => {
switch (action.type) {
case SAVE_ACHIEVEMENT_LIST: {
const achievementList = action.achievementList;
const entityList = achievementList.map((data) => ({
- Create a ticketCreate a ticket
Function reducer
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
(draft: LeaderboardState, action: LeaderboardActionType) => {
switch (action.type) {
case SAVE_LEADERBOARD_POINTS: {
const leaderboardPointsList = action.leaderboardByExpPoints;
saveListToStore(draft.leaderboardPoints, leaderboardPointsList);
- Create a ticketCreate a ticket
Function subscribe
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
const subscribe = (
url: string,
sessionId: number,
courseId: number,
callbacks: HeartbeatChannelCallbacks,
- Create a ticketCreate a ticket
Function TimelinesStack
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
const TimelinesStack = (props: TimeBarsProps): JSX.Element => {
const { for: items, within: timelines } = props;
const gamified = useAppSelector((state) => state.timelines.gamified);
const defaultTimelineId = useAppSelector(
(state) => state.timelines.defaultTimeline,
- Create a ticketCreate a ticket