Skip to content

Commit

Permalink
Make exit code success when Steep has unreported type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pocke committed Jul 23, 2020
1 parent f1d67ac commit 33f507b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
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

0 comments on commit 33f507b

Please sign in to comment.