revvco/crowdskout

View on GitHub

Showing 9 of 17 total issues

Method tracking_code_source has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def tracking_code_source
        if !source.nil? && !organization.nil? && !client.nil?
          %{
            <!-- Crowdskout -->
            <script>
Severity: Minor
Found in lib/crowdskout/components/quartermaster/tracking_code.rb - About 1 hr to fix

    Method build_url has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

            def build_url(url, params = nil)
              if params.respond_to? :each
                params.each do |key, value|
                  # Convert dates to CC date format
                  if value.respond_to? :iso8601
    Severity: Minor
    Found in lib/crowdskout/services/base_service.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 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.create(props)
            obj = Profile.new
            obj.collections = []
            if props
              props.each do |key, value|
    Severity: Minor
    Found in lib/crowdskout/components/profiles/profile.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 create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.create(props)
            obj = Item.new
            obj.id = 0
            obj.fields = []
            if props
    Severity: Minor
    Found in lib/crowdskout/components/profiles/item.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 create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.create(props)
            obj = Attribute.new
            if props
              props.each do |key, value|
                if key.downcase == 'options'
    Severity: Minor
    Found in lib/crowdskout/components/attributes/attribute.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 create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.create(props)
            obj = FieldOptions.new
            if props
              props.each do |key, value|
                if key.downcase == 'options'
    Severity: Minor
    Found in lib/crowdskout/components/fields/field_options.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

    Consider simplifying this complex logical expression.
    Open

            if @client_id.nil? || @client_id == '' || @client_secret.nil? || @client_secret.nil? || @redirect_uri.nil? || @redirect_uri == ''
              raise ArgumentError.new "Either api_key, api_secret or redirect_uri is missing in explicit call or configuration."
            end
    Severity: Major
    Found in lib/crowdskout/auth/oauth2.rb - About 40 mins to fix

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

            def get_access_token(code)
              params = {
                :grant_type    => Util::Config.get('auth.authorization_code_grant_type'),
                :client_id     => @client_id,
                :client_secret => @client_secret,
      Severity: Minor
      Found in lib/crowdskout/auth/oauth2.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 get_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def get_value(index, value)
                index = index.is_a?(Array) ? index : [index]
                key = index.shift.to_sym
                value.is_a?(Hash) and value[key] and value[key].is_a?(Hash) ?
                get_value(index, value[key]) :
      Severity: Minor
      Found in lib/crowdskout/util/config.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