Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

Function handleSessionChangeState has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function handleSessionChangeState(state, action) {
  let stateChange = null;
  if (state.playerState === action.playerState) {
    return state;
  }
Severity: Minor
Found in client/app/bundles/course/video/submission/reducers/video.js - About 25 mins to fix

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 getUrlParameter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function getUrlParameter(sParam) {
  const sPageURL = decodeURIComponent(window.location.search.substring(1));
  const sURLVariables = sPageURL.split('&');
  let sParameterName;

Severity: Minor
Found in client/app/lib/helpers/url-helpers.js - About 25 mins to fix

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 processSubmission has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const processSubmission = (submission) => {
  const totalGrade =
    submission.totalGrade != null ? parseFloat(submission.totalGrade) : null;
  const answers =
    submission.answers != null ? submission.answers.map(processAnswer) : null;
Severity: Minor
Found in client/app/bundles/course/assessment/utils/statisticsUtils.js - About 25 mins to fix

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 FormSelectField has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const FormSelectField = (props) => {
  const {
    field,
    fieldState,
    disabled,
Severity: Minor
Found in client/app/lib/components/form/fields/SelectField.jsx - About 25 mins to fix

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 GroupTableCard has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const GroupTableCard = ({ group, onManageGroup, canManageCategory }) => {
  const [hidePhantomStudents, setHidePhantomStudents] = useState(true);

  const allMembers = [...group.members];
  allMembers.sort(sortByName).sort(sortByPhantom).sort(sortByGroupRole);
Severity: Minor
Found in client/app/bundles/course/group/pages/GroupShow/GroupTableCard.jsx - About 25 mins to fix

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 renderOptionRow has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  static renderOptionRow(breakdown, hasImage, option, index, anonymous) {
    const percentage = (100 * breakdown[option.id].count) / breakdown.length;
    const {
      id,
      option: optionText,

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 GroupCard has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const GroupCard = ({
  title,
  subtitle,
  titleButtons = [],
  bottomButtons = [],
Severity: Minor
Found in client/app/bundles/course/group/components/GroupCard.jsx - About 25 mins to fix

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 withSurveyLayout has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const withSurveyLayout = (Component) => {
  const WrappedComponent = ({ surveys }) => {
    const params = useParams();
    const surveyId = params.surveyId;
    const courseId = params.courseId;
Severity: Minor
Found in client/app/bundles/course/survey/containers/SurveyLayout/index.jsx - About 25 mins to fix

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 getRespondentsCount has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  getRespondentsCount() {
    const { sections } = this.props;
    if (
      (sections && sections.length) < 1 ||
      (sections[0].questions && sections[0].questions.length < 1) ||
Severity: Minor
Found in client/app/bundles/course/survey/pages/SurveyResults/index.jsx - About 25 mins to fix

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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const {
      type,
      title,
      startAt,

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_with_codes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.create_with_codes(assessment_id, question_id, user, feedback_id, files)
    live_feedback = new(
      assessment_id: assessment_id,
      question_id: question_id,
      creator: user,
Severity: Minor
Found in app/models/course/assessment/live_feedback.rb - About 25 mins to fix

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 order_by_average_marking_time has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.order_by_average_marking_time(staff)
      staff.sort do |x, y|
        if x.average_marking_time && y.average_marking_time
          x.average_marking_time <=> y.average_marking_time
        else
Severity: Minor
Found in app/models/concerns/course_user/staff_concern.rb - About 25 mins to fix

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 renderColorBar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  renderColorBar() {
    const { activeObject, disabled, colorBarBorder, colorBarBackground } =
      this.props;

    let backgroundColor = colorBarBackground;

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 toggle_answer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def toggle_answer
    self.class.transaction do
      raise ActiveRecord::Rollback unless update_column(:answer, !answer)
      raise ActiveRecord::Rollback unless topic.specific.update_resolve_status
    end
Severity: Minor
Found in app/models/course/discussion/post.rb - About 25 mins to fix

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 convert_host_to_redirect_uri has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def convert_host_to_redirect_uri(host)
    default_host = (ENV['RAILS_ENV'] == 'development') ? 'localhost:8080' : ENV.fetch('RAILS_HOSTNAME', nil)

    host = if host == '*'
             default_host
Severity: Minor
Found in app/models/instance.rb - About 25 mins to fix

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_permissions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def define_permissions
    if course_user && !user.administrator?
      define_all_survey_permissions
      define_staff_survey_permissions if course_user.staff?
      define_teaching_staff_survey_permissions if course_user.teaching_staff?
Severity: Minor
Found in app/models/components/course/surveys_ability_component.rb - About 25 mins to fix

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 Statistics has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const Statistics = ({ watchFrequency, sessions }) => {
  const { t } = useTranslation();

  const [tabValue, setTabValue] = useState(1);

Severity: Minor
Found in client/app/bundles/course/video/submission/containers/Statistics.jsx - About 25 mins to fix

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 generate_live_feedback has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def generate_live_feedback
    question = self.question.actable
    assessment = submission.assessment

    should_retrieve_feedback = submission.attempting? &&
Severity: Minor
Found in app/models/course/assessment/answer/programming.rb - About 25 mins to fix

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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const {
      creator: { name, imageUrl },
      createdAt,
      canUpdate,

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 graded_test_case_types has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def graded_test_case_types
    [].tap do |result|
      result.push('public_test') if use_public
      result.push('private_test') if use_private
      result.push('evaluation_test') if use_evaluation
Severity: Minor
Found in app/models/course/assessment.rb - About 25 mins to fix

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

Severity
Category
Status
Source
Language