Skip to content

Commit 4b68a42

Browse files
fix(internal): ensure formatting always uses c.utf-8 locale
1 parent 8abcd39 commit 4b68a42

File tree

457 files changed

+16039
-10008
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

457 files changed

+16039
-10008
lines changed

.rubocop.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ Layout/MultilineMethodParameterLineBreaks:
6363
# Prefer compact hash literals.
6464
Layout/SpaceInsideHashLiteralBraces:
6565
EnforcedStyle: no_space
66+
Exclude:
67+
- "**/*.rbi"
6668

6769
Lint/BooleanSymbol:
6870
Enabled: false
@@ -90,6 +92,10 @@ Lint/MissingSuper:
9092
Exclude:
9193
- "**/*.rbi"
9294

95+
Lint/SymbolConversion:
96+
Exclude:
97+
- "**/*.rbi"
98+
9399
# Disabled for safety reasons, this option changes code semantics.
94100
Lint/UnusedMethodArgument:
95101
AutoCorrect: false
@@ -244,6 +250,10 @@ Style/RedundantInitialize:
244250
Exclude:
245251
- "**/*.rbi"
246252

253+
Style/RedundantParentheses:
254+
Exclude:
255+
- "**/*.rbi"
256+
247257
# Prefer slashes for regex literals.
248258
Style/RegexpLiteral:
249259
EnforcedStyle: slashes

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
GIT
22
remote: https://github.com/stainless-api/syntax_tree-rbs.git
3-
revision: 140eb3ba2ff4b959b345ac2a7927cd758a9f1284
3+
revision: c30b50219918be7cfe3ef803a00b59d1e77fcada
44
branch: main
55
specs:
66
syntax_tree-rbs (1.0.0)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ Sorbet's typed enums require sub-classing of the [`T::Enum` class](https://sorbe
191191
Since this library does not depend on `sorbet-runtime`, it uses a [`T.all` intersection type](https://sorbet.org/docs/intersection-types) with a ruby primitive type to construct a "tagged alias" instead.
192192

193193
```ruby
194-
module FinchAPI::Models::ConnectionStatusType
194+
module FinchAPI::ConnectionStatusType
195195
# This alias aids language service driven navigation.
196-
TaggedSymbol = T.type_alias { T.all(Symbol, FinchAPI::Models::ConnectionStatusType) }
196+
TaggedSymbol = T.type_alias { T.all(Symbol, FinchAPI::ConnectionStatusType) }
197197
end
198198
```
199199

Rakefile

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,40 @@ multitask(:test) do
3434
ruby(*%w[-w -e], rb, verbose: false) { fail unless _1 }
3535
end
3636

37-
rubo_find = %w[find ./lib ./test ./rbi -type f -and ( -name *.rb -or -name *.rbi ) -print0]
3837
xargs = %w[xargs --no-run-if-empty --null --max-procs=0 --max-args=300 --]
38+
locale = {"LC_ALL" => "C.UTF-8"}
3939

4040
desc("Lint `*.rb(i)`")
4141
multitask(:"lint:rubocop") do
42+
find = %w[find ./lib ./test ./rbi -type f -and ( -name *.rb -or -name *.rbi ) -print0]
43+
4244
rubocop = %w[rubocop --fail-level E]
4345
rubocop += %w[--format github] if ENV.key?("CI")
4446

4547
# some lines cannot be shortened
4648
rubocop += %w[--except Lint/RedundantCopDisableDirective,Layout/LineLength]
4749

4850
lint = xargs + rubocop
49-
sh("#{rubo_find.shelljoin} | #{lint.shelljoin}")
51+
sh("#{find.shelljoin} | #{lint.shelljoin}")
5052
end
5153

52-
desc("Format `*.rb(i)`")
53-
multitask(:"format:rubocop") do
54+
desc("Format `*.rb`")
55+
multitask(:"format:rb") do
56+
# while `syntax_tree` is much faster than `rubocop`, `rubocop` is the only formatter with full syntax support
57+
find = %w[find ./lib ./test -type f -and -name *.rb -print0]
5458
fmt = xargs + %w[rubocop --fail-level F --autocorrect --format simple --]
55-
sh("#{rubo_find.shelljoin} | #{fmt.shelljoin}")
59+
sh("#{find.shelljoin} | #{fmt.shelljoin}")
60+
end
61+
62+
desc("Format `*.rbi`")
63+
multitask(:"format:rbi") do
64+
find = %w[find ./rbi -type f -and -name *.rbi -print0]
65+
fmt = xargs + %w[stree write --]
66+
sh(locale, "#{find.shelljoin} | #{fmt.shelljoin}")
5667
end
5768

5869
desc("Format `*.rbs`")
59-
multitask(:"format:syntax_tree") do
70+
multitask(:"format:rbs") do
6071
find = %w[find ./sig -type f -name *.rbs -print0]
6172
inplace = /darwin|bsd/ =~ RUBY_PLATFORM ? ["-i", ""] : %w[-i]
6273
uuid = SecureRandom.uuid
@@ -88,7 +99,7 @@ multitask(:"format:syntax_tree") do
8899
# transform class aliases to type aliases, which syntax tree has no trouble with
89100
sh("#{find.shelljoin} | #{pre.shelljoin}")
90101
# run syntax tree to format `*.rbs` files
91-
sh("#{find.shelljoin} | #{fmt.shelljoin}") do
102+
sh(locale, "#{find.shelljoin} | #{fmt.shelljoin}") do
92103
success = _1
93104
end
94105
# transform type aliases back to class aliases
@@ -99,7 +110,7 @@ multitask(:"format:syntax_tree") do
99110
end
100111

101112
desc("Format everything")
102-
multitask(format: [:"format:rubocop", :"format:syntax_tree"])
113+
multitask(format: [:"format:rb", :"format:rbi", :"format:rbs"])
103114

104115
desc("Typecheck `*.rbs`")
105116
multitask(:"typecheck:steep") do

lib/finch_api.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174
require_relative "finch_api/models/sandbox/payment_create_params"
175175
require_relative "finch_api/models/sandbox/payment_create_response"
176176
require_relative "finch_api/models/webhook_event"
177+
require_relative "finch_api/models"
177178
require_relative "finch_api/resources/access_tokens"
178179
require_relative "finch_api/resources/account"
179180
require_relative "finch_api/resources/connect"

lib/finch_api/file_part.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ def initialize(content, filename: nil, content_type: nil)
4545
@filename =
4646
case content
4747
in Pathname
48-
filename.nil? ? content.basename.to_path : File.basename(filename)
48+
filename.nil? ? content.basename.to_path : ::File.basename(filename)
4949
else
50-
filename.nil? ? nil : File.basename(filename)
50+
filename.nil? ? nil : ::File.basename(filename)
5151
end
5252
@content_type = content_type
5353
end

lib/finch_api/internal/individuals_page.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class IndividualsPage
1919
# @return [Array<generic<Elem>>, nil]
2020
attr_accessor :individuals
2121

22-
# @return [FinchAPI::Models::Paging]
22+
# @return [FinchAPI::Paging]
2323
attr_accessor :paging
2424

2525
# @return [Boolean]
@@ -75,7 +75,7 @@ def initialize(client:, req:, headers:, page_data:)
7575
end
7676
case page_data
7777
in {paging: Hash | nil => paging}
78-
@paging = FinchAPI::Internal::Type::Converter.coerce(FinchAPI::Models::Paging, paging)
78+
@paging = FinchAPI::Internal::Type::Converter.coerce(FinchAPI::Paging, paging)
7979
else
8080
end
8181
end

lib/finch_api/internal/page.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Page
1919
# @return [Array<generic<Elem>>, nil]
2020
attr_accessor :data
2121

22-
# @return [FinchAPI::Models::Paging]
22+
# @return [FinchAPI::Paging]
2323
attr_accessor :paging
2424

2525
# @return [Boolean]
@@ -75,7 +75,7 @@ def initialize(client:, req:, headers:, page_data:)
7575
end
7676
case page_data
7777
in {paging: Hash | nil => paging}
78-
@paging = FinchAPI::Internal::Type::Converter.coerce(FinchAPI::Models::Paging, paging)
78+
@paging = FinchAPI::Internal::Type::Converter.coerce(FinchAPI::Paging, paging)
7979
else
8080
end
8181
end

lib/finch_api/internal/type/enum.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ module Type
1717
# values safely.
1818
#
1919
# @example
20-
# # `connection_status_type` is a `FinchAPI::Models::ConnectionStatusType`
20+
# # `connection_status_type` is a `FinchAPI::ConnectionStatusType`
2121
# case connection_status_type
22-
# when FinchAPI::Models::ConnectionStatusType::PENDING
22+
# when FinchAPI::ConnectionStatusType::PENDING
2323
# # ...
24-
# when FinchAPI::Models::ConnectionStatusType::PROCESSING
24+
# when FinchAPI::ConnectionStatusType::PROCESSING
2525
# # ...
26-
# when FinchAPI::Models::ConnectionStatusType::CONNECTED
26+
# when FinchAPI::ConnectionStatusType::CONNECTED
2727
# # ...
2828
# else
2929
# puts(connection_status_type)

lib/finch_api/internal/type/request_parameters.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ module Internal
55
module Type
66
# @api private
77
module RequestParameters
8-
# @!parse
9-
# # Options to specify HTTP behaviour for this request.
10-
# # @return [FinchAPI::RequestOptions, Hash{Symbol=>Object}]
11-
# attr_accessor :request_options
8+
# @!attribute request_options
9+
# Options to specify HTTP behaviour for this request.
10+
#
11+
# @return [FinchAPI::RequestOptions, Hash{Symbol=>Object}]
1212

1313
# @param mod [Module]
1414
def self.included(mod)

0 commit comments

Comments
 (0)