Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ AllCops:
TargetRubyVersion: 3.0
DisabledByDefault: true
SuggestExtensions: false
Exclude:
# Exclude files that are auto generated
- "lib/rdoc/rd/block_parser.rb"
- "lib/rdoc/rd/inline_parser.rb"
- "lib/rdoc/markdown.rb"
- "lib/rdoc/markdown/literals.rb"
# Exclude dependency files when installing them under vendor
- "vendor/**/*"

Layout/TrailingWhitespace:
Enabled: true
Expand All @@ -20,3 +28,6 @@ Layout/SpaceAfterComma:

Lint/UnreachableCode:
Enabled: true

Style/MethodDefParentheses:
Enabled: true
6 changes: 3 additions & 3 deletions lib/rdoc/code_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def force_documentation=(value)
#
# Set to +nil+ to clear RDoc's cached value

def full_name= full_name
def full_name=(full_name)
@full_name = full_name
end

Expand Down Expand Up @@ -316,7 +316,7 @@ def parent_name
##
# Records the RDoc::TopLevel (file) where this code object was defined

def record_location top_level
def record_location(top_level)
@ignored = false
@suppressed = false
@file = top_level
Expand Down Expand Up @@ -358,7 +358,7 @@ def stop_doc
##
# Sets the +store+ that contains this CodeObject

def store= store
def store=(store)
@store = store

return unless @track_visibility
Expand Down
8 changes: 4 additions & 4 deletions lib/rdoc/code_object/any_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def initialize(text, name, singleton: false)
##
# Adds +an_alias+ as an alias for this method in +context+.

def add_alias an_alias, context = nil
def add_alias(an_alias, context = nil)
method = self.class.new an_alias.text, an_alias.new_name, singleton: singleton

method.record_location an_alias.file
Expand Down Expand Up @@ -104,7 +104,7 @@ def call_seq
#
# See also #param_seq

def call_seq= call_seq
def call_seq=(call_seq)
return if call_seq.nil? || call_seq.empty?

@call_seq = call_seq
Expand Down Expand Up @@ -176,7 +176,7 @@ def marshal_dump
# * #full_name
# * #parent_name

def marshal_load array
def marshal_load(array)
initialize_visibility

@dont_rename_initialize = nil
Expand Down Expand Up @@ -309,7 +309,7 @@ def skip_description?
##
# Sets the store for this method and its referenced code objects.

def store= store
def store=(store)
super

@file = @store.add_file @file.full_name if @file
Expand Down
6 changes: 3 additions & 3 deletions lib/rdoc/code_object/attr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def initialize(text, name, rw, comment, singleton: false)
##
# Attributes are equal when their names, singleton and rw are identical

def == other
def ==(other)
self.class == other.class and
self.name == other.name and
self.rw == other.rw and
Expand Down Expand Up @@ -118,7 +118,7 @@ def marshal_dump
# * #full_name
# * #parent_name

def marshal_load array
def marshal_load(array)
initialize_visibility

@aliases = []
Expand All @@ -145,7 +145,7 @@ def marshal_load array
@parent_name ||= @full_name.split('#', 2).first
end

def pretty_print q # :nodoc:
def pretty_print(q) # :nodoc:
q.group 2, "[#{self.class.name} #{full_name} #{rw} #{visibility}", "]" do
unless comment.empty? then
q.breakable
Expand Down
30 changes: 15 additions & 15 deletions lib/rdoc/code_object/class_module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class RDoc::ClassModule < RDoc::Context
#--
# TODO move to RDoc::NormalClass (I think)

def self.from_module class_type, mod
def self.from_module(class_type, mod)
klass = class_type.new mod.name

mod.comment_location.each do |comment, location|
Expand Down Expand Up @@ -120,7 +120,7 @@ def initialize(name, superclass = nil)
# method is preferred over #comment= since it allows ri data to be updated
# across multiple runs.

def add_comment comment, location
def add_comment(comment, location)
return unless document_self

original = comment
Expand All @@ -141,7 +141,7 @@ def add_comment comment, location
self.comment = original
end

def add_things my_things, other_things # :nodoc:
def add_things(my_things, other_things) # :nodoc:
other_things.each do |group, things|
my_things[group].each { |thing| yield false, thing } if
my_things.include? group
Expand Down Expand Up @@ -198,7 +198,7 @@ def clear_comment
# Appends +comment+ to the current comment, but separated by a rule. Works
# more like <tt>+=</tt>.

