emojidex/emojidex

View on GitHub

Showing 16 of 24 total issues

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

    class User
      attr_reader :username, :auth_token, :premium, :pro, :premium_exp, :pro_exp, :status
      attr_accessor :favorites, :history, :history_page, :cache_path

      @@auth_status_codes = { none: false, failure: false,
Severity: Minor
Found in lib/emojidex/service/user.rb - About 3 hrs to fix

    Method get_combo_checksums has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

          def get_combo_checksums(moji, combo, formats = Emojidex::Defaults.formats,
                            sizes = Emojidex::Defaults.sizes)
            sums = combo.generate_blank_entry_set
            if formats.include? :svg
              for i in 0..(combo.components.length - 1)
    Severity: Minor
    Found in lib/emojidex/data/collection/asset_information.rb - About 2 hrs 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

    Class Collection has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Collection
          include Emojidex::Data::CollectionCache
          include Emojidex::Data::CollectionAssetInformation
          include Emojidex::Data::CollectionMojiData
          attr_accessor :emoji, :categories,
    Severity: Minor
    Found in lib/emojidex/data/collection.rb - About 2 hrs to fix

      Method _raster_check_copy has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

            def _raster_check_copy(moji, format, sizes)
              sizes.each do |size|
                if @raster_source_path != nil
                  src_d = "#{@raster_source_path}/#{size}/#{moji.code}"
                  src = "#{src_d}.#{format}"
      Severity: Minor
      Found in lib/emojidex/data/collection/cache.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 _add_list has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

            def _add_list(list)
              return if list.nil?
              list.each do |moji_info|
                if moji_info.instance_of? Emojidex::Data::Emoji
                  next if @r18 == false && moji_info.r18 == true
      Severity: Minor
      Found in lib/emojidex/data/collection.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 _cache_png has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def _cache_png(sizes)
              sizes = sizes.keys if sizes.is_a?(Hash)
              sizes.each do |size|
                size = size.first if size.is_a?(Array)
                size = size.key if size.is_a?(Hash)
      Severity: Minor
      Found in lib/emojidex/data/emoji/asset_information.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 check_for_index_only has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def check_for_index_only(collections, asset_files, sizes, formats)
              collections.each do |collection|
                collection.emoji.values.each do |emoji|
                  tmp = []
                  tmp += create_svg_array(emoji, asset_files) if formats.include?(:svg)
      Severity: Minor
      Found in lib/emojidex/util/collection_checker.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 setup_cache has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def setup_cache(path = nil)
              @formats = Emojidex::Defaults.selected_formats unless @formats
              @sizes = Emojidex::Defaults.selected_sizes unless @sizes
              @download_queue = []
              @download_threads = 4
      Severity: Minor
      Found in lib/emojidex/data/collection/cache.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 _svg_check_copy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def _svg_check_copy(moji)
              if @vector_source_path != nil
                src_d = "#{@vector_source_path}/#{moji.code}"
                src = "#{src_d}.svg"
      
      
      Severity: Minor
      Found in lib/emojidex/data/collection/cache.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 popular has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def self.popular(detailed = false, limit = Emojidex::Defaults.limit, page = 0,
                             username = nil, auth_token = nil)
      Severity: Minor
      Found in lib/emojidex/service/indexes.rb - About 35 mins to fix

        Method newest has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def self.newest(detailed = false, limit = Emojidex::Defaults.limit, page = 0,
                              username = nil, auth_token = nil)
        Severity: Minor
        Found in lib/emojidex/service/indexes.rb - About 35 mins to fix

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

                def sync_history(limit = Emojidex::Defaults.limit, page = 0)
                  return false unless authorized?
          
                  page = @history_page + 1 if page == 0
          
          
          Severity: Minor
          Found in lib/emojidex/service/user.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 path? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def path?(format, size = nil)
                  case format
                  when :svg
                    return @paths[format] if File.exist?(@paths[format])
                  when :png
          Severity: Minor
          Found in lib/emojidex/data/emoji/asset_information.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 more has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def more
                  @page += 1
          
                  opts = { page: @page, limit: @limit, detailed: @detailed }
                  opts[:username] = @username unless @username.nil? || @username == ''
          Severity: Minor
          Found in lib/emojidex/service/collection.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 _cache has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def _cache(options)
                  setup_cache options[:cache_path]
                  formats = options[:formats] || @formats
                  sizes = options[:sizes] || @sizes
          
          
          Severity: Minor
          Found in lib/emojidex/data/collection/cache.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 associate_variants has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def associate_variants
                  @emoji.values.each do |emoji_obj|
                    next unless emoji_obj.code.match(/\(.*\)$/) # this emoji is a variant
                    # check for base
                    base_code = emoji_obj.code.sub(/\(.*\)$/, '').to_sym
          Severity: Minor
          Found in lib/emojidex/data/collection.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