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
Added ruleset for alphabetizing import statements #33
Conversation
i'd perhaps put a qualifier i.e. for lack of better ordering, make import statements alphabetical |
I could, but that feels like an unnecessary qualifier to me -- almost as if we're giving up. If there are other, better ordering options, we should propose them and implement them. I think this is a fine standard, but I'm open to other suggestions based on feedback if people feel strongly that there are better, more concise ways to order imports. |
Are there tools to do this automatically? I wouldn't put it in unless there are. Photis Patriotis
|
@prolificphotis as of my knowledge, no. Even so, I still think it should be part of the style guide and then enforced by any third-party tools. It's similar to our bracket syntax rule, etc. |
👍 @prolificphotis @Haud AppCode has a feature that does this for you I believe |
I was used to organize based on the length of the import and build a half pyramid:
|
@ThibaultKlein lol that's kinda cool, but I think a bit more nonsensical :) |
Since we're on the discussion of automating rules like this, I've created a fork of Swiftlint and added a rule for this: https://github.com/prolificinteractive/SwiftLint/pull/1 If we were to merge this, we can have this custom rule added to our swiftlint process as well. |
conflicts, but 👍 |
Please link to the swiftlint mod too |
@prolificphotis what do you mean? I included the PR for the lint addition |
@Haud I just mean I think we should link to it for now. in the styleguide |
@prolificphotis I think that it would make more sense to do that at the top / in another section of the style guide. Swiftlint proposes to be a linter for the GitHub Swift style guide; we can use our fork as the Prolific Swift style guide linter, and that it would be included at the top of the style guide as the "official" linter for our style guide. Thoughts @paulmiard @ThibaultKlein |
@Haud all for that if we had more of our rules in there besides the imports |
@prolificphotis a bunch of our rules are already covered by the linter. I can try to add rules for stuff that the linter doesn't cover as we go forward. |
9b2629f
to
c908882
Compare
@prolificphotis Automation covered in PR #34 |
👍 |
Thought: should we use some sort of marker for the rules that are covered by our linter? (cf #34) |
re:my last question: created an issue for that: #36 |
Added ruleset for alphabetizing import statements
👍 |
Proposal; rule that I used to abide by in C#. I think it has value here in organizing imports, as I don't think we have ever had any rulesets for imports in Objective-C. Thoughts? Alternatives? This seems pretty simple.