clarkfyr/Calumni

View on GitHub

Showing 5 of 5 total issues

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

  def update_profile
    if people_params[:avatar]
      if people_params[:avatar].size >5.megabytes
        redirect_to edit_error_path and return
      end
Severity: Minor
Found in app/controllers/calumnis_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_account has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def create_account
    # use oauth login first

    # check user exists or not
    p "people, ",@people
Severity: Minor
Found in app/controllers/calumnis_controller.rb - About 45 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

Avoid too many return statements within this method.
Open

    redirect_to profile_path and return
Severity: Major
Found in app/controllers/calumnis_controller.rb - About 30 mins to fix

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

      def signed_in
        # p "filter is called every controller",myEmail
        p "myEmail ",myEmail
        if (not myEmail) || myEmail==""
          # if direct access this url, goto root_path after login
    Severity: Minor
    Found in app/controllers/application_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 showprofile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def showprofile
        @people= People.select{|p| p.email==cookies[:email]}
        @otheruser= People.select{|p| p.url==params[:url]}
        # if otheruser not exist
        if @otheruser.first.nil? or @otheruser.first.role=="mentee"
    Severity: Minor
    Found in app/controllers/calumnis_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