Conversation
|
Regarding
I thought we could target by a commit for rules repos not registered on the central bazel rules repository. The quickstart guide on the rules repo lists this as a way to install it too. If it's too much to manage, I think |
| - attach_workspace: | ||
| at: ~/player | ||
|
|
||
| - run: |
There was a problem hiding this comment.
Regarding rules_swiftformat:
Blocking Problem: not in the bazel registry so it's really hard, if not impossible to use
I thought we could target by a commit for rules repos not registered on the central bazel rules repository. The quickstart guide on the rules repo lists this as a way to install it too. If it's too much to manage, I think mint looks like the best alternative but want to make sure I understand exactly what's stopping us from using the recommended approach.
@tmarmer Yeah, it does list that but:
- I tried it and it didn't work
- I don't think this supports the new Bazel format. I got some errors I thought might be to that effect when trying
- The example says to use the last release, which is 0.4.1, which is from 2022. This is out of date and not really maintained
There was a problem hiding this comment.
Well if it doesn't work, that's a good enough reason to do something else XD
If mint works and it's easy to keep everything up to date than I think that's a good approach.
|
My testing observation: I had two swift files with formatting issue, one staged one unstaged. running commit, the expected behavior is the commit failed with fixed version unstaged and an error about the linting and get it fixed since we have i think it's because of the formatting issue is already fixed and no file change to commit then that leaves it an empty git commit. But it looks confusing since no linting error is pointed out or fixed and I still have staged change. Recording: |
What
Resolves #849.
Automatic formatting will be enforced for
.swiftfiles using a combination ofSwiftLintandSwiftFormat. Here is the developer flow:just format-iosThis uses a new-to-this-repo tool,
mint, to pin the sameSwiftFormatandSwiftLintversions across dev environments.Why
We would like to enable automatic formatting to catch some basic ios issues before review. This will reduce PR review burden.
Specifically, we chose to go with a mix of
SwiftLintandSwiftFormatto leverage each one's specialties.SwiftLintis better at catching logic issues that cannot be automatically fixed, like force unwrapping, whileSwiftFormatis better at fixing things automatically.I chose
mintandSwiftFormat(instead of Xcode's built-inswift-format) for this because:mintwithSwiftLintandSwiftFormatis way fast, running in < 1s for each format consistently locallymintallows us to pinSwiftLintandSwiftFormatversions via aMintfileso devs can easily align on versions and have consistent formattingmintis a lightweight wrapper that works well and we do not have to maintainThe drawback is that this is not bazel based. However, there does not seem to be a good bazel-based hermetic solution. In absence of such a solution,
mintseems like the best option.Other Options Considered
rules_swiftformat:rules_swiftformat:rules_lint(replacement forbazel-super-formatter:SwiftFormatSwift package (link) and have a rules_player rule leverage it:swift-formatvia XcodeChange Type (required)
Indicate the type of change your pull request is:
patchminormajorN/ADoes your PR have any documentation updates?