G33K-TRICKS: How to solve "C: Indent when one step more than case" error.

Tuesday, November 30, 2021

How to solve "C: Indent when one step more than case" error.


 

[SOLVED] How to deal with "C: Indent when one step more than case." error from Rubocop


Below is the problem statement.
Problem:
C: Indent when one step more than case.
Rubocop throws this as an error when we have a indentation issue. 
Ruby scripts have indentated code and a missing indentation makes compiler grumpy. To resolve it we just need to have a space before starting the when clause.
Below the simpler way to look at it and how to resolve it.
Solution:

@bad Code
case platform.downcase
when 'android'

@good Code
case platform.downcase
when 'android'
Get Amazon Gift Cards for your friends and relatives: here

No comments: