phateio/kiris

View on GitHub

Showing 43 of 43 total issues

Method update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    set_site_title(I18n.t('admin.notices.notification_management'))

    ids = request.POST[:id].to_a
    datelines = request.POST[:dateline].to_a
Severity: Minor
Found in app/controllers/admin/notices_controller.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 get_niconico_thumb_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_niconico_thumb_info(video_id)
    res_body = http_get_response_body("http://ext.nicovideo.jp/api/getthumbinfo/#{video_id}") rescue nil
    return false if res_body.nil?
    thumb_info_doc = Nokogiri::XML(res_body)
    thumb_element = thumb_info_doc.xpath('/nicovideo_thumb_response/thumb')
Severity: Minor
Found in app/controllers/upload/niconico_controller.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 index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def index
    set_site_title(I18n.t('members.login'))

    referer = request.headers['X-XHR-Referer']
    render file: 'public/403.html', status: :forbidden, layout: false and return if referer.nil?
Severity: Minor
Found in app/controllers/members_controller.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