Skip to content
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

Do not index files typed: ignore when running check-shims #1054

Merged
merged 1 commit into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/tapioca/helpers/rbi_files_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ def parse_and_index_files(index, files)

sig { params(index: RBI::Index, file: String).void }
def parse_and_index_file(index, file)
return if Spoom::Sorbet::Sigils.file_strictness(file) == "ignore"

tree = RBI::Parser.parse_file(file)
index.visit(tree)
rescue RBI::ParseError => e
Expand Down
29 changes: 29 additions & 0 deletions spec/tapioca/cli/check_shims_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,35 @@ module Baz; end

refute_success_status(result)
end

it "ignores files typed: ignore" do
@project.write("sorbet/rbi/annotations/foo.rbi", <<~RBI)
# typed: ignore

class Foo; end
RBI

@project.write("sorbet/rbi/gems/foo.rbi", <<~RBI)
# typed: ignore

class Foo; end
RBI

@project.write("sorbet/rbi/shims/foo.rbi", <<~RBI)
# typed: ignore

class Foo; end
RBI

@project.write("sorbet/rbi/todo.rbi", <<~RBI)
# typed: ignore

class Foo; end
RBI

result = @project.tapioca("check-shims --no-payload")
assert_success_status(result)
end
end

describe "when Sorbet version is too old" do
Expand Down