-
-
Notifications
You must be signed in to change notification settings - Fork 73
Ruby: Re-enable Sorbet check #465
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| # frozen_string_literal: true | ||
| # typed: false | ||
|
|
||
| require "json" | ||
| require "time" | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,17 @@ | ||
| module Herb | ||
| module AST | ||
| <%- nodes.each do |node| -%> | ||
| #: type serialized_<%= node.human %> = { | ||
| <%- node.fields.each do |field| -%> | ||
| <%- is_nilable = !%w[Array[Herb::AST::Node] Array[Herb::AST::ERBWhenNode] Array[Herb::AST::ERBInNode] bool nil].include?(field.ruby_type) -%> | ||
marcoroth marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| #| <%= field.name %>: <%= field.ruby_type %><%= if is_nilable then "?" end %>, | ||
| <%- end -%> | ||
| #| } | ||
| class <%= node.name -%> < Node | ||
| <%- node.fields.each do |field| -%> | ||
| attr_reader :<%= field.name %> #: <%= field.ruby_type %> | ||
| <%- is_nilable = !%w[Array[Herb::AST::Node] Array[Herb::AST::ERBWhenNode] Array[Herb::AST::ERBInNode] bool nil].include?(field.ruby_type) -%> | ||
| #: <%= field.ruby_type %><%= if is_nilable then "?" end %> | ||
| attr_reader :<%= field.name %> | ||
| <%- end -%> | ||
|
|
||
| #: (<%= ["String", "Location", "Array[Herb::Errors::Error]", *node.fields.map(&:ruby_type)].join(", ") %>) -> void | ||
|
|
@@ -24,7 +32,7 @@ module Herb | |
| <%- node.fields.each do |field| -%> | ||
| <%= field.name %>: <%= field.name %>, | ||
| <%- end -%> | ||
| }) #: Herb::serialized_<%= node.human %> | ||
| }) | ||
| end | ||
|
|
||
| #: (Visitor) -> void | ||
|
|
@@ -73,7 +81,7 @@ module Herb | |
| output += %(<%= name %>#{<%= field.name %>.inspect}\n) | ||
| <%- when Herb::Template::TokenField -%> | ||
| output += "<%= name %>" | ||
| output += <%= field.name %> ? <%= field.name %>.tree_inspect : "∅" | ||
| output += <%= field.name %>&.tree_inspect || "∅" | ||
| output += "\n" | ||
| <%- when Herb::Template::BooleanField -%> | ||
| output += "<%= name %>" | ||
|
|
@@ -95,7 +103,7 @@ module Herb | |
| <%- else -%> | ||
| output += "│ └── " | ||
| <%- end -%> | ||
| output += <%= field.name %>.tree_inspect(indent).gsub(/^/, " " * (indent + 1)).lstrip.gsub(/^/, "<%= prefix %>").delete_prefix("<%= prefix %>") | ||
| output += <%= field.name %>&.tree_inspect(indent)&.gsub(/^/, " " * (indent + 1))&.lstrip&.gsub(/^/, "<%= prefix %>")&.delete_prefix("<%= prefix %>") || "" | ||
|
||
| else | ||
| output += "∅\n" | ||
| end | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.