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

operator_usage_whitespace autocorrect inconsistencies #3321

Closed
2 tasks done
SixFiveSoftware opened this issue Aug 25, 2020 · 3 comments
Closed
2 tasks done

operator_usage_whitespace autocorrect inconsistencies #3321

SixFiveSoftware opened this issue Aug 25, 2020 · 3 comments
Labels
bug Unexpected and reproducible misbehavior.

Comments

@SixFiveSoftware
Copy link

New Issue Checklist

Describe the bug

When running SwiftLint autocorrect, the operator_usage_whitespace rule will fix equal sign column alignment for some right-hand side operands, but not some literals. For example:

let color           = UIColor.black // triggers violation
let six               = 6 // triggers violation
let foo              = "foo" // does not trigger violation, but should
let array           = [3.14] // does not trigger violation, but should

So, after auto-correct, I'm left with:

let color = UIColor.black
let six = 6
let foo              = "foo"
let array           = [3.14]
Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint

for properly triggered violations:

warning: Operator Usage Whitespace Violation: Operators should be surrounded by a single whitespace when they are being used. (operator_usage_whitespace)

for the String/Array literals listed above, no output is given (i.e. linting succeeds)

Environment

  • SwiftLint version (run swiftlint version to be sure)? 0.39.2
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? CocoaPods
  • Paste your configuration file:
opt_in_rules:
...
  - operator_usage_whitespace
...
  • Are you using nested configurations? No
    If so, paste their relative paths and respective contents.
  • Which Xcode version are you using (check xcodebuild -version)? 11.3.1 (11C505)
  • Do you have a sample that shows the issue? Run echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
    to quickly test if your example is really demonstrating the issue. If your example is more
    complex, you can use swiftlint lint --path [file here] --no-cache --enable-all-rules.
let foo              = "foo" // does not trigger violation, but should
let array           = [3.14] // does not trigger violation, but should
@stale
Copy link

stale bot commented Nov 8, 2020

This issue has been automatically marked as stale because it has not had any recent activity. Please comment to prevent this issue from being closed. Thank you for your contributions!

@stale stale bot added the wontfix Issues that became stale and were auto-closed by a bot. label Nov 8, 2020
@jpsim jpsim added the bug Unexpected and reproducible misbehavior. label Nov 8, 2020
@stale stale bot removed the wontfix Issues that became stale and were auto-closed by a bot. label Nov 8, 2020
@serejahh
Copy link

PR is merged, so the issue should be closed I guess. @SixFiveSoftware could you update SwiftLint to verify if it works for you now?

@jpsim jpsim closed this as completed Nov 24, 2020
@SixFiveSoftware
Copy link
Author

PR is merged, so the issue should be closed I guess. @SixFiveSoftware could you update SwiftLint to verify if it works for you now?

Yes, it worked! Thank you!

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

No branches or pull requests

3 participants