11module RuboCop
2+ class CommentConfig
3+ attr_reader processed_source: ProcessedSource
4+
5+ def initialize : (ProcessedSource processed_source) -> void
6+ end
7+
28 class ConfigLoader
39 def self.debug? : () -> boolish
410 def self.merge_with_default : (Config, String) -> Config
511 end
612
713 class Config
8- def initialize : (Hash[untyped , untyped ], String) -> void
14+ def initialize : (? Hash[untyped , untyped ] hash, ? String loaded_path ) -> void
915 def for_cop : (String cop) -> Hash[String, untyped ]
1016 def for_enabled_cop : (String cop) -> Hash[String, untyped ]
1117 end
1218
19+ class ConfigStore
20+ def options_config= : (String options_config) -> void
21+ end
22+
1323 module Cop
1424 class Base
1525 extend AST::NodePattern::Macros
@@ -72,6 +82,16 @@ module RuboCop
7282 def comments_contain_disables? : (RuboCop::AST::Node node, String cop_name) -> bool
7383 end
7484
85+ class Offense
86+ attr_reader severity: Severity
87+ attr_reader location: Parser::Source::Range
88+ attr_reader message: String
89+ attr_reader cop_name: String
90+
91+ def line : () -> Integer
92+ def column : () -> Integer
93+ end
94+
7595 module RangeHelp
7696 def source_range : (Parser::Source::Buffer source_buffer, Integer line_number, Integer column, ?Integer length) -> Parser::Source::Range
7797 def range_between : (Integer start_pos, Integer end_pos) -> Parser::Source::Range
@@ -84,12 +104,24 @@ module RuboCop
84104 ?buffer: Parser::Source::Buffer) -> Parser::Source::Range
85105 end
86106
107+ class Registry
108+ end
109+
87110 module IgnoredNode
88111 def ignore_node : (RuboCop::AST::Node node) -> void
89112 def part_of_ignored_node? : (RuboCop::AST::Node node) -> bool
90113 def ignored_node? : (RuboCop::AST::Node node) -> bool
91114 end
92115
116+ class Severity
117+ type t = :info | :refactor | :convention | :warning | :error | :fatal
118+
119+ attr_reader name: t
120+
121+ def code : () -> String
122+ def level : () -> Integer
123+ end
124+
93125 module TargetRubyVersion
94126 def minimum_target_ruby_version : (Float) -> void
95127 def maximum_target_ruby_version : (Float) -> void
@@ -117,8 +149,28 @@ module RuboCop
117149 end
118150 end
119151
152+ module Ext
153+ module ProcessedSource
154+ attr_accessor registry: Cop::Registry
155+ attr_accessor config: Config
156+
157+ def comment_config : () -> CommentConfig
158+ def disabled_line_ranges : () -> Hash[untyped , untyped ]
159+ end
160+ end
161+
120162 class ProcessedSource = AST::ProcessedSource
121163
164+ class Runner
165+ type extractorResult = Array[{ offset: Integer, processed_source: ProcessedSource}]?
166+
167+ interface _Extractor
168+ def call : (ProcessedSource) -> extractorResult
169+ end
170+
171+ def self.ruby_extractors : () -> Array[_Extractor]
172+ end
173+
122174 module AutoCorrector
123175 def support_autocorrect? : () -> true
124176 end
@@ -127,3 +179,13 @@ module RuboCop
127179 def smart_path : (String path) -> String
128180 end
129181end
182+
183+ # Patch to RuboCop::AST::ProcessedSource
184+
185+ module RuboCop
186+ module AST
187+ class ProcessedSource
188+ include Ext::ProcessedSource
189+ end
190+ end
191+ end
0 commit comments