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

Swiftlint 0.27 and enabled some extra rules #476

Merged
merged 4 commits into from
Sep 9, 2018
Merged

Conversation

djbe
Copy link
Member

@djbe djbe commented Aug 30, 2018

The only potentially contentious one might be object_literal.

Copy link
Collaborator

@AliSoftware AliSoftware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that rule force #xxLiterals or does it forbid it? I never remember

@djbe
Copy link
Member Author

djbe commented Aug 30, 2018

It enforces it. Might sound weird for a project like swiftgen, and it's only really for our tests. But I personally don't think they're too bad? It's easier for visual checks.

@AliSoftware
Copy link
Collaborator

Do we actually have object literals in the SwiftGen codebase anyway? We don't have UIColors or UIImage or any other UI type in SwiftGen survey code proper, it being a CLI tool, right?

@djbe
Copy link
Member Author

djbe commented Aug 30, 2018

It's only in the color parsing tests.

@djbe djbe force-pushed the feature/swiftlint-0.27 branch 2 times, most recently from 939ec83 to 2bbee0c Compare August 31, 2018 23:31
@djbe djbe added this to the Swiftgen 6.0 milestone Sep 3, 2018
@djbe djbe force-pushed the feature/swiftlint-0.27 branch 4 times, most recently from 13892da to 9da866f Compare September 6, 2018 14:01
#colorLiteral(red: 0, green: 0, blue: 0, alpha: 0): 0x00000000,
#colorLiteral(red: 1, green: 1, blue: 1, alpha: 1): 0xFFFFFFFF,
#colorLiteral(red: 0.973, green: 0.973, blue: 0.973, alpha: 1): 0xF8F8F8FF,
#colorLiteral(red: 0.969, green: 0.969, blue: 0.969, alpha: 1): 0xF7F7F7FF
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually winder in that case if using NSColor wouldn't stillbe better.

Because what we actually want to test there is that for a given color with those given RGBA component values, the hex representation matches.

Having those colors show up as little swatches/colored squares in the IDE doesn't help check at first sight if 0.973 matches 0xF8/0xFF, or that red, green and blue has the same value. While with their whole NSColor(…) textual representation IDE, it might help better…
Except if you click on the little color swatches in Xcode and in the Color Palette displayed, you have a palette displaying the Hex representation… maybe… that's debatable ^^

@djbe djbe force-pushed the feature/swiftlint-0.27 branch from 9da866f to 488dfb1 Compare September 9, 2018 18:34
@djbe djbe merged commit 0c33207 into master Sep 9, 2018
@djbe djbe deleted the feature/swiftlint-0.27 branch September 9, 2018 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants