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

Add GroupsAreSortedRule #8

Merged
merged 1 commit into from
Nov 1, 2023
Merged

Add GroupsAreSortedRule #8

merged 1 commit into from
Nov 1, 2023

Conversation

finnvoor
Copy link
Contributor

@finnvoor finnvoor commented Nov 1, 2023

Adds a rule to ensure group children are sorted alphabetically (WIP)

  • Add support to sort by type instead of name? later
  • Opt in to rule somehow config issue
  • sorted() is different than Xcode "Sort by Name"
    • Xcode: [10, 2, 1] -> [1, 2, 10]
    • Sorted: [10, 2, 1] -> [1, 10, 2]
  • sorted(using: .localizedStandard) isn't available on linux 🤔

@mattmassicotte feel free to nitpick/replace/overwrite/etc, mostly just was curious how hard it would be to implement (very easy it turns out!)

#7

@mattmassicotte
Copy link
Owner

🤯 holy macaroni this is awesome

long-term, it is probably going to be difficult to manage a single Xcode project for test input, but I'm very happy to burn that bridge when we get to it.

I think it is completely find to just merge this, if you are ok with it. The opt-in is really part of the whole configuration story. And, the sort-by-type idea is cool, but we can tackle that in the future, if needed.

@mattmassicotte
Copy link
Owner

Wait never mind! I saw that the stock macOS one was modified and thought that's what you were using for testing, but isn't. Let's do this!

@finnvoor
Copy link
Contributor Author

finnvoor commented Nov 1, 2023

Sounds good, just want to take a look at that last bullet point I added before merging

@finnvoor finnvoor marked this pull request as ready for review November 1, 2023 13:23
@finnvoor finnvoor marked this pull request as draft November 1, 2023 13:37
@mattmassicotte
Copy link
Owner

Huh, interesting! sorted(using: .localizedStandard) isn't available in the Linux version of Foundation. Well this stinks! I assume that kind of comparison is essential for this to work correctly?

@mattmassicotte
Copy link
Owner

Just a little typo missing the use of sortedChildren. Easy fix!

@finnvoor
Copy link
Contributor Author

finnvoor commented Nov 1, 2023

The comparison sort of needs to be the same on linux, otherwise CI runs will give different errors. I switched to specifying sort options, but it's unclear to me what is available on linux and what isn't.

@finnvoor finnvoor marked this pull request as ready for review November 1, 2023 13:49
@mattmassicotte
Copy link
Owner

but it's unclear to me what is available on linux and what isn't

I have frequently had this problem too. I tried to help mitigate this by explicitly installing Swift 5.9 on the linux CI instance before running. I think the best thing to do is have a VM set up, but who has time for that. A few back-and-forths with CI is no big deal.

@mattmassicotte mattmassicotte merged commit 9569206 into mattmassicotte:main Nov 1, 2023
2 checks passed
@mattmassicotte mattmassicotte mentioned this pull request Nov 1, 2023
@iby
Copy link

iby commented Jul 5, 2024

Hi all! It would be super awesome to have additional configuration on this:

  1. Folders on top.
  2. Exclude extension.

Just wondering if you've considered that and already given any through to this. If there are any caveats? Happy to work on a separate PR for this, just want to gather some feedback and intel.

@mattmassicotte
Copy link
Owner

@iby Hello! I'd like to better understand what you are after. How are you controlling these two things? I can see manual sorting for folders, but how does exclusing an extension work?

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.

3 participants