integrallis/blogdiggity

View on GitHub

Showing 3 of 3 total issues

Method webhook has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def webhook
      @repository = Repository.find_by_name(params[:repo_name])
      push = Hashie::Mash.new(params)
      push.commits.each do |commit|
        # processing added files - create new pages
Severity: Minor
Found in app/controllers/blogdiggity/contributors_controller.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 show has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def show
      @page = Page.find_by_slug(params[:page])
      expires_in(5.minutes, public: true) unless Rails.env == "development"
      if @page 
        if stale?(:etag => @page, :last_modified => @page.updated_at, :public => true)
Severity: Minor
Found in app/controllers/blogdiggity/pages_controller.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 show_by_year_and_month has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def show_by_year_and_month
      pages = (params[:year] && params[:month]) ? Page.by_year_and_month(params[:year].to_i, params[:month].to_i) : []
      @page = pages.find_by_slug(params[:page])
      expires_in(5.minutes, public: true) unless Rails.env == "development"
      if @page && stale?(:etag => @page, :last_modified => @page.updated_at, :public => true)
Severity: Minor
Found in app/controllers/blogdiggity/pages_controller.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

Severity
Category
Status
Source
Language