Showing 388 of 406 total issues

Method parse_symbol_arg_space has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_symbol_arg_space no, tk # :nodoc:
    args = []

    unget_tk tk
    if tk = parse_symbol_in_arg
Severity: Minor
Found in lib/rdoc/parser/ruby.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 build_paragraph has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def build_paragraph margin
    p :paragraph_start => margin if @debug

    paragraph = RDoc::Markup::Paragraph.new

Severity: Minor
Found in lib/rdoc/markup/parser.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 save_class has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def save_class klass
    full_name = klass.full_name

    FileUtils.mkdir_p class_path(full_name) unless @dry_run

Severity: Minor
Found in lib/rdoc/store.rb - About 1 hr to fix

    Method parse_constant_body has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def parse_constant_body container, constant, is_array_or_hash # :nodoc:
        nest     = 0
        rhs_name = ''.dup
    
        get_tkread
    Severity: Minor
    Found in lib/rdoc/parser/ruby.rb - About 1 hr to fix

      Method get_class_or_module has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def get_class_or_module container, ignore_constants = false
          skip_tkspace
          name_t = get_tk
          given_name = ''.dup
      
      
      Severity: Minor
      Found in lib/rdoc/parser/ruby.rb - About 1 hr to fix

        Method get_squashed_tk has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def get_squashed_tk
            if @buf.empty?
              tk = @tokens.shift
            else
              tk = @buf.shift
        Severity: Minor
        Found in lib/rdoc/parser/ripper_state_lex.rb - About 1 hr to fix

          Method read_file has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def self.read_file filename, encoding, force_transcode = false
              content = File.open filename, "rb" do |f| f.read end
              content.gsub!("\r\n", "\n") if RUBY_PLATFORM =~ /mswin|mingw/
          
              utf8 = content.sub!(/\A\xef\xbb\xbf/, '')
          Severity: Minor
          Found in lib/rdoc/encoding.rb - About 1 hr to fix

            Method get_symbol_tk has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private def get_symbol_tk(tk)
                is_symbol = true
                symbol_tk = Token.new(tk.line_no, tk.char_no, :on_symbol)
                if ":'" == tk[:text] or ':"' == tk[:text] or tk[:text].start_with?('%s')
                  tk1 = get_string_tk(tk)
            Severity: Minor
            Found in lib/rdoc/parser/ripper_state_lex.rb - About 1 hr to fix

              Method can_parse_by_name has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.can_parse_by_name file_name
                  _, parser = RDoc::Parser.parsers.find { |regexp,| regexp =~ file_name }
              
                  # The default parser must not parse binary files
                  ext_name = File.extname file_name
              Severity: Minor
              Found in lib/rdoc/parser.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 markup_code has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                def markup_code
                  return '' unless @token_stream
              
                  src = RDoc::TokenStream.to_html @token_stream
              
              
              Severity: Minor
              Found in lib/rdoc/generator/markup.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_symbol_arg_paren has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                def parse_symbol_arg_paren no # :nodoc:
                  args = []
              
                  loop do
                    skip_tkspace_comment
              Severity: Minor
              Found in lib/rdoc/parser/ruby.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_identifier has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                def parse_identifier container, single, tk, comment # :nodoc:
                  case tk[:text]
                  when 'private', 'protected', 'public', 'private_class_method',
                       'public_class_method', 'module_function' then
                    parse_visibility container, single, tk
              Severity: Minor
              Found in lib/rdoc/parser/ruby.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_file has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def parse_file filename
                  encoding = @options.encoding
                  filename = filename.encode encoding
              
                  @stats.add_file filename
              Severity: Minor
              Found in lib/rdoc/rdoc.rb - About 1 hr to fix

                Method init_ivars has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def init_ivars # :nodoc:
                    @dry_run = false
                    @embed_mixins = false
                    @exclude = %w[
                      ~\z \.orig\z \.rej\z \.bak\z
                Severity: Minor
                Found in lib/rdoc/options.rb - About 1 hr to fix

                  Method from_module has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def self.from_module class_type, mod
                      klass = class_type.new mod.name
                  
                      mod.comment_location.each do |comment, location|
                        klass.add_comment comment, location
                  Severity: Minor
                  Found in lib/rdoc/code_object/class_module.rb - About 1 hr to fix

                    Method document has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def document options
                        self.store = RDoc::Store.new
                    
                        if RDoc::Options === options then
                          @options = options
                    Severity: Minor
                    Found in lib/rdoc/rdoc.rb - About 1 hr to fix

                      Method parse_entries has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def parse_entries
                          @time_cache ||= {}
                      
                          if /\A((?:.*\n){,3})commit\s/ =~ @content
                            class << self; prepend Git; end
                      Severity: Minor
                      Found in lib/rdoc/parser/changelog.rb - About 1 hr to fix

                        Method visit_call_node has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def visit_call_node(node)
                              @scanner.process_comments_until(node.location.start_line - 1)
                              if node.receiver.nil?
                                case node.name
                                when :attr
                        Severity: Minor
                        Found in lib/rdoc/parser/prism_ruby.rb - About 1 hr to fix

                          Method handle_class_module has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def handle_class_module(var_name, type, class_name, parent, in_module)
                              parent_name = @known_classes[parent] || parent
                          
                              if in_module then
                                enclosure = @classes[in_module] || @store.find_c_enclosure(in_module)
                          Severity: Minor
                          Found in lib/rdoc/parser/c.rb - About 1 hr to fix

                            Method resolve_method has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def resolve_method name
                                ref = nil
                            
                                if /#{CLASS_REGEXP_STR}([.#]|::)#{METHOD_REGEXP_STR}/o =~ name then
                                  type = $2
                            Severity: Minor
                            Found in lib/rdoc/cross_reference.rb - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language