somleng/somleng

View on GitHub

Showing 13 of 48 total issues

Class IncomingPhoneNumberSerializer has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

  class IncomingPhoneNumberSerializer < ResourceSerializer
    def attributes
      super.merge(
        account_sid: nil,
        address_requirements: nil,
Severity: Minor
Found in app/serializers/twilio_api/incoming_phone_number_serializer.rb - About 3 hrs to fix

    File smart_encoding.rb has 285 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class SmartEncoding
      CHARACTERS = {
        "\u00ab" => '"', # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
        "\u00bb" => '"', # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
        "\u201c" => '"', # LEFT DOUBLE QUOTATION MARK
    Severity: Minor
    Found in app/models/smart_encoding.rb - About 2 hrs to fix

      Function exports has 66 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 valid? has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          def valid?(value)
            return true if value.blank? && options[:allow_blank]
            return false unless format.match?(value)
        
            uri = URI.parse(value)
        Severity: Minor
        Found in app/models/url_validator.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

        Function connect has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          connect() {
            const picker = new AirDatepicker(
              this.dateRangePickerTarget,
              {
                container: "#filters",
        Severity: Minor
        Found in app/javascript/controllers/filters/date_picker_controller.js - About 1 hr to fix

          Method attributes has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def attributes
                super.merge(
                  account_sid: nil,
                  address_requirements: nil,
                  address_sid: nil,
          Severity: Minor
          Found in app/serializers/twilio_api/incoming_phone_number_serializer.rb - About 1 hr to fix

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

                def output
                  params = super
            
                  result = {}
                  result[:account] = account
            Severity: Minor
            Found in app/request_schemas/twilio_api/incoming_phone_number_request_schema.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 display has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def display(resource, given_options = {})
                serializer_class = options.delete(:serializer_class) || resource.jsonapi_serializer_class
                decorator_class = options.delete(:decorator_class) || resource.decorator_class
                serializer_options = options.delete(:serializer_options) || {}
                if request.query_parameters.key?(:include)
            Severity: Minor
            Found in lib/jsonapi_responder.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 set_defaults has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def set_defaults
                return if carrier.blank?
                return if number.blank?
            
                self.currency ||= carrier.billing_currency
            Severity: Minor
            Found in app/models/phone_number.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 create_phone_number! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def create_phone_number!
                phone_number = PhoneNumber.find_or_initialize_by(
                  number: data[:number],
                  carrier: import.carrier
                )
            Severity: Minor
            Found in app/workflows/import_phone_number.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 cast has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def cast(value)
                return if value.blank?
            
                value.is_a?(Money::Currency) ? value : Money::Currency.new(value)
              rescue Money::Currency::UnknownCurrency
            Severity: Minor
            Found in app/types/currency_type.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 validate_each has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def validate_each(record, attribute, value)
                return record.errors.add(attribute, :blank) if value.blank?
                return if record.number.blank?
                return if value.to_sym.in?(record.number.e164? ? PhoneNumber::E164_TYPES : PhoneNumber::SHORT_CODE_TYPES)
            
            
            Severity: Minor
            Found in app/validators/phone_number_type_validator.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 manage_record? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def manage_record?
                return false if record.blank?
                return false if record.accepted_or_not_invited?
                return carrier_account_users.exists?(record.id) || carrier_users.exists?(record.id) if carrier_owner?
                return carrier_account_users.exists?(record.id) if carrier_admin?
            Severity: Minor
            Found in app/policies/user_invitation_policy.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