G33K-TRICKS: [Solved] How to solve "Align the operands of a condition in an unless statement spanning multiple lines" error

Thursday, October 20, 2022

[Solved] How to solve "Align the operands of a condition in an unless statement spanning multiple lines" error


[SOLVED] How to deal with "C: Align the operands of a condition in an unless statement spanning multiple lines" error from Rubocop


Below is the problem statement.
C: Align the operands of a condition in an unless statement spanning multiple lines
Rubocop throws this as an error when the operands are not align correctly
Below the simpler way to look at it and how to resolve it.
Solution:
@bad Code
fail('Title not Present') unless
NewPage.page.title1.exists? ||
NewPage.page.title2.exists?
@good Code
fail('Title not Present') unless
NewPage.page.title1.exists? ||
NewPage.page.title2.exists?
Get Amazon Gift Cards for your friends and relatives: here

No comments: