Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow configuration of 'discouraged_object_literal' rule #2439
New Issue Checklist
New rule request
Similar to the
Currently, only enforcing literals can be configured, but you cannot selectively discourage the others.
The main motivation comes from Xcode 10's terrible image literal support (you can basically only use them by dragging from the media library, and it's very hard to see or edit the raw image names in Xcode, nor do you see a preview).
Our goal is to enforce literals for all objects (currently that means colors), except for images, where we want to enforce non-literal syntax.
The relevant part of our config file would look like this:
I would assume the existing
Unless I'm missing something and this option shouldn't be implemented after all, I would volunteer to look into the code myself.