emojidex/emojidex

View on GitHub

Showing 24 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 _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 _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 _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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            def self.newest(detailed = false, limit = Emojidex::Defaults.limit, page = 0,
                            username = nil, auth_token = nil)
              if auth_token.nil?
                username = Emojidex::Client.USER.username
                auth_token = Emojidex::Client.USER.auth_token
      Severity: Minor
      Found in lib/emojidex/service/indexes.rb and 1 other location - About 55 mins to fix
      lib/emojidex/service/indexes.rb on lines 30..38

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 46.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            def self.popular(detailed = false, limit = Emojidex::Defaults.limit, page = 0,
                             username = nil, auth_token = nil)
              if auth_token.nil?
                username = Emojidex::Client.USER.username
                auth_token = Emojidex::Client.USER.auth_token
      Severity: Minor
      Found in lib/emojidex/service/indexes.rb and 1 other location - About 55 mins to fix
      lib/emojidex/service/indexes.rb on lines 17..25

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 46.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            def fill_remote_checksums(checksums)
              @remote_checksums[:svg] = checksums[:svg] if checksums.include? :svg
              return unless checksums.include? :png
              Emojidex::Defaults.sizes.keys.each do |size|
                @remote_checksums[:png][size] = checksums[:png][size] if checksums[:png].include? size
      Severity: Minor
      Found in lib/emojidex/data/emoji/asset_information.rb and 1 other location - About 45 mins to fix
      lib/emojidex/data/emoji/asset_information.rb on lines 42..48

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 41.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            def fill_checksums(checksums)
              @checksums[:svg] = checksums[:svg] if checksums.include? :svg
              return unless checksums.include? :png
              Emojidex::Defaults.sizes.keys.each do |size|
                @checksums[:png][size] = checksums[:png][size] if checksums[:png].include? size
      Severity: Minor
      Found in lib/emojidex/data/emoji/asset_information.rb and 1 other location - About 45 mins to fix
      lib/emojidex/data/emoji/asset_information.rb on lines 33..39

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 41.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          module Emojidex
            module Data
              # listing and search of extended emoji from the emojidex set
              class Extended < Collection
                include Emojidex::Data::StaticCollection
          Severity: Minor
          Found in lib/emojidex/data/extended.rb and 1 other location - About 35 mins to fix
          lib/emojidex/data/utf.rb on lines 4..15

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 35.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          module Emojidex
            module Data
              # listing and search of standard UTF emoji
              class UTF < Collection
                include Emojidex::Data::StaticCollection
          Severity: Minor
          Found in lib/emojidex/data/utf.rb and 1 other location - About 35 mins to fix
          lib/emojidex/data/extended.rb on lines 4..16

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 35.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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 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 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

          Severity
          Category
          Status
          Source
          Language