DevelopingCoder/cs61a_hintr

View on GitHub

Showing 456 of 456 total issues

Nokogiri gem contains two upstream vulnerabilities in libxslt 1.1.29
Open

    nokogiri (1.6.8.1)
Severity: Critical
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2017-5029

Criticality: High

URL: https://github.com/sparklemotion/nokogiri/issues/1634

Solution: upgrade to >= 1.7.2

Nokogiri gem, via libxml, is affected by DoS vulnerabilities
Open

    nokogiri (1.6.8.1)
Severity: Minor
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2017-15412

URL: https://github.com/sparklemotion/nokogiri/issues/1714

Solution: upgrade to >= 1.8.2

XML Injection in Xerces Java affects Nokogiri
Open

    nokogiri (1.6.8.1)
Severity: Minor
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2022-23437

Criticality: Medium

URL: https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-xxx9-3xcr-gjj3

Solution: upgrade to >= 1.13.4

Nokogiri::XML::Schema trusts input by default, exposing risk of an XXE vulnerability
Open

    nokogiri (1.6.8.1)
Severity: Info
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2020-26247

Criticality: Low

URL: https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-vr8q-g5c7-m54m

Solution: upgrade to >= 1.11.0.rc4

Inefficient Regular Expression Complexity in Nokogiri
Open

    nokogiri (1.6.8.1)
Severity: Critical
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2022-24836

Criticality: High

URL: https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-crjr-9rc5-ghw8

Solution: upgrade to >= 1.13.4

Nokogiri gem, via libxml, is affected by DoS and RCE vulnerabilities
Open

    nokogiri (1.6.8.1)
Severity: Critical
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2017-9050

Criticality: High

URL: https://github.com/sparklemotion/nokogiri/issues/1673

Solution: upgrade to >= 1.8.1

Nokogiri gem, via libxslt, is affected by improper access control vulnerability
Open

    nokogiri (1.6.8.1)
Severity: Minor
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2019-11068

URL: https://github.com/sparklemotion/nokogiri/issues/1892

Solution: upgrade to >= 1.10.3

Method diff_db has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    def diff_db(qset_json)
        diffs = []
        qset_json.each do |qset_name, question_json|
            question_set = QuestionSet.find_by_name(qset_name)
            if not question_set
Severity: Minor
Found in features/support/seed_helper.rb - About 3 hrs 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 check_tags_exist has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def self.check_tags_exist(file_qsets)
        non_exist_tags = []
        file_qsets.keys.each do |qset_name|
            question_hash = file_qsets[qset_name]
            question_hash.each do |question_text, wrong_answer_list|
Severity: Minor
Found in app/models/question_set.rb - About 2 hrs 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 find_edits has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def find_edits(wrong_answer_list)
        db_display_list = {} # wrong answers shown (edited or deleted)
        upload_display_list = {} #wrong answers shown (edited or added)
        
        db_wrong_answer_list = self.wrong_answers
Severity: Minor
Found in app/models/question.rb - About 2 hrs 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

Cyclomatic complexity for diff_db is too high. [9/6]
Open

    def diff_db(qset_json)
        diffs = []
        qset_json.each do |qset_name, question_json|
            question_set = QuestionSet.find_by_name(qset_name)
            if not question_set
Severity: Minor
Found in features/support/seed_helper.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Cyclomatic complexity for path_to is too high. [9/6]
Open

  def path_to(page_name)
    case page_name

    when /^the home\s?page$/
      '/'
Severity: Minor
Found in features/support/paths.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Method has too many lines. [32/30]
Open

    def diff_db(qset_json)
        diffs = []
        qset_json.each do |qset_name, question_json|
            question_set = QuestionSet.find_by_name(qset_name)
            if not question_set
Severity: Minor
Found in features/support/seed_helper.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Cyclomatic complexity for import is too high. [7/6]
Open

    def self.import(csv_path)
        rows = CSV.read(csv_path)
        if not self.verify_first_line(rows[0])
            return false
        end
Severity: Minor
Found in app/models/tag.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Cyclomatic complexity for find_edits is too high. [7/6]
Open

    def find_edits(wrong_answer_list)
        db_display_list = {} # wrong answers shown (edited or deleted)
        upload_display_list = {} #wrong answers shown (edited or added)
        
        db_wrong_answer_list = self.wrong_answers
Severity: Minor
Found in app/models/question.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Method toggle_admin has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def toggle_admin(id, status)
    if id == self.id
      return "Cannot unadmin yourself"
    else
      other_user = User.find_by_id(id)
Severity: Minor
Found in app/models/user.rb - About 1 hr 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 diff_db has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def diff_db(qset_json)
        diffs = []
        qset_json.each do |qset_name, question_json|
            question_set = QuestionSet.find_by_name(qset_name)
            if not question_set
Severity: Minor
Found in features/support/seed_helper.rb - About 1 hr to fix

    Method import has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.import(csv_path)
            rows = CSV.read(csv_path)
            if not self.verify_first_line(rows[0])
                return false
            end
    Severity: Minor
    Found in app/models/tag.rb - About 1 hr 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 cross_check_diffs has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.cross_check_diffs(file_qsets)
            #Returns a hash of answers, edits, deletions. Answers and edits contains 
            #a message, which may be an empty string if we do not want to create a new message
            edits = {}
            additions = {}
    Severity: Minor
    Found in app/models/question_set.rb - About 1 hr 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 find_edits has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def find_edits(wrong_answer_list)
            db_display_list = {} # wrong answers shown (edited or deleted)
            upload_display_list = {} #wrong answers shown (edited or added)
            
            db_wrong_answer_list = self.wrong_answers
    Severity: Minor
    Found in app/models/question.rb - About 1 hr to fix
      Severity
      Category
      Status
      Source
      Language