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

Make exit code success when Steep has unreported type errors #171

Merged
merged 1 commit into from
Jul 24, 2020
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: 1 addition & 1 deletion lib/steep/project/target.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def no_error?
def errors
case status
when TypeCheckStatus
source_files.each_value.flat_map(&:errors)
source_files.each_value.flat_map(&:errors).select { |error | options.error_to_report?(error) }
else
[]
end
Expand Down
23 changes: 23 additions & 0 deletions test/target_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,29 @@ class Foo
end
end

def test_success_type_check_with_unreported_errors
target = Project::Target.new(
name: :foo,
options: Project::Options.new.tap { |o| o.apply_lenient_typing_options! },
source_patterns: ["lib"],
ignore_patterns: [],
signature_patterns: ["sig"]
)

target.add_source Pathname("lib/foo.rb"), <<-EOF
Foo = 1
EOF

target.type_check

assert_equal Project::Target::TypeCheckStatus, target.status.class
assert_empty target.errors
target.source_files[Pathname("lib/foo.rb")].tap do |file|
assert_equal Project::SourceFile::TypeCheckStatus, file.status.class
refute_empty file.status.typing.errors
end
end

def test_signature_syntax_error
target = Project::Target.new(
name: :foo,
Expand Down