packwerk 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +7 -0
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +27 -0
  3. data/.github/probots.yml +2 -0
  4. data/.github/pull_request_template.md +27 -0
  5. data/.github/workflows/ci.yml +50 -0
  6. data/.gitignore +12 -0
  7. data/.rubocop.yml +46 -0
  8. data/.ruby-version +1 -0
  9. data/CODEOWNERS +1 -0
  10. data/CODE_OF_CONDUCT.md +76 -0
  11. data/CONTRIBUTING.md +17 -0
  12. data/Gemfile +22 -0
  13. data/Gemfile.lock +236 -0
  14. data/LICENSE.md +7 -0
  15. data/README.md +73 -0
  16. data/Rakefile +13 -0
  17. data/TROUBLESHOOT.md +67 -0
  18. data/USAGE.md +250 -0
  19. data/bin/console +15 -0
  20. data/bin/setup +8 -0
  21. data/dev.yml +32 -0
  22. data/docs/cohesion.png +0 -0
  23. data/exe/packwerk +6 -0
  24. data/lib/packwerk.rb +44 -0
  25. data/lib/packwerk/application_validator.rb +343 -0
  26. data/lib/packwerk/association_inspector.rb +44 -0
  27. data/lib/packwerk/checking_deprecated_references.rb +40 -0
  28. data/lib/packwerk/cli.rb +238 -0
  29. data/lib/packwerk/configuration.rb +82 -0
  30. data/lib/packwerk/const_node_inspector.rb +44 -0
  31. data/lib/packwerk/constant_discovery.rb +60 -0
  32. data/lib/packwerk/constant_name_inspector.rb +22 -0
  33. data/lib/packwerk/dependency_checker.rb +28 -0
  34. data/lib/packwerk/deprecated_references.rb +92 -0
  35. data/lib/packwerk/file_processor.rb +43 -0
  36. data/lib/packwerk/files_for_processing.rb +67 -0
  37. data/lib/packwerk/formatters/progress_formatter.rb +46 -0
  38. data/lib/packwerk/generators/application_validation.rb +62 -0
  39. data/lib/packwerk/generators/configuration_file.rb +69 -0
  40. data/lib/packwerk/generators/inflections_file.rb +43 -0
  41. data/lib/packwerk/generators/root_package.rb +37 -0
  42. data/lib/packwerk/generators/templates/inflections.yml +6 -0
  43. data/lib/packwerk/generators/templates/package.yml +17 -0
  44. data/lib/packwerk/generators/templates/packwerk +23 -0
  45. data/lib/packwerk/generators/templates/packwerk.yml.erb +23 -0
  46. data/lib/packwerk/generators/templates/packwerk_validator_test.rb +11 -0
  47. data/lib/packwerk/graph.rb +74 -0
  48. data/lib/packwerk/inflections/custom.rb +33 -0
  49. data/lib/packwerk/inflections/default.rb +73 -0
  50. data/lib/packwerk/inflector.rb +41 -0
  51. data/lib/packwerk/node.rb +259 -0
  52. data/lib/packwerk/node_processor.rb +49 -0
  53. data/lib/packwerk/node_visitor.rb +22 -0
  54. data/lib/packwerk/offense.rb +44 -0
  55. data/lib/packwerk/output_styles.rb +41 -0
  56. data/lib/packwerk/package.rb +56 -0
  57. data/lib/packwerk/package_set.rb +59 -0
  58. data/lib/packwerk/parsed_constant_definitions.rb +62 -0
  59. data/lib/packwerk/parsers.rb +23 -0
  60. data/lib/packwerk/parsers/erb.rb +66 -0
  61. data/lib/packwerk/parsers/factory.rb +34 -0
  62. data/lib/packwerk/parsers/ruby.rb +42 -0
  63. data/lib/packwerk/privacy_checker.rb +45 -0
  64. data/lib/packwerk/reference.rb +6 -0
  65. data/lib/packwerk/reference_extractor.rb +81 -0
  66. data/lib/packwerk/reference_lister.rb +23 -0
  67. data/lib/packwerk/run_context.rb +103 -0
  68. data/lib/packwerk/sanity_checker.rb +10 -0
  69. data/lib/packwerk/spring_command.rb +28 -0
  70. data/lib/packwerk/updating_deprecated_references.rb +51 -0
  71. data/lib/packwerk/version.rb +6 -0
  72. data/lib/packwerk/violation_type.rb +13 -0
  73. data/library.yml +6 -0
  74. data/packwerk.gemspec +58 -0
  75. data/service.yml +6 -0
  76. data/shipit.rubygems.yml +1 -0
  77. data/sorbet/config +2 -0
  78. data/sorbet/rbi/gems/actioncable@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi +840 -0
  79. data/sorbet/rbi/gems/actionmailbox@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi +571 -0
  80. data/sorbet/rbi/gems/actionmailer@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi +568 -0
  81. data/sorbet/rbi/gems/actionpack@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi +5216 -0
  82. data/sorbet/rbi/gems/actiontext@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi +663 -0
  83. data/sorbet/rbi/gems/actionview@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi +2504 -0
  84. data/sorbet/rbi/gems/activejob@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi +635 -0
  85. data/sorbet/rbi/gems/activemodel@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi +1201 -0
  86. data/sorbet/rbi/gems/activerecord@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi +8011 -0
  87. data/sorbet/rbi/gems/activestorage@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi +904 -0
  88. data/sorbet/rbi/gems/activesupport@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi +3888 -0
  89. data/sorbet/rbi/gems/ast@2.4.1.rbi +54 -0
  90. data/sorbet/rbi/gems/better_html@1.0.15.rbi +317 -0
  91. data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
  92. data/sorbet/rbi/gems/byebug@11.1.3.rbi +8 -0
  93. data/sorbet/rbi/gems/coderay@1.1.3.rbi +8 -0
  94. data/sorbet/rbi/gems/colorize@0.8.1.rbi +40 -0
  95. data/sorbet/rbi/gems/commander@4.5.2.rbi +8 -0
  96. data/sorbet/rbi/gems/concurrent-ruby@1.1.6.rbi +1966 -0
  97. data/sorbet/rbi/gems/constant_resolver@0.1.5.rbi +26 -0
  98. data/sorbet/rbi/gems/crass@1.0.6.rbi +138 -0
  99. data/sorbet/rbi/gems/erubi@1.9.0.rbi +39 -0
  100. data/sorbet/rbi/gems/globalid@0.4.2.rbi +178 -0
  101. data/sorbet/rbi/gems/highline@2.0.3.rbi +8 -0
  102. data/sorbet/rbi/gems/html_tokenizer@0.0.7.rbi +46 -0
  103. data/sorbet/rbi/gems/i18n@1.8.2.rbi +633 -0
  104. data/sorbet/rbi/gems/jaro_winkler@1.5.4.rbi +8 -0
  105. data/sorbet/rbi/gems/loofah@2.5.0.rbi +272 -0
  106. data/sorbet/rbi/gems/m@1.5.1.rbi +108 -0
  107. data/sorbet/rbi/gems/mail@2.7.1.rbi +2490 -0
  108. data/sorbet/rbi/gems/marcel@0.3.3.rbi +30 -0
  109. data/sorbet/rbi/gems/method_source@1.0.0.rbi +76 -0
  110. data/sorbet/rbi/gems/mimemagic@0.3.5.rbi +47 -0
  111. data/sorbet/rbi/gems/mini_mime@1.0.2.rbi +71 -0
  112. data/sorbet/rbi/gems/mini_portile2@2.4.0.rbi +8 -0
  113. data/sorbet/rbi/gems/minitest@5.14.0.rbi +542 -0
  114. data/sorbet/rbi/gems/mocha@1.11.2.rbi +964 -0
  115. data/sorbet/rbi/gems/nio4r@2.5.2.rbi +89 -0
  116. data/sorbet/rbi/gems/nokogiri@1.10.9.rbi +1608 -0
  117. data/sorbet/rbi/gems/parallel@1.19.1.rbi +8 -0
  118. data/sorbet/rbi/gems/parlour@4.0.1.rbi +561 -0
  119. data/sorbet/rbi/gems/parser@2.7.1.4.rbi +1632 -0
  120. data/sorbet/rbi/gems/pry@0.13.1.rbi +8 -0
  121. data/sorbet/rbi/gems/rack-test@1.1.0.rbi +335 -0
  122. data/sorbet/rbi/gems/rack@2.2.2.rbi +1730 -0
  123. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +123 -0
  124. data/sorbet/rbi/gems/rails-html-sanitizer@1.3.0.rbi +213 -0
  125. data/sorbet/rbi/gems/rails@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi +8 -0
  126. data/sorbet/rbi/gems/railties@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi +869 -0
  127. data/sorbet/rbi/gems/rainbow@3.0.0.rbi +155 -0
  128. data/sorbet/rbi/gems/rake@13.0.1.rbi +841 -0
  129. data/sorbet/rbi/gems/rexml@3.2.4.rbi +8 -0
  130. data/sorbet/rbi/gems/rubocop-performance@1.5.2.rbi +8 -0
  131. data/sorbet/rbi/gems/rubocop-shopify@1.0.2.rbi +8 -0
  132. data/sorbet/rbi/gems/rubocop-sorbet@0.3.7.rbi +8 -0
  133. data/sorbet/rbi/gems/rubocop@0.82.0.rbi +8 -0
  134. data/sorbet/rbi/gems/ruby-progressbar@1.10.1.rbi +8 -0
  135. data/sorbet/rbi/gems/smart_properties@1.15.0.rbi +168 -0
  136. data/sorbet/rbi/gems/spoom@1.0.4.rbi +418 -0
  137. data/sorbet/rbi/gems/spring@2.1.0.rbi +160 -0
  138. data/sorbet/rbi/gems/sprockets-rails@3.2.1.rbi +431 -0
  139. data/sorbet/rbi/gems/sprockets@4.0.0.rbi +1132 -0
  140. data/sorbet/rbi/gems/tapioca@0.4.5.rbi +518 -0
  141. data/sorbet/rbi/gems/thor@1.0.1.rbi +892 -0
  142. data/sorbet/rbi/gems/tzinfo@2.0.2.rbi +547 -0
  143. data/sorbet/rbi/gems/unicode-display_width@1.7.0.rbi +8 -0
  144. data/sorbet/rbi/gems/websocket-driver@0.7.1.rbi +438 -0
  145. data/sorbet/rbi/gems/websocket-extensions@0.1.4.rbi +71 -0
  146. data/sorbet/rbi/gems/zeitwerk@2.3.0.rbi +8 -0
  147. data/sorbet/tapioca/require.rb +25 -0
  148. data/static/packwerk-check-demo.png +0 -0
  149. data/static/packwerk_check.gif +0 -0
  150. data/static/packwerk_check_violation.gif +0 -0
  151. data/static/packwerk_update.gif +0 -0
  152. data/static/packwerk_validate.gif +0 -0
  153. metadata +341 -0
@@ -0,0 +1,8 @@
1
+ # DO NOT EDIT MANUALLY
2
+ # This is an autogenerated file for types exported from the `parallel` gem.
3
+ # Please instead update this file by running `dev typecheck update`.
4
+
5
+ # typed: true
6
+
7
+ # THIS IS AN EMPTY RBI FILE.
8
+ # see https://github.com/Shopify/tapioca/blob/master/README.md#manual-gem-requires
@@ -0,0 +1,561 @@
1
+ # DO NOT EDIT MANUALLY
2
+ # This is an autogenerated file for types exported from the `parlour` gem.
3
+ # Please instead update this file by running `dev typecheck update`.
4
+
5
+ # typed: true
6
+
7
+ module Parlour
8
+ end
9
+
10
+ class Parlour::ConflictResolver
11
+ sig { params(namespace: Parlour::RbiGenerator::Namespace, resolver: T.proc.params(desc: String, choices: T::Array[Parlour::RbiGenerator::RbiObject]).returns(T.nilable(Parlour::RbiGenerator::RbiObject))).void }
12
+ def resolve_conflicts(namespace, &resolver); end
13
+
14
+ private
15
+
16
+ sig { params(arr: T::Array[T.untyped]).returns(T::Boolean) }
17
+ def all_eql?(arr); end
18
+ sig { params(namespace: Parlour::RbiGenerator::Namespace, name: T.nilable(String)).void }
19
+ def deduplicate_mixins_of_name(namespace, name); end
20
+ sig { params(arr: T::Array[T.untyped]).returns(T.nilable(Symbol)) }
21
+ def merge_strategy(arr); end
22
+ end
23
+
24
+ module Parlour::Debugging
25
+ class << self
26
+ sig { params(value: T::Boolean).returns(T::Boolean) }
27
+ def debug_mode=(value); end
28
+ sig { returns(T::Boolean) }
29
+ def debug_mode?; end
30
+ sig { params(object: T.untyped, message: String).void }
31
+ def debug_puts(object, message); end
32
+ sig { params(object: T.untyped).returns(String) }
33
+ def name_for_debug_caller(object); end
34
+ end
35
+ end
36
+
37
+ module Parlour::Debugging::Tree
38
+ class << self
39
+ sig { params(message: String).returns(String) }
40
+ def begin(message); end
41
+ sig { params(message: String).returns(String) }
42
+ def end(message); end
43
+ sig { params(message: String).returns(String) }
44
+ def here(message); end
45
+ def line_prefix; end
46
+ def text_prefix; end
47
+ end
48
+ end
49
+
50
+ Parlour::Debugging::Tree::INDENT_SPACES = T.let(T.unsafe(nil), Integer)
51
+
52
+ class Parlour::DetachedRbiGenerator < ::Parlour::RbiGenerator
53
+ sig { override.returns(T.nilable(Parlour::Plugin)) }
54
+ def current_plugin; end
55
+ sig { returns(T.untyped) }
56
+ def detached!; end
57
+ sig { override.returns(Parlour::RbiGenerator::Options) }
58
+ def options; end
59
+ sig { override.params(strictness: String).returns(String) }
60
+ def rbi(strictness = T.unsafe(nil)); end
61
+ end
62
+
63
+ class Parlour::ParseError < ::StandardError
64
+ def initialize(buffer, range); end
65
+
66
+ sig { returns(Parser::Source::Buffer) }
67
+ def buffer; end
68
+ sig { returns(Parser::Source::Range) }
69
+ def range; end
70
+ end
71
+
72
+ class Parlour::Plugin
73
+ abstract!
74
+
75
+ sig { params(options: T::Hash[T.untyped, T.untyped]).void }
76
+ def initialize(options); end
77
+
78
+ sig { abstract.params(root: Parlour::RbiGenerator::Namespace).void }
79
+ def generate(root); end
80
+ sig { returns(T.nilable(String)) }
81
+ def strictness; end
82
+ def strictness=(_); end
83
+
84
+ class << self
85
+ sig { params(new_plugin: T.class_of(Parlour::Plugin)).void }
86
+ def inherited(new_plugin); end
87
+ sig { returns(T::Hash[String, T.class_of(Parlour::Plugin)]) }
88
+ def registered_plugins; end
89
+ sig { params(plugins: T::Array[Parlour::Plugin], generator: Parlour::RbiGenerator, allow_failure: T::Boolean).void }
90
+ def run_plugins(plugins, generator, allow_failure: T.unsafe(nil)); end
91
+ end
92
+ end
93
+
94
+ class Parlour::RbiGenerator
95
+ sig { params(break_params: Integer, tab_size: Integer, sort_namespaces: T::Boolean).void }
96
+ def initialize(break_params: T.unsafe(nil), tab_size: T.unsafe(nil), sort_namespaces: T.unsafe(nil)); end
97
+
98
+ sig { overridable.returns(T.nilable(Parlour::Plugin)) }
99
+ def current_plugin; end
100
+ def current_plugin=(_); end
101
+ sig { overridable.returns(Parlour::RbiGenerator::Options) }
102
+ def options; end
103
+ sig { overridable.params(strictness: String).returns(String) }
104
+ def rbi(strictness = T.unsafe(nil)); end
105
+ sig { overridable.returns(Parlour::RbiGenerator::Namespace) }
106
+ def root; end
107
+ end
108
+
109
+ class Parlour::RbiGenerator::Arbitrary < ::Parlour::RbiGenerator::RbiObject
110
+ sig { params(generator: Parlour::RbiGenerator, code: String, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::Arbitrary).void)).void }
111
+ def initialize(generator, code: T.unsafe(nil), &block); end
112
+
113
+ sig { params(other: Object).returns(T::Boolean) }
114
+ def ==(other); end
115
+ sig { returns(String) }
116
+ def code; end
117
+ def code=(_); end
118
+ sig { override.returns(String) }
119
+ def describe; end
120
+ sig { override.params(indent_level: Integer, options: Parlour::RbiGenerator::Options).returns(T::Array[String]) }
121
+ def generate_rbi(indent_level, options); end
122
+ sig { override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).void }
123
+ def merge_into_self(others); end
124
+ sig { override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).returns(T::Boolean) }
125
+ def mergeable?(others); end
126
+ end
127
+
128
+ class Parlour::RbiGenerator::Attribute < ::Parlour::RbiGenerator::Method
129
+ sig { params(generator: Parlour::RbiGenerator, name: String, kind: Symbol, type: String, class_attribute: T::Boolean, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::Attribute).void)).void }
130
+ def initialize(generator, name, kind, type, class_attribute: T.unsafe(nil), &block); end
131
+
132
+ sig { override.params(other: Object).returns(T::Boolean) }
133
+ def ==(other); end
134
+ sig { returns(T::Boolean) }
135
+ def class_attribute; end
136
+ sig { returns(Symbol) }
137
+ def kind; end
138
+
139
+ private
140
+
141
+ sig { override.params(indent_level: Integer, options: Parlour::RbiGenerator::Options).returns(T::Array[String]) }
142
+ def generate_definition(indent_level, options); end
143
+ end
144
+
145
+ class Parlour::RbiGenerator::ClassNamespace < ::Parlour::RbiGenerator::Namespace
146
+ sig { params(generator: Parlour::RbiGenerator, name: String, final: T::Boolean, superclass: T.nilable(String), abstract: T::Boolean, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::ClassNamespace).void)).void }
147
+ def initialize(generator, name, final, superclass, abstract, &block); end
148
+
149
+ sig { returns(T::Boolean) }
150
+ def abstract; end
151
+ sig { override.returns(String) }
152
+ def describe; end
153
+ sig { override.params(indent_level: Integer, options: Parlour::RbiGenerator::Options).returns(T::Array[String]) }
154
+ def generate_rbi(indent_level, options); end
155
+ sig { override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).void }
156
+ def merge_into_self(others); end
157
+ sig { override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).returns(T::Boolean) }
158
+ def mergeable?(others); end
159
+ sig { returns(T.nilable(String)) }
160
+ def superclass; end
161
+ end
162
+
163
+ class Parlour::RbiGenerator::Constant < ::Parlour::RbiGenerator::RbiObject
164
+ sig { params(generator: Parlour::RbiGenerator, name: String, value: String, eigen_constant: T::Boolean, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::Constant).void)).void }
165
+ def initialize(generator, name: T.unsafe(nil), value: T.unsafe(nil), eigen_constant: T.unsafe(nil), &block); end
166
+
167
+ sig { params(other: Object).returns(T::Boolean) }
168
+ def ==(other); end
169
+ sig { override.returns(String) }
170
+ def describe; end
171
+ def eigen_constant; end
172
+ sig { override.params(indent_level: Integer, options: Parlour::RbiGenerator::Options).returns(T::Array[String]) }
173
+ def generate_rbi(indent_level, options); end
174
+ sig { override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).void }
175
+ def merge_into_self(others); end
176
+ sig { override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).returns(T::Boolean) }
177
+ def mergeable?(others); end
178
+ sig { returns(String) }
179
+ def value; end
180
+ end
181
+
182
+ class Parlour::RbiGenerator::EnumClassNamespace < ::Parlour::RbiGenerator::ClassNamespace
183
+ sig { params(generator: Parlour::RbiGenerator, name: String, final: T::Boolean, enums: T::Array[T.any(String, [String, String])], abstract: T::Boolean, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::EnumClassNamespace).void)).void }
184
+ def initialize(generator, name, final, enums, abstract, &block); end
185
+
186
+ sig { returns(T::Array[T.any(String, [String, String])]) }
187
+ def enums; end
188
+ sig { override.params(indent_level: Integer, options: Parlour::RbiGenerator::Options).returns(T::Array[String]) }
189
+ def generate_body(indent_level, options); end
190
+ sig { override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).void }
191
+ def merge_into_self(others); end
192
+ sig { override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).returns(T::Boolean) }
193
+ def mergeable?(others); end
194
+ end
195
+
196
+ class Parlour::RbiGenerator::Extend < ::Parlour::RbiGenerator::RbiObject
197
+ sig { params(generator: Parlour::RbiGenerator, name: String, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::Extend).void)).void }
198
+ def initialize(generator, name: T.unsafe(nil), &block); end
199
+
200
+ sig { params(other: Object).returns(T::Boolean) }
201
+ def ==(other); end
202
+ sig { override.returns(String) }
203
+ def describe; end
204
+ sig { override.params(indent_level: Integer, options: Parlour::RbiGenerator::Options).returns(T::Array[String]) }
205
+ def generate_rbi(indent_level, options); end
206
+ sig { override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).void }
207
+ def merge_into_self(others); end
208
+ sig { override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).returns(T::Boolean) }
209
+ def mergeable?(others); end
210
+ end
211
+
212
+ class Parlour::RbiGenerator::Include < ::Parlour::RbiGenerator::RbiObject
213
+ sig { params(generator: Parlour::RbiGenerator, name: String, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::Include).void)).void }
214
+ def initialize(generator, name: T.unsafe(nil), &block); end
215
+
216
+ sig { params(other: Object).returns(T::Boolean) }
217
+ def ==(other); end
218
+ sig { override.returns(String) }
219
+ def describe; end
220
+ sig { override.params(indent_level: Integer, options: Parlour::RbiGenerator::Options).returns(T::Array[String]) }
221
+ def generate_rbi(indent_level, options); end
222
+ sig { override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).void }
223
+ def merge_into_self(others); end
224
+ sig { override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).returns(T::Boolean) }
225
+ def mergeable?(others); end
226
+ end
227
+
228
+ class Parlour::RbiGenerator::Method < ::Parlour::RbiGenerator::RbiObject
229
+ sig { params(generator: Parlour::RbiGenerator, name: String, parameters: T::Array[Parlour::RbiGenerator::Parameter], return_type: T.nilable(String), abstract: T::Boolean, implementation: T::Boolean, override: T::Boolean, overridable: T::Boolean, class_method: T::Boolean, final: T::Boolean, type_parameters: T.nilable(T::Array[Symbol]), block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::Method).void)).void }
230
+ def initialize(generator, name, parameters, return_type = T.unsafe(nil), abstract: T.unsafe(nil), implementation: T.unsafe(nil), override: T.unsafe(nil), overridable: T.unsafe(nil), class_method: T.unsafe(nil), final: T.unsafe(nil), type_parameters: T.unsafe(nil), &block); end
231
+
232
+ sig { overridable.params(other: Object).returns(T::Boolean) }
233
+ def ==(other); end
234
+ sig { returns(T::Boolean) }
235
+ def abstract; end
236
+ sig { returns(T::Boolean) }
237
+ def class_method; end
238
+ sig { override.returns(String) }
239
+ def describe; end
240
+ sig { returns(T::Boolean) }
241
+ def final; end
242
+ sig { override.params(indent_level: Integer, options: Parlour::RbiGenerator::Options).returns(T::Array[String]) }
243
+ def generate_rbi(indent_level, options); end
244
+ sig { returns(T::Boolean) }
245
+ def implementation; end
246
+ sig { override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).void }
247
+ def merge_into_self(others); end
248
+ sig { override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).returns(T::Boolean) }
249
+ def mergeable?(others); end
250
+ sig { returns(T::Boolean) }
251
+ def overridable; end
252
+ sig { returns(T::Boolean) }
253
+ def override; end
254
+ sig { returns(T::Array[Parlour::RbiGenerator::Parameter]) }
255
+ def parameters; end
256
+ sig { returns(T.nilable(String)) }
257
+ def return_type; end
258
+ sig { returns(T::Array[Symbol]) }
259
+ def type_parameters; end
260
+
261
+ private
262
+
263
+ sig { overridable.params(indent_level: Integer, options: Parlour::RbiGenerator::Options).returns(T::Array[String]) }
264
+ def generate_definition(indent_level, options); end
265
+ sig { returns(String) }
266
+ def qualifiers; end
267
+ end
268
+
269
+ class Parlour::RbiGenerator::ModuleNamespace < ::Parlour::RbiGenerator::Namespace
270
+ sig { params(generator: Parlour::RbiGenerator, name: String, final: T::Boolean, interface: T::Boolean, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::ClassNamespace).void)).void }
271
+ def initialize(generator, name, final, interface, &block); end
272
+
273
+ sig { override.returns(String) }
274
+ def describe; end
275
+ sig { override.params(indent_level: Integer, options: Parlour::RbiGenerator::Options).returns(T::Array[String]) }
276
+ def generate_rbi(indent_level, options); end
277
+ sig { returns(T::Boolean) }
278
+ def interface; end
279
+ sig { override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).void }
280
+ def merge_into_self(others); end
281
+ sig { override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).returns(T::Boolean) }
282
+ def mergeable?(others); end
283
+ end
284
+
285
+ class Parlour::RbiGenerator::Namespace < ::Parlour::RbiGenerator::RbiObject
286
+ sig { params(generator: Parlour::RbiGenerator, name: T.nilable(String), final: T::Boolean, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::Namespace).void)).void }
287
+ def initialize(generator, name = T.unsafe(nil), final = T.unsafe(nil), &block); end
288
+
289
+ sig { params(comment: T.any(String, T::Array[String])).void }
290
+ def add_comment_to_next_child(comment); end
291
+ sig { returns(T::Array[Parlour::RbiGenerator::RbiObject]) }
292
+ def children; end
293
+ sig { returns(T::Array[Parlour::RbiGenerator::Constant]) }
294
+ def constants; end
295
+ def create_arbitrary(code:, &block); end
296
+ def create_attr(*args, &blk); end
297
+ sig { params(name: String, type: String, class_attribute: T::Boolean, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::Attribute).void)).returns(Parlour::RbiGenerator::Attribute) }
298
+ def create_attr_accessor(name, type:, class_attribute: T.unsafe(nil), &block); end
299
+ sig { params(name: String, type: String, class_attribute: T::Boolean, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::Attribute).void)).returns(Parlour::RbiGenerator::Attribute) }
300
+ def create_attr_reader(name, type:, class_attribute: T.unsafe(nil), &block); end
301
+ sig { params(name: String, type: String, class_attribute: T::Boolean, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::Attribute).void)).returns(Parlour::RbiGenerator::Attribute) }
302
+ def create_attr_writer(name, type:, class_attribute: T.unsafe(nil), &block); end
303
+ sig { params(name: String, kind: Symbol, type: String, class_attribute: T::Boolean, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::Attribute).void)).returns(Parlour::RbiGenerator::Attribute) }
304
+ def create_attribute(name, kind:, type:, class_attribute: T.unsafe(nil), &block); end
305
+ sig { params(name: String, final: T::Boolean, superclass: T.nilable(String), abstract: T::Boolean, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::ClassNamespace).void)).returns(Parlour::RbiGenerator::ClassNamespace) }
306
+ def create_class(name, final: T.unsafe(nil), superclass: T.unsafe(nil), abstract: T.unsafe(nil), &block); end
307
+ sig { params(name: String, value: String, eigen_constant: T::Boolean, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::Constant).void)).returns(Parlour::RbiGenerator::Constant) }
308
+ def create_constant(name, value:, eigen_constant: T.unsafe(nil), &block); end
309
+ sig { params(name: String, final: T::Boolean, enums: T.nilable(T::Array[T.any(String, [String, String])]), abstract: T::Boolean, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::EnumClassNamespace).void)).returns(Parlour::RbiGenerator::EnumClassNamespace) }
310
+ def create_enum_class(name, final: T.unsafe(nil), enums: T.unsafe(nil), abstract: T.unsafe(nil), &block); end
311
+ sig { params(name: String, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::Extend).void)).returns(Parlour::RbiGenerator::Extend) }
312
+ def create_extend(name, &block); end
313
+ sig { params(extendables: T::Array[String]).returns(T::Array[Parlour::RbiGenerator::Extend]) }
314
+ def create_extends(extendables); end
315
+ sig { params(name: String, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::Include).void)).returns(Parlour::RbiGenerator::Include) }
316
+ def create_include(name, &block); end
317
+ sig { params(includables: T::Array[String]).returns(T::Array[Parlour::RbiGenerator::Include]) }
318
+ def create_includes(includables); end
319
+ sig { params(name: String, parameters: T.nilable(T::Array[Parlour::RbiGenerator::Parameter]), return_type: T.nilable(String), returns: T.nilable(String), abstract: T::Boolean, implementation: T::Boolean, override: T::Boolean, overridable: T::Boolean, class_method: T::Boolean, final: T::Boolean, type_parameters: T.nilable(T::Array[Symbol]), block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::Method).void)).returns(Parlour::RbiGenerator::Method) }
320
+ def create_method(name, parameters: T.unsafe(nil), return_type: T.unsafe(nil), returns: T.unsafe(nil), abstract: T.unsafe(nil), implementation: T.unsafe(nil), override: T.unsafe(nil), overridable: T.unsafe(nil), class_method: T.unsafe(nil), final: T.unsafe(nil), type_parameters: T.unsafe(nil), &block); end
321
+ sig { params(name: String, final: T::Boolean, interface: T::Boolean, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::ClassNamespace).void)).returns(Parlour::RbiGenerator::ModuleNamespace) }
322
+ def create_module(name, final: T.unsafe(nil), interface: T.unsafe(nil), &block); end
323
+ sig { params(name: String, final: T::Boolean, props: T.nilable(T::Array[Parlour::RbiGenerator::StructProp]), abstract: T::Boolean, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::StructClassNamespace).void)).returns(Parlour::RbiGenerator::StructClassNamespace) }
324
+ def create_struct_class(name, final: T.unsafe(nil), props: T.unsafe(nil), abstract: T.unsafe(nil), &block); end
325
+ sig { params(name: String, type: String, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::Constant).void)).returns(Parlour::RbiGenerator::Constant) }
326
+ def create_type_alias(name, type:, &block); end
327
+ sig { overridable.override.returns(String) }
328
+ def describe; end
329
+ sig { returns(T::Array[Parlour::RbiGenerator::Extend]) }
330
+ def extends; end
331
+ sig { returns(T::Boolean) }
332
+ def final; end
333
+ sig { overridable.override.params(indent_level: Integer, options: Parlour::RbiGenerator::Options).returns(T::Array[String]) }
334
+ def generate_rbi(indent_level, options); end
335
+ sig { returns(T::Array[Parlour::RbiGenerator::Include]) }
336
+ def includes; end
337
+ sig { overridable.override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).void }
338
+ def merge_into_self(others); end
339
+ sig { overridable.override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).returns(T::Boolean) }
340
+ def mergeable?(others); end
341
+ sig { params(object: T.untyped, block: T.proc.params(x: Parlour::RbiGenerator::Namespace).void).void }
342
+ def path(object, &block); end
343
+
344
+ private
345
+
346
+ sig { overridable.params(indent_level: Integer, options: Parlour::RbiGenerator::Options).returns(T::Array[String]) }
347
+ def generate_body(indent_level, options); end
348
+ sig { params(object: Parlour::RbiGenerator::RbiObject).void }
349
+ def move_next_comments(object); end
350
+ end
351
+
352
+ class Parlour::RbiGenerator::Options
353
+ sig { params(break_params: Integer, tab_size: Integer, sort_namespaces: T::Boolean).void }
354
+ def initialize(break_params:, tab_size:, sort_namespaces:); end
355
+
356
+ sig { returns(Integer) }
357
+ def break_params; end
358
+ sig { params(level: Integer, str: String).returns(String) }
359
+ def indented(level, str); end
360
+ sig { returns(T::Boolean) }
361
+ def sort_namespaces; end
362
+ sig { returns(Integer) }
363
+ def tab_size; end
364
+ end
365
+
366
+ class Parlour::RbiGenerator::Parameter
367
+ sig { params(name: String, type: T.nilable(String), default: T.nilable(String)).void }
368
+ def initialize(name, type: T.unsafe(nil), default: T.unsafe(nil)); end
369
+
370
+ sig { params(other: Object).returns(T::Boolean) }
371
+ def ==(other); end
372
+ sig { returns(T.nilable(String)) }
373
+ def default; end
374
+ sig { returns(Symbol) }
375
+ def kind; end
376
+ sig { returns(String) }
377
+ def name; end
378
+ sig { returns(String) }
379
+ def name_without_kind; end
380
+ sig { returns(String) }
381
+ def to_def_param; end
382
+ sig { returns(String) }
383
+ def to_sig_param; end
384
+ sig { returns(String) }
385
+ def type; end
386
+ end
387
+
388
+ Parlour::RbiGenerator::Parameter::PREFIXES = T.let(T.unsafe(nil), Hash)
389
+
390
+ class Parlour::RbiGenerator::RbiObject
391
+ abstract!
392
+
393
+ sig { params(generator: Parlour::RbiGenerator, name: String).void }
394
+ def initialize(generator, name); end
395
+
396
+ sig { params(comment: T.any(String, T::Array[String])).void }
397
+ def add_comment(comment); end
398
+ def add_comments(*args, &blk); end
399
+ sig { returns(T::Array[String]) }
400
+ def comments; end
401
+ sig { abstract.returns(String) }
402
+ def describe; end
403
+ sig { abstract.params(indent_level: Integer, options: Parlour::RbiGenerator::Options).returns(T::Array[String]) }
404
+ def generate_rbi(indent_level, options); end
405
+ sig { returns(T.nilable(Parlour::Plugin)) }
406
+ def generated_by; end
407
+ sig { returns(Parlour::RbiGenerator) }
408
+ def generator; end
409
+ sig { abstract.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).void }
410
+ def merge_into_self(others); end
411
+ sig { abstract.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).returns(T::Boolean) }
412
+ def mergeable?(others); end
413
+ sig { returns(String) }
414
+ def name; end
415
+
416
+ private
417
+
418
+ sig { params(indent_level: Integer, options: Parlour::RbiGenerator::Options).returns(T::Array[String]) }
419
+ def generate_comments(indent_level, options); end
420
+ end
421
+
422
+ class Parlour::RbiGenerator::StructClassNamespace < ::Parlour::RbiGenerator::ClassNamespace
423
+ sig { params(generator: Parlour::RbiGenerator, name: String, final: T::Boolean, props: T::Array[Parlour::RbiGenerator::StructProp], abstract: T::Boolean, block: T.nilable(T.proc.params(x: Parlour::RbiGenerator::StructClassNamespace).void)).void }
424
+ def initialize(generator, name, final, props, abstract, &block); end
425
+
426
+ sig { override.params(indent_level: Integer, options: Parlour::RbiGenerator::Options).returns(T::Array[String]) }
427
+ def generate_body(indent_level, options); end
428
+ sig { override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).void }
429
+ def merge_into_self(others); end
430
+ sig { override.params(others: T::Array[Parlour::RbiGenerator::RbiObject]).returns(T::Boolean) }
431
+ def mergeable?(others); end
432
+ sig { returns(T::Array[Parlour::RbiGenerator::StructProp]) }
433
+ def props; end
434
+ end
435
+
436
+ class Parlour::RbiGenerator::StructProp
437
+ sig { params(name: String, type: String, optional: T.nilable(T.any(Symbol, T::Boolean)), enum: T.nilable(String), dont_store: T.nilable(T::Boolean), foreign: T.nilable(String), default: T.nilable(String), factory: T.nilable(String), immutable: T.nilable(T::Boolean), array: T.nilable(String), override: T.nilable(T::Boolean), redaction: T.nilable(String)).void }
438
+ def initialize(name, type, optional: T.unsafe(nil), enum: T.unsafe(nil), dont_store: T.unsafe(nil), foreign: T.unsafe(nil), default: T.unsafe(nil), factory: T.unsafe(nil), immutable: T.unsafe(nil), array: T.unsafe(nil), override: T.unsafe(nil), redaction: T.unsafe(nil)); end
439
+
440
+ sig { params(other: Object).returns(T::Boolean) }
441
+ def ==(other); end
442
+ sig { returns(T.nilable(String)) }
443
+ def array; end
444
+ sig { returns(T.nilable(String)) }
445
+ def default; end
446
+ sig { returns(T.nilable(T::Boolean)) }
447
+ def dont_store; end
448
+ sig { returns(T.nilable(String)) }
449
+ def enum; end
450
+ sig { returns(T.nilable(String)) }
451
+ def factory; end
452
+ sig { returns(T.nilable(String)) }
453
+ def foreign; end
454
+ sig { returns(T.nilable(T::Boolean)) }
455
+ def immutable; end
456
+ sig { returns(String) }
457
+ def name; end
458
+ sig { returns(T.nilable(T.any(Symbol, T::Boolean))) }
459
+ def optional; end
460
+ sig { returns(T.nilable(T::Boolean)) }
461
+ def override; end
462
+ sig { returns(T.nilable(String)) }
463
+ def redaction; end
464
+ sig { returns(String) }
465
+ def to_prop_call; end
466
+ sig { returns(T.nilable(String)) }
467
+ def type; end
468
+ end
469
+
470
+ Parlour::RbiGenerator::StructProp::EXTRA_PROPERTIES = T.let(T.unsafe(nil), Array)
471
+
472
+ module Parlour::TypeLoader
473
+ class << self
474
+ sig { params(filename: String, generator: T.nilable(Parlour::RbiGenerator)).returns(Parlour::RbiGenerator::Namespace) }
475
+ def load_file(filename, generator: T.unsafe(nil)); end
476
+ sig { params(root: String, inclusions: T::Array[String], exclusions: T::Array[String], generator: T.nilable(Parlour::RbiGenerator)).returns(Parlour::RbiGenerator::Namespace) }
477
+ def load_project(root, inclusions: T.unsafe(nil), exclusions: T.unsafe(nil), generator: T.unsafe(nil)); end
478
+ sig { params(source: String, filename: T.nilable(String), generator: T.nilable(Parlour::RbiGenerator)).returns(Parlour::RbiGenerator::Namespace) }
479
+ def load_source(source, filename = T.unsafe(nil), generator: T.unsafe(nil)); end
480
+ end
481
+ end
482
+
483
+ class Parlour::TypeParser
484
+ sig { params(ast: Parser::AST::Node, unknown_node_errors: T::Boolean, generator: T.nilable(Parlour::RbiGenerator)).void }
485
+ def initialize(ast, unknown_node_errors: T.unsafe(nil), generator: T.unsafe(nil)); end
486
+
487
+ sig { returns(Parser::AST::Node) }
488
+ def ast; end
489
+ def ast=(_); end
490
+ sig { returns(Parlour::RbiGenerator) }
491
+ def generator; end
492
+ def generator=(_); end
493
+ sig { returns(Parlour::RbiGenerator::Namespace) }
494
+ def parse_all; end
495
+ sig { params(path: Parlour::TypeParser::NodePath, is_within_eigenclass: T::Boolean).returns(T::Array[Parlour::RbiGenerator::Method]) }
496
+ def parse_method_into_methods(path, is_within_eigenclass: T.unsafe(nil)); end
497
+ sig { params(path: Parlour::TypeParser::NodePath, is_within_eigenclass: T::Boolean).returns(T::Array[Parlour::RbiGenerator::RbiObject]) }
498
+ def parse_path_to_object(path, is_within_eigenclass: T.unsafe(nil)); end
499
+ sig { params(path: Parlour::TypeParser::NodePath, is_within_eigenclass: T::Boolean).returns(T::Array[Parlour::RbiGenerator::Method]) }
500
+ def parse_sig_into_methods(path, is_within_eigenclass: T.unsafe(nil)); end
501
+ sig { params(path: Parlour::TypeParser::NodePath).returns(Parlour::TypeParser::IntermediateSig) }
502
+ def parse_sig_into_sig(path); end
503
+ sig { returns(T::Boolean) }
504
+ def unknown_node_errors; end
505
+
506
+ protected
507
+
508
+ sig { params(node: T.nilable(Parser::AST::Node), modifier: Symbol).returns(T::Boolean) }
509
+ def body_has_modifier?(node, modifier); end
510
+ sig { params(node: Parser::AST::Node).returns([T::Array[String], T::Array[String]]) }
511
+ def body_includes_and_extends(node); end
512
+ sig { params(node: T.nilable(Parser::AST::Node)).returns(T::Array[Symbol]) }
513
+ def constant_names(node); end
514
+ sig { params(node: T.nilable(Parser::AST::Node)).returns(T.nilable(String)) }
515
+ def node_to_s(node); end
516
+ sig { params(desc: String, node: T.any(Parlour::TypeParser::NodePath, Parser::AST::Node)).returns(T.noreturn) }
517
+ def parse_err(desc, node); end
518
+ sig { params(path: Parlour::TypeParser::NodePath).returns(T::Boolean) }
519
+ def previous_sibling_sig_node?(path); end
520
+ sig { params(node: Parser::AST::Node).returns(T::Boolean) }
521
+ def sig_node?(node); end
522
+ sig { type_parameters(:A, :B).params(a: T::Array[T.type_parameter(:A)], fa: T.proc.params(item: T.type_parameter(:A)).returns(T.untyped), b: T::Array[T.type_parameter(:B)], fb: T.proc.params(item: T.type_parameter(:B)).returns(T.untyped)).returns(T::Array[[T.type_parameter(:A), T.type_parameter(:B)]]) }
523
+ def zip_by(a, fa, b, fb); end
524
+
525
+ class << self
526
+ sig { params(filename: String, source: String, generator: T.nilable(Parlour::RbiGenerator)).returns(Parlour::TypeParser) }
527
+ def from_source(filename, source, generator: T.unsafe(nil)); end
528
+ end
529
+ end
530
+
531
+ class Parlour::TypeParser::IntermediateSig < ::T::Struct
532
+ prop :type_parameters, T.nilable(T::Array[Symbol])
533
+ prop :overridable, T::Boolean
534
+ prop :override, T::Boolean
535
+ prop :abstract, T::Boolean
536
+ prop :final, T::Boolean
537
+ prop :return_type, T.nilable(String)
538
+ prop :params, T.nilable(T::Array[Parser::AST::Node])
539
+
540
+ class << self
541
+ def inherited(s); end
542
+ end
543
+ end
544
+
545
+ class Parlour::TypeParser::NodePath
546
+ sig { params(indices: T::Array[Integer]).void }
547
+ def initialize(indices); end
548
+
549
+ sig { params(index: Integer).returns(Parlour::TypeParser::NodePath) }
550
+ def child(index); end
551
+ sig { returns(T::Array[Integer]) }
552
+ def indices; end
553
+ sig { returns(Parlour::TypeParser::NodePath) }
554
+ def parent; end
555
+ sig { params(offset: Integer).returns(Parlour::TypeParser::NodePath) }
556
+ def sibling(offset); end
557
+ sig { params(start: Parser::AST::Node).returns(Parser::AST::Node) }
558
+ def traverse(start); end
559
+ end
560
+
561
+ Parlour::VERSION = T.let(T.unsafe(nil), String)