def comment= comment # :nodoc:
def comment=(comment) # :nodoc:
comment = case comment
when RDoc::Comment then
comment.normalize
Expand All @@ -216,7 +216,7 @@ def comment= comment # :nodoc:
#
# See RDoc::Store#complete

def complete min_visibility
def complete(min_visibility)
update_aliases
remove_nodoc_children
embed_mixins
Expand Down Expand Up @@ -259,7 +259,7 @@ def each_ancestor # :yields: module
##
# Looks for a symbol in the #ancestors. See Context#find_local_symbol.

def find_ancestor_local_symbol symbol
def find_ancestor_local_symbol(symbol)
each_ancestor do |m|
res = m.find_local_symbol(symbol)
return res if res
Expand All @@ -271,7 +271,7 @@ def find_ancestor_local_symbol symbol
##
# Finds a class or module with +name+ in this namespace or its descendants

def find_class_named name
def find_class_named(name)
return self if full_name == name
return self if @name == name

Expand Down Expand Up @@ -360,7 +360,7 @@ def marshal_dump # :nodoc:
]
end

def marshal_load array # :nodoc:
def marshal_load(array) # :nodoc:
initialize_visibility
initialize_methods_etc
@current_section = nil
Expand Down Expand Up @@ -450,7 +450,7 @@ def marshal_load array # :nodoc:
#
# The data in +class_module+ is preferred over the receiver.

def merge class_module
def merge(class_module)
@parent = class_module.parent
@parent_name = class_module.parent_name

Expand Down Expand Up @@ -535,7 +535,7 @@ def merge class_module
# end
# end

def merge_collections mine, other, other_files, &block # :nodoc:
def merge_collections(mine, other, other_files, &block) # :nodoc:
my_things = mine. group_by { |thing| thing.file }
other_things = other.group_by { |thing| thing.file }

Expand All @@ -547,7 +547,7 @@ def merge_collections mine, other, other_files, &block # :nodoc:
# Merges the comments in this ClassModule with the comments in the other
# ClassModule +cm+.

def merge_sections cm # :nodoc:
def merge_sections(cm) # :nodoc:
my_sections = sections.group_by { |section| section.title }
other_sections = cm.sections.group_by { |section| section.title }

Expand Down Expand Up @@ -595,15 +595,15 @@ def module?
#
# Used for modules and classes that are constant aliases.

def name= new_name
def name=(new_name)
@name = new_name
end

##
# Parses +comment_location+ into an RDoc::Markup::Document composed of
# multiple RDoc::Markup::Documents with their file set.

def parse comment_location
def parse(comment_location)
case comment_location
when String then
super
Expand Down Expand Up @@ -675,7 +675,7 @@ def remove_nodoc_children
end
end

def remove_things my_things, other_files # :nodoc:
def remove_things(my_things, other_files) # :nodoc:
my_things.delete_if do |file, things|
next false unless other_files.include? file

Expand Down Expand Up @@ -705,7 +705,7 @@ def search_record
##
# Sets the store for this class or module and its contained code objects.

def store= store
def store=(store)
super

@attributes .each do |attr| attr.store = store end
Expand Down
10 changes: 5 additions & 5 deletions lib/rdoc/code_object/constant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def initialize(name, value, comment)
##
# Constants are ordered by name

def <=> other
def <=>(other)
return unless self.class === other

[parent_name, name] <=> [other.parent_name, other.name]
Expand All @@ -53,7 +53,7 @@ def <=> other
##
# Constants are equal when their #parent and #name is the same

def == other
def ==(other)
self.class == other.class and
@parent == other.parent and
@name == other.name
Expand Down Expand Up @@ -132,7 +132,7 @@ def marshal_dump
# * #full_name
# * #parent_name

def marshal_load array
def marshal_load(array)
initialize array[1], nil, RDoc::Comment.from_document(array[5])

@full_name = array[2]
Expand All @@ -154,7 +154,7 @@ def path
"#{@parent.path}##{@name}"
end

def pretty_print q # :nodoc:
def pretty_print(q) # :nodoc:
q.group 2, "[#{self.class.name} #{full_name}", "]" do
unless comment.empty? then
q.breakable
Expand All @@ -168,7 +168,7 @@ def pretty_print q # :nodoc:
##
# Sets the store for this class or module and its contained code objects.

def store= store
def store=(store)
super

@file = @store.add_file @file.full_name if @file
Expand Down
Loading