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

no_magic_number - Ignore UIColor initializers #5183

Open
2 tasks done
LowAmmo opened this issue Aug 17, 2023 · 0 comments
Open
2 tasks done

no_magic_number - Ignore UIColor initializers #5183

LowAmmo opened this issue Aug 17, 2023 · 0 comments
Labels
enhancement Ideas for improvements of existing features and rules. good first issue Issue to be taken up by new contributors yet unfamiliar with the project.

Comments

@LowAmmo
Copy link
Contributor

LowAmmo commented Aug 17, 2023

New Issue Checklist

New rule request

Requesting another enhancement to "no_magic_numbers", where it will ignore UIColor definitions.

Since the nature of definiting a color is going to have some "magic numbers", I think it would make sense to just ignore the values -

static let grayColor: UIColor = #colorLiteral(red: 0.7019607843, green: 0.7019607843, blue: 0.7019607843, alpha: 1)
let myColor: UIColor = UIColor(red: 0.6, green: 1.0, blue: 0.2, alpha: 0.52)
let yourColor: UIColor = UIColor(hue: 0.9, saturation: 0.6, brightness: 0.333334, alpha: 1.0)

(including all other UIColor constructors

I don't think this needs to be an "opt-in" configuration...I would think most people would want this by default...but not opposed to it being an opt-in rule.

Hopefully that makes sense!

-Thanks!

@SimplyDanny SimplyDanny added the enhancement Ideas for improvements of existing features and rules. label Aug 22, 2023
@SimplyDanny SimplyDanny added the good first issue Issue to be taken up by new contributors yet unfamiliar with the project. label Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Ideas for improvements of existing features and rules. good first issue Issue to be taken up by new contributors yet unfamiliar with the project.
Projects
None yet
Development

No branches or pull requests

2 participants