Skip to content

Commit 9df6d63

Browse files
chore(internal): always run post-processing when formatting when syntax_tree
1 parent a0bfe42 commit 9df6d63

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

.rubocop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ Style/SafeNavigation:
244244
Style/SignalException:
245245
Exclude:
246246
- Rakefile
247+
- "**/*.rake"
247248

248249
# We use these sparingly, where we anticipate future branches for the
249250
# inner conditional.

Rakefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,19 @@ multitask(:syntax_tree) do
5959
# 2. at label `l1`, join previously annotated line with `class | module` information.
6060
pst = sed + [subst, "--"]
6161

62+
success = false
63+
6264
# transform class aliases to type aliases, which syntax tree has no trouble with
6365
sh("#{find.shelljoin} | #{pre.shelljoin}")
6466
# run syntax tree to format `*.rbs` files
65-
sh("#{find.shelljoin} | #{fmt.shelljoin}")
67+
sh("#{find.shelljoin} | #{fmt.shelljoin}") do
68+
success = _1
69+
end
6670
# transform type aliases back to class aliases
6771
sh("#{find.shelljoin} | #{pst.shelljoin}")
72+
73+
# always run post-processing to remove comment marker
74+
fail unless success
6875
end
6976

7077
multitask(format: [:ruboformat, :syntax_tree])

lib/orb/internal/type/enum.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ def coerce(value, state:)
110110
#
111111
# @return [String]
112112
def inspect(depth: 0)
113-
return super() if depth.positive?
113+
if depth.positive?
114+
return is_a?(Module) ? super() : self.class.name
115+
end
114116

115117
members = values.map { Orb::Internal::Type::Converter.inspect(_1, depth: depth.succ) }
116118
prefix = is_a?(Module) ? name : self.class.name

lib/orb/internal/type/union.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,9 @@ def dump(value, state:)
230230
#
231231
# @return [String]
232232
def inspect(depth: 0)
233-
return super() if depth.positive?
233+
if depth.positive?
234+
return is_a?(Module) ? super() : self.class.name
235+
end
234236

235237
members = variants.map { Orb::Internal::Type::Converter.inspect(_1, depth: depth.succ) }
236238
prefix = is_a?(Module) ? name : self.class.name

0 commit comments

Comments
 (0)