YaleSTC/cardswipr

View on GitHub

Showing 4 of 4 total issues

Function exports has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(api) {
  var validEnv = ['development', 'test', 'production']
  var currentEnv = api.env()
  var isDevelopmentEnv = api.env('development')
  var isProductionEnv = api.env('production')
Severity: Major
Found in babel.config.js - About 2 hrs to fix

    Method insert_users has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def insert_users
        @user_table.each do |attrs|
          u = User.find_or_initialize_by(username: attrs['netid'])
          attrs.slice!(*OLD_USER_COLUMNS)
          attrs['v1_id'] = attrs.delete('id')
    Severity: Minor
    Found in app/services/data_importer.rb - About 55 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 insert_attendances has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def insert_attendances # rubocop:disable Metrics/MethodLength
        @attendance_entries_table.each do |attrs|
          event = Event.find_by(v1_id: attrs['event_id'])
          next unless event.present?
    
    
    Severity: Minor
    Found in app/services/data_importer.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 query_peoplehub has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.query_peoplehub(search_param)
          if search_param.length == 10 && search_param.match?(/^[0-9]{10}$/)
            begin
              response_to_person(PeopleHub::Querier.get(proxnumber: search_param))
            rescue RuntimeError
    Severity: Minor
    Found in lib/people_hub/person_request.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