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

Switch to dictionary format for parameterized rules #303

Closed
scottrhoyt opened this issue Dec 28, 2015 · 3 comments
Closed

Switch to dictionary format for parameterized rules #303

scottrhoyt opened this issue Dec 28, 2015 · 3 comments
Labels
enhancement Ideas for improvements of existing features and rules.

Comments

@scottrhoyt
Copy link
Contributor

In addition to not being self documenting, the current array format of parameterizing config values in .swiftlint.yml is proving to be a hurdle to allowing more customization for rules (see #191 #130 #231 ). It's also complicating providing a better way to merge nested configs for #301 .

I propose we switch the format to a dictionary format. e.g.:

variable_name_max_length:
  warning: 40
  error: 60
  exclude: "id"

This would require an overhaul to how ParameterizedRule works. It would also make breaking changes for previous versions of the .swiftlint.yml file, so it probably shouldn't happen until at least the 1.0 release. However, I'd be willing to start looking at how to best accomplish this.

@jpsim jpsim added the enhancement Ideas for improvements of existing features and rules. label Dec 29, 2015
@jpsim
Copy link
Collaborator

jpsim commented Dec 29, 2015

This does seem like the right direction, at the expense of making the simple case more verbose (variable_name_max_length: 20).

I think this could be done at any time, either pre- or post-1.0. I haven't really defined what SwiftLint 1.0 would look like. I should probably start a discussion about that.

@scottrhoyt
Copy link
Contributor Author

I think I've worked out a nice way to accomplish this. I can also preserve the simple case (variable_name_max_length: 20). Working on a POC right now. Let me work the problem a bit more, but I'm pretty sure I've got it nailed, and it should provide some nice additional benefits. I'll report back here once I've fleshed it out a bit more.

@jpsim
Copy link
Collaborator

jpsim commented Dec 29, 2015

Awesome! It's great to see you working on this 😄

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.
Projects
None yet
Development

No branches or pull requests

2 participants