SwordElucidator/American-parliamentary-debate-society

View on GitHub

Showing 6 of 88 total issues

Method index has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def index
    # Stores the saved updates
    content = Content.last
    @content = content
    data = params[:content]
Severity: Major
Found in app/controllers/home_controller.rb - About 2 hrs to fix

    Method registerdebate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def registerdebate
            if params[:value]  and params[:id] and params[:debateid]
                slotid = params[:id]
                @slotid = params[:id]
                @debateid = params[:debateid]
    Severity: Minor
    Found in app/controllers/debate_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 profile has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def profile
            data = params[:user]
            @user_to_see = current_user
            if not data
                render 'profile'
    Severity: Minor
    Found in app/controllers/profile_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 create has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def create
            if params[:topic] and params[:location] and params[:time]
                newdebate = Debate.create(:location => params[:location], :time => params[:time], :topic => params[:topic])
                if newdebate.save
                    ["government", "opposition", "judge"].each do |create|
    Severity: Minor
    Found in app/controllers/debate_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 index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def index
          if params[:email]
              emails = params[:email].strip()
              message = email_format_check(emails)
              if message != ""
    Severity: Minor
    Found in app/controllers/invitation_controller.rb - About 35 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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def update
            if params[:delete]
                debate = Debate.find_by_id(params[:id])
                Slot.delete(debate.slots)
                Debate.delete(params[:id])
    Severity: Minor
    Found in app/controllers/debate_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