instructure/active_public_resources

View on GitHub

Showing 12 of 14 total issues

Method parse_video has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def parse_video(item)
        video_id = item['id']
        snippet = item['snippet']
        statistics = item['statistics'] ? item['statistics'] : {}
        details = item['contentDetails']
Severity: Minor
Found in lib/active_public_resources/drivers/youtube.rb - About 1 hr to fix

    Method parse_video has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def parse_video(data)
            video = ActivePublicResources::ResponseTypes::Video.new
            video.id            = data['readable_id']
            video.title         = data['title']
            video.description   = data['description']
    Severity: Minor
    Found in lib/active_public_resources/drivers/khan_academy.rb - About 1 hr to fix

      Method parse_video has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def parse_video(data)
              video = ActivePublicResources::ResponseTypes::Video.new
              video.id            = "#{data['uri']}".gsub(/[^\d]/, '').to_i
              video.title         = data['name']
              video.description   = data['description'] || "No description found"
      Severity: Minor
      Found in lib/active_public_resources/drivers/vimeo.rb - About 1 hr to fix

        Method parse_video has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def parse_video(data)
                video = ActivePublicResources::ResponseTypes::Video.new
                video.id            = data['vkey']
                video.title         = data['title']
                video.description   = data['description']
        Severity: Minor
        Found in lib/active_public_resources/drivers/schooltube.rb - About 1 hr to fix

          Method symbolize_keys has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.symbolize_keys(hash)
              hash.inject({}){|result, (key, value)|
                new_key = case key
                          when String then key.to_sym
                          else key
          Severity: Minor
          Found in lib/active_public_resources.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 perform_request has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def perform_request(request_criteria)
                  request_criteria.validate_presence!([:query])
                  raise StandardError.new("driver has not been initialized properly") unless @client
          
                  results = HTTParty.get('https://api.vimeo.com/videos',
          Severity: Minor
          Found in lib/active_public_resources/drivers/vimeo.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 parse_quiz has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def parse_quiz(data)
                  quiz = ActivePublicResources::ResponseTypes::Quiz.new
                  quiz.id            = data['id']
                  quiz.title         = data['title']
                  quiz.description   = data['description']
          Severity: Minor
          Found in lib/active_public_resources/drivers/quizlet.rb - About 1 hr to fix

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

                def initialize(args={})
                  args.each do |k,v|
                    if k.to_s == 'sort' && !SORTS.include?(v)
                      raise ArgumentError.new("sort is invalid. Must be in [#{SORTS.join(', ')}]")
                    end
            Severity: Minor
            Found in lib/active_public_resources/request_criteria.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 parse_video has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def parse_video(item)
                    video_id = item['id']
                    snippet = item['snippet']
                    statistics = item['statistics'] ? item['statistics'] : {}
                    details = item['contentDetails']
            Severity: Minor
            Found in lib/active_public_resources/drivers/youtube.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 perform_request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def perform_request(request_criteria)
                    request_criteria.set_default_criteria!(@default_request_criteria)
                    unless request_criteria.validate_presence(:query) || request_criteria.validate_presence(:channel)
                      raise ArgumentError, "You must specify at least a query or channel"
                    end
            Severity: Minor
            Found in lib/active_public_resources/drivers/youtube.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 parse_video has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def parse_video(data)
                    video = ActivePublicResources::ResponseTypes::Video.new
                    video.id            = data['vkey']
                    video.title         = data['title']
                    video.description   = data['description']
            Severity: Minor
            Found in lib/active_public_resources/drivers/schooltube.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 parse_video has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def parse_video(data)
                    video = ActivePublicResources::ResponseTypes::Video.new
                    video.id            = data['readable_id']
                    video.title         = data['title']
                    video.description   = data['description']
            Severity: Minor
            Found in lib/active_public_resources/drivers/khan_academy.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