WikiEducationFoundation/WikiEduDashboard

View on GitHub

Showing 453 of 1,605 total issues

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

  isDayDisabled(currentDate) {
    if (this.props.date_props) {
      const minDate = startOfDay(this.props.date_props.minDate);
      if (isValid(minDate) && isAfter(minDate, currentDate)) {
        return true;
Severity: Minor
Found in app/assets/javascripts/components/common/date_picker.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 RandomPeerAssignButton has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const RandomPeerAssignButton = ({
  randomPeerAssignments: assignRandomPeer,
  initiateConfirm: confirmInitiate,
  course,
  current_user,

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

  def parse_api_response
    # {"edit"=>
    #   {"result"=>"Success",
    #    "pageid"=>11543696,
    #    "title"=>"User:Ragesock",
Severity: Minor
Found in lib/wiki_response.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 training_very_overdue? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def training_very_overdue?(course)
    return false if course.user_count.zero?
    completion_rate = course.trained_count.to_f / course.user_count
    return false unless completion_rate < EXPECTED_COMPLETION_RATE
    latest_training_assignment_date = dates_of_overdue_trainings(course).last
Severity: Minor
Found in lib/alerts/untrained_students_alert_manager.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 all_transcluded_pages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def all_transcluded_pages
    wiki_api = WikiApi.new(@wiki)
    @query = transclusion_query
    @transcluded_in = []
    until @continue == 'done'
Severity: Minor
Found in lib/importers/transclusion_importer.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 StatisticsUpdateInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const StatisticsUpdateInfo = ({ course }) => {
  const [showModal, setShowModal] = useState(false);

  const toggleModal = () => {
    setShowModal(!showModal);
Severity: Minor
Found in app/assets/javascripts/components/overview/statistics_update_info.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 import_articles_by_title has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def import_articles_by_title(titles)
    # Slice size is limited by max URI length.
    # 40 is too much for some languages, such as bn.wipedia.org
    titles.each_slice(30) do |some_article_titles|
      query = { prop: 'info', titles: some_article_titles }
Severity: Minor
Found in lib/importers/article_importer.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 AllPeerReviewLinks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const AllPeerReviewLinks = ({ assignment, reviewAssignments }) => {
  const title = <span key="title">Reviews: </span>;
  const reviewLinks = assignment.reviewers.map((reviewer) => {
    let linkClass = '';
    let mouseoverText;

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

const StatisticsUpdateModal = (props) => {
  const course = props.course;
  const helpMessage = Features.wikiEd ? I18n.t('metrics.wiki_ed_help') : I18n.t('metrics.outreach_help');
  const updatesEndMoment = toDate(course.update_until);
  const futureUpdatesRemaining = isAfter(updatesEndMoment, new Date());
Severity: Minor
Found in app/assets/javascripts/components/overview/statistics_update_modal.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 import_articles_from_title_query has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def import_articles_from_title_query(results)
    articles = []
    results.each_value do |page_data|
      next if page_data['missing']
      next if page_data['invalid']
Severity: Minor
Found in lib/importers/article_importer.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 Permissions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const Permissions = ({ currentUser, returnToParam }) => {
  const [isHovered, setIsHovered] = useState(false);

  let slide;

Severity: Minor
Found in app/assets/javascripts/components/onboarding/permissions.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 send_email has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.send_email(alert)
    return unless Features.email?
    return if alert.user.email.blank?
    email(alert).deliver_now
    alert.update(email_sent_at: Time.zone.now)
Severity: Minor
Found in app/mailers/overdue_training_alert_mailer.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 fetch_all_uploads has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def fetch_all_uploads
    @uploads = []
    @continue = true
    until @continue.nil?
      response = api_get
Severity: Minor
Found in lib/commons.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