social-snippet/social-snippet

View on GitHub

Showing 15 of 21 total issues

File test_storage.rb has 385 lines of code (exceeds 250 allowed). Consider refactoring.
Open

RSpec.configure do

  shared_context :TestStorage do

    describe "test storage class" do
Severity: Minor
Found in lib/social_snippet/rspec/test_storage.rb - About 5 hrs to fix

    Class YAMLDocument has 34 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class YAMLDocument
    
        @@path = nil
    
        require_relative "yaml_document/query"
    Severity: Minor
    Found in lib/social_snippet/document_backend/yaml_document.rb - About 4 hrs to fix

      Class Tag has 31 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class SocialSnippet::Tag
      
        attr_reader :path
        attr_reader :repo
        attr_reader :ref
      Severity: Minor
      Found in lib/social_snippet/tag.rb - About 3 hrs to fix

        Class RepositoryManager has 24 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class RepositoryManager
        
            attr_reader :core
        
            # Constructor
        Severity: Minor
        Found in lib/social_snippet/repository/repository_manager.rb - About 2 hrs to fix

          Class Config has 22 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class SocialSnippet::Config
          
            attr_reader :core
            attr_reader :home
            attr_reader :fields
          Severity: Minor
          Found in lib/social_snippet/config.rb - About 2 hrs to fix

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

            class SocialSnippet::CommandLine::Command
            
              attr_reader :args
              attr_reader :tokens
              attr_reader :options
            Severity: Minor
            Found in lib/social_snippet/command_line/command.rb - About 2 hrs to fix

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

                  def resolve_tag_repo_ref!(tag)
                    return unless tag.has_repo?
                    repo = core.repo_manager.find_repository(tag.repo)
                    # set latest version
                    if tag.has_ref? === false
              Severity: Minor
              Found in lib/social_snippet/resolvers/base_resolver.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 insert_func has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def insert_func(snippet, context_from, base_tag = nil)
                    raise "must be passed snippet" unless snippet.is_a?(Snippet)
              
                    inserter = Inserter.new(snippet.lines)
                    context = context_from.clone
              Severity: Minor
              Found in lib/social_snippet/resolvers/insert_resolver.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 each_child_snippet has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def each_child_snippet(snippet, context, base_tag)
                    raise "must be passed snippet" unless snippet.is_a?(Snippet)
              
                    snippet.snip_tags.each do |tag_info|
                      t = tag_info[:tag].set_by_tag(base_tag)
              Severity: Minor
              Found in lib/social_snippet/resolvers/base_resolver.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 insert_depended_snippets! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def insert_depended_snippets!(inserter, snippet, context, tag)
                    raise "must be passed snippet" unless snippet.is_a?(Snippet)
              
                    dep_tags = deps_resolver.find(snippet, context, tag)
                    dep_tags = sort_dep_tags_by_dep(dep_tags)
              Severity: Minor
              Found in lib/social_snippet/resolvers/insert_resolver.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 field has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def field(sym, options = {})
                      @field_keys ||= ::Set.new
                      @default_field ||= ::Hash.new
                      @field_type ||= ::Hash.new
              
              
              Severity: Minor
              Found in lib/social_snippet/document_backend/yaml_document.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 move_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def move_path(new_path)
                  source = dirname.split("/")
                  dest = new_path.split("/")
                  destname = dest.pop
              
              
              Severity: Minor
              Found in lib/social_snippet/context.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 find_func has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def find_func(snippet, context_from, tag_from)
                    raise "must be passed snippet" unless snippet.is_a?(Snippet)
              
                    found_tags = []
                    context = context_from.clone
              Severity: Minor
              Found in lib/social_snippet/resolvers/dep_resolver.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def run
                    if has_next_token?
                      s = next_token
                      if has_next_token?
                        key = s
              Severity: Minor
              Found in lib/social_snippet/command_line/sspm/sub_commands/config_command.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def run
                    if has_next_token?
                      repo_url = next_token
                      if /^(git|http|https)\:\/\// === repo_url # url
                        core.api.add_url repo_url
              Severity: Minor
              Found in lib/social_snippet/command_line/sspm/sub_commands/publish_command.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