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

Steep Should not exit with status 1 on warning #1277

Open
aaronmallen opened this issue Oct 10, 2024 · 3 comments
Open

Steep Should not exit with status 1 on warning #1277

aaronmallen opened this issue Oct 10, 2024 · 3 comments

Comments

@aaronmallen
Copy link

Currently steep will exit with code 1 on warning:

Run ./.github/actions/lint/types
Run bundle exec steep check --jobs 5
# Type checking files:

.....................................................................................................................................................................................................F..

Warning: type/lib/domainic/type/constraint/parameter.rb:108:66: [warning] Cannot pass a value of type `::Proc` as a block-pass-argument of type `^ [self: (singleton(::Domainic::Type::Constraint::BaseConstraint) | ::Domainic::Type::Constraint::BaseConstraint)] -> U(48)`
│   ::Proc <: ^ [self: (singleton(::Domainic::Type::Constraint::BaseConstraint) | ::Domainic::Type::Constraint::BaseConstraint)] -> U(48)
│
│ Diagnostic ID: Ruby::BlockTypeMismatch
│
└           callbacks.each { |callback| @base.instance_exec(@value, &callback) }
                                                                    ~~~~~~~~~

Warning: type/lib/domainic/type/constraint/parameter.rb:136:44: [warning] Cannot pass a value of type `::Proc` as a block-pass-argument of type `^ [self: (singleton(::Domainic::Type::Constraint::BaseConstraint) | ::Domainic::Type::Constraint::BaseConstraint)] -> U(49)`
│   ::Proc <: ^ [self: (singleton(::Domainic::Type::Constraint::BaseConstraint) | ::Domainic::Type::Constraint::BaseConstraint)] -> U(49)
│
│ Diagnostic ID: Ruby::BlockTypeMismatch
│
└           return base.instance_exec(result, &coercer) if coercer.is_a?(Proc)
                                              ~~~~~~~~

Warning: type/lib/domainic/type/constraint/parameter.rb:169:43: [warning] Cannot pass a value of type `::Proc` as a block-pass-argument of type `^ [self: (singleton(::Domainic::Type::Constraint::BaseConstraint) | ::Domainic::Type::Constraint::BaseConstraint)] -> U(51)`
│   ::Proc <: ^ [self: (singleton(::Domainic::Type::Constraint::BaseConstraint) | ::Domainic::Type::Constraint::BaseConstraint)] -> U(51)
│
│ Diagnostic ID: Ruby::BlockTypeMismatch
│
└           return base.instance_exec(value, &validator) if validator.is_a?(Proc)
                                             ~~~~~~~~~~

Detected 3 problems from 1 file
Error: Process completed with exit code 1.
@aaronmallen
Copy link
Author

aaronmallen commented Oct 10, 2024

My current work around:

# Steepfile

configure_code_diagnostics do |config|
  config[Steep::Diagnostic::Ruby::BlockTypeMismatch] = :hint
end

@soutaro
Copy link
Owner

soutaro commented Oct 11, 2024

It exits with error when it prints diagnostics. So, passing --severity-level to steep check would be another workaround.

I don't think giving Error diagnostics a special treatment is a good way. Adding a command line option like --fail-severity-level=error?

@p-datadog
Copy link

The convention is that exit status 0 means success. Warning is not a failure. Compilers have an option to treat warnings as errors, I suggest following the same logic with steep: add an option to exit with 1 if any warnings are emitted, by default warnings should exit with 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants