Fixing some rubocop issues

Fixed Rubocop issues

NilComparison:
NonNilCheck:
RegexpLiteral:
RescueModifier:
ShadowingOuterLocalVariable:
SpaceAfterComma