valleyjo/orgman

View on GitHub

Showing 5 of 7 total issues

Function rollCallInit has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var rollCallInit = function() {
  var index = 0;
  var options = $("#event_attendances_user_ids option");
  var selectTag = $("#event_attendances_user_ids");
  var selections = [];
Severity: Minor
Found in app/assets/javascripts/attendace/events.js - About 1 hr to fix

    Function rollCallInit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    var rollCallInit = function() {
      var index = 0;
      var options = $("#event_attendances_user_ids option");
      var selectTag = $("#event_attendances_user_ids");
      var selections = [];
    Severity: Minor
    Found in app/assets/javascripts/attendace/events.js - 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

    Method format_self_submit_attendance has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def format_self_submit_attendance(user)
        if object.self_submit_attendance
          attendance = Attendance.where(user_id: user.id, event_id: object.id)
          if attendance.count > 0
            if attendance.first.present == true
    Severity: Minor
    Found in app/decorators/event_decorator.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

    Method process_excuse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def process_excuse
        accepted = params[:accepted] == 'true' ? true : false
        attendance = Attendance.find(params[:id])
    
        if attendance.update(excused: accepted)
    Severity: Minor
    Found in app/controllers/attendance/excuses_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 default_position? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def default_position?
        is_default_position = false
        default_exec = [User::SECRETARY, User::PRESIDENT, User::TREASURER]
        default_event_type_admin = [1]
    
    
    Severity: Minor
    Found in app/models/position.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