Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move rubocop:disable comments out of documentation #299

Merged
merged 1 commit into from
Jun 20, 2024
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
4 changes: 1 addition & 3 deletions lib/rubocop/ast/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,7 @@ def guard_clause?
# So, does the return value of this node matter? If we changed it to
# `(...; nil)`, might that affect anything?
#
# rubocop:disable Metrics/MethodLength
def value_used?
def value_used? # rubocop:disable Metrics/MethodLength
# Be conservative and return true if we're not sure.
return false if parent.nil?

Expand All @@ -569,7 +568,6 @@ def value_used?
true
end
end
# rubocop:enable Metrics/MethodLength

# Some expressions are evaluated for their value, some for their side
# effects, and some for both.
Expand Down
6 changes: 3 additions & 3 deletions lib/rubocop/ast/node_pattern/compiler/binding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ def bind(name)
var
end

# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
def union_bind(enum)
# Yields for each branch of the given union, forbidding unification of
# bindings which only appear in a subset of the union.
def union_bind(enum) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
Comment on lines +29 to +31
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with this section of the code base and what this method is actually meant to do, so I'm not sure this comment is accurate.

# We need to reset @bound before each branch is processed.
# Moreover we need to keep track of newly encountered wildcards.
# Var `newly_bound_intersection` will hold those that are encountered
Expand Down Expand Up @@ -62,7 +63,6 @@ def union_bind(enum)

result
end
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize

private

Expand Down
5 changes: 2 additions & 3 deletions lib/rubocop/ast/node_pattern/compiler/sequence_subcompiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class Compiler
# Doc on how this fits in the compiling process:
# /docs/modules/ROOT/pages/node_pattern.adoc
#
# rubocop:disable Metrics/ClassLength
class SequenceSubcompiler < Subcompiler
class SequenceSubcompiler < Subcompiler # rubocop:disable Metrics/ClassLength
# Shift of 1 from standard Ruby indices
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inferred from a comment later in this file.

DELTA = 1
POSITIVE = :positive?.to_proc
private_constant :POSITIVE
Expand Down Expand Up @@ -413,7 +413,6 @@ def merge_forks!(forks)
@in_sync = sub_compilers.all?(&:in_sync)
end
end
# rubocop:enable Metrics/ClassLength
end
end
end
Expand Down
8 changes: 2 additions & 6 deletions lib/rubocop/ast/processed_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

require 'digest/sha1'

# rubocop:disable Metrics/ClassLength
module RuboCop
module AST
# ProcessedSource contains objects which are generated by Parser
# and other information such as disabled lines for cops.
# It also provides a convenient way to access source lines.
class ProcessedSource
class ProcessedSource # rubocop:disable Metrics/ClassLength
# @api private
STRING_SOURCE_NAME = '(string)'

Expand Down Expand Up @@ -236,8 +235,7 @@ def tokenize(parser)
[ast, comments, tokens]
end

# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
def parser_class(ruby_version, parser_engine)
def parser_class(ruby_version, parser_engine) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
case parser_engine
when :parser_whitequark
case ruby_version
Expand Down Expand Up @@ -307,7 +305,6 @@ def parser_class(ruby_version, parser_engine)
end
end
end
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength

def create_parser(ruby_version, parser_engine)
builder = RuboCop::AST::Builder.new
Expand Down Expand Up @@ -345,4 +342,3 @@ def source_range(range_or_node)
end
end
end
# rubocop:enable Metrics/ClassLength