DigitPaint/roger

View on GitHub

Showing 19 of 19 total issues

Class Renderer has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Renderer
    MAX_ALLOWED_TEMPLATE_NESTING = 10

    class << self
      # Register a helper module that should be included in
Severity: Minor
Found in lib/roger/renderer.rb - About 2 hrs to fix

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

      class Release
        include Roger::Helpers::Logging
        include Roger::Helpers::GetFiles
    
        attr_reader :config, :project
    Severity: Minor
    Found in lib/roger/release.rb - About 2 hrs to fix

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

          def filter_files(files, path, path_without_extension, template_extensions)
            results = []
      
            files.each do |file|
              match = if file.start_with?(path)
      Severity: Minor
      Found in lib/roger/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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(project, config = {})
            real_project_path = project.path.realpath
            defaults = {
              scm: :git,
              source_path: project.html_path.realpath,
      Severity: Minor
      Found in lib/roger/release.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 url_to_relative_url has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def url_to_relative_url(url, relative_to_path)
            # Skip if the url doesn't start with a / (but not with //)
            return false unless url =~ %r{\A/[^/]}
      
            path, qs, anch = strip_query_string_and_anchor(url)
      Severity: Minor
      Found in lib/roger/resolver.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 get_previous_tag_name has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def get_previous_tag_name
                # Get list of SHA1 that have a ref
                sha1s = `git --git-dir=#{safe_git_dir} log --pretty="%H" --simplify-by-decoration`
                sha1s = sha1s.split("\n")
                tags = []
      Severity: Minor
      Found in lib/roger/release/scm/git.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 template has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def template(path, source, type = :template)
            if source
              template = Template.new(source, @context, source_path: path)
            else
              template_path = case type
      Severity: Minor
      Found in lib/roger/renderer.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_generic_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_generic_options(args)
            a = args.dup
            arguments = []
            options = {}
      
      
      Severity: Minor
      Found in lib/roger/cli.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 scm_version has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def scm_version(ref)
                return nil unless File.exist?(git_dir)
      
                version = `git --git-dir=#{safe_git_dir} describe --tags #{ref}`
      
      
      Severity: Minor
      Found in lib/roger/release/scm/git.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 get_complex_injection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_complex_injection(injection, release)
            content = injection_content(injection, release)
      
            raise ArgumentError, "No :content or :file specified" unless content
      
      
      Severity: Minor
      Found in lib/roger/release/injector.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 extract_front_matter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def extract_front_matter(source)
            fm_regex = /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
      
            return [{}, source] unless match = source.match(fm_regex)
      
      
      Severity: Minor
      Found in lib/roger/template.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 get_callable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def get_callable(callable, map)
              return callable if callable.respond_to?(:call)
      
              callable = map[callable] if callable.is_a?(Symbol) && map.key?(callable)
      
      
      Severity: Minor
      Found in lib/roger/helpers/get_callable.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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def call(release, options = {})
            @options.update(options)
            files = release.get_files(@options[:into])
      
            files.each do |f|
      Severity: Minor
      Found in lib/roger/release/injector.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!
            project.mode = :server
      
            options = server_options_for_handler
            @used_port = options[:Port]
      Severity: Minor
      Found in lib/roger/server.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 initialize_rogerfile_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize_rogerfile_path
            # We stop immediately if rogerfile is not a Pathname
            unless @options[:rogerfile_path].is_a? Pathname
              self.rogerfile_path = @options[:rogerfile_path]
              return
      Severity: Minor
      Found in lib/roger/project.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 perform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def perform
            # Validate options
            validate_options!
      
            return unless prompt_for_upload
      Severity: Minor
      Found in lib/roger/release/finalizers/rsync.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 scm_date has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def scm_date(ref)
                return nil unless File.exist?(git_dir)
      
                # Get the date in epoch time
                date = `git --git-dir=#{safe_git_dir} show #{ref} --format=format:"%ct" -s`
      Severity: Minor
      Found in lib/roger/release/scm/git.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 absolute_path_from_current_template has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def absolute_path_from_current_template(path)
            pn = Pathname.new(path)
      
            if pn.relative?
              # We're explicitly checking for source_path instead of real_source_path
      Severity: Minor
      Found in lib/roger/renderer.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_template_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def find_template_path(name, options = {})
            options = {
              prefer: "html", # Prefer a template with extension
            }.update(options)
      
      
      Severity: Minor
      Found in lib/roger/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

      Severity
      Category
      Status
      Source
      Language