saasbook/esaas-engagements

View on GitHub

Showing 71 of 71 total issues

Class has too many lines. [283/250]
Open

class MatchingController < ApplicationController
  # redirects students to their engagement's preference page
  # only if they are involved in a matching in progress
  skip_before_filter :check_student
  before_action :auth_matching, except: [:show, :store]

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

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

    def index
        user = current_user
        orgs = Org.for_user(user.id)
        deploy_vet_map(orgs)
        total_app = @total_deploy + @total_vet

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.

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

  def index
    deploy_vet_map
    total_app = @total_deploy + @total_vet
    @current_user = User.find_by_id(session[:user_id])
    page_default_and_update("app", total_app)
Severity: Minor
Found in app/controllers/apps_controller.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.

File matching_controller.rb has 284 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class MatchingController < ApplicationController
  # redirects students to their engagement's preference page
  # only if they are involved in a matching in progress
  skip_before_filter :check_student
  before_action :auth_matching, except: [:show, :store]
Severity: Minor
Found in app/controllers/matching_controller.rb - About 2 hrs to fix

    Method index has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

      def index
        deploy_vet_map
        total_app = @total_deploy + @total_vet
        @current_user = User.find_by_id(session[:user_id])
        page_default_and_update("app", total_app)
    Severity: Minor
    Found in app/controllers/apps_controller.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 index has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def index
            user = current_user
            orgs = Org.for_user(user.id)
            deploy_vet_map(orgs)
            total_app = @total_deploy + @total_vet
    Severity: Minor
    Found in app/controllers/my_projects_controller.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 index has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def index
            user = current_user
            orgs = Org.for_user(user.id)
            deploy_vet_map(orgs)
            total_app = @total_deploy + @total_vet
    Severity: Major
    Found in app/controllers/my_projects_controller.rb - About 2 hrs to fix

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

        def index
          deploy_vet_map
          total_app = @total_deploy + @total_vet
          @current_user = User.find_by_id(session[:user_id])
          page_default_and_update("app", total_app)
      Severity: Major
      Found in app/controllers/apps_controller.rb - About 2 hrs to fix

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

            def propose(team, team_preferences)
              team_preferences.each do |app|
                puts "Team preferences: " + team_preferences.to_s
                puts "Team " + team + " proposing to App " + app
                # Check if the app is currently matched
        Severity: Minor
        Found in app/models/matching.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.

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

          def create_engagement
            @matching = Matching.find(params[:matching_id])
            if @matching.status == 'Completed'
              redirect_to matching_progress_path(params[:matching_id]), alert: 'Matching is already completed.'
              return

        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.

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

          def create
            # check if student is already in an existing engagement
            # check if team_number is unique
            seen = []
            team_numbers = []

        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 index is too high. [9/6]
        Open

          def index
            deploy_vet_map
            total_app = @total_deploy + @total_vet
            @current_user = User.find_by_id(session[:user_id])
            page_default_and_update("app", total_app)
        Severity: Minor
        Found in app/controllers/apps_controller.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 index is too high. [9/6]
        Open

            def index
                user = current_user
                orgs = Org.for_user(user.id)
                deploy_vet_map(orgs)
                total_app = @total_deploy + @total_vet

        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 update_engagement is too high. [9/6]
        Open

          def update_engagement
            @matching = Matching.find(params[:matching_id])
            if @matching.status == 'Completed'
              redirect_to matching_progress_path(params[:matching_id]), alert: 'Matching is already completed.'
              return

        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 results is too high. [8/6]
        Open

          def results
            keyword = params["keyword"]
            @filters = session[:filters]
            @apps = []
            @orgs = []

        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 update_engagement
            @matching = Matching.find(params[:matching_id])
            if @matching.status == 'Completed'
              redirect_to matching_progress_path(params[:matching_id]), alert: 'Matching is already completed.'
              return

        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 create is too high. [7/6]
        Open

            def create
                redirect_to edit_my_project_edit_path(app_id: params[:app_id]) and return unless @app_edit_request.nil?
                @app_edit_request = AppEditRequest.new(
                    app_id:       params[:app_id],
                    description:  params[:description],

        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 create_engagement is too high. [7/6]
        Open

          def create_engagement
            @matching = Matching.find(params[:matching_id])
            if @matching.status == 'Completed'
              redirect_to matching_progress_path(params[:matching_id]), alert: 'Matching is already completed.'
              return

        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 update is too high. [7/6]
        Open

            def update
                redirect_to new_my_project_edit_path and return if @app_edit_request.nil?
                unless update_to_edit_made(@app_edit_request)
                    redirect_to edit_my_project_edit_path, alert: 'There were no updates to edits made.'
                    return

        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 update_engagement has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          def update_engagement
            @matching = Matching.find(params[:matching_id])
            if @matching.status == 'Completed'
              redirect_to matching_progress_path(params[:matching_id]), alert: 'Matching is already completed.'
              return
        Severity: Minor
        Found in app/controllers/matching_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