Ruby
Simplifiable 'if' statement
Warning
New
Last modified: 03 December 2024 Reports if
statements that can be replaced with case
statements.
Use the Minimum number of branches field to specify the minimum number of when
branches for the resulting case
statement.
Example:
fruit = gets
if fruit == 'apple' # Simplifiable 'if' statement
puts 'This is apple!'
elsif fruit == 'peach'
puts 'This is peach!'
elsif fruit == 'orange'
puts 'This is orange!'
elsif fruit == 'banana'
puts 'This is banana!'
end
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
RubyIfCanBeCaseInspection
Here you can find the description of settings available for the Simplifiable 'if' statement inspection, and the reference of their default values.
Inspection Details | |
---|---|
By default bundled with: | |
Can be installed with plugin: | Ruby, 243.23135 |
Thanks for your feedback!
Was this page helpful?