-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 option to autocorrect command to set indent width #1952
Conversation
Generated by 🚫 Danger |
Codecov Report
@@ Coverage Diff @@
## master #1952 +/- ##
=========================================
Coverage ? 88.76%
=========================================
Files ? 245
Lines ? 11923
Branches ? 0
=========================================
Hits ? 10584
Misses ? 1339
Partials ? 0
Continue to review full report at Codecov.
|
I wonder if this should be a configuration value instead, paving the way to enforce indentation in linting in the future? |
@jpsim Oh I agree absolutely. Unfortunately, I didn't have enough time to look into the codebase on how to implement that as I'm going on vacation tomorrow so I started with this small change. (It also matches with replacing tabs with spaces and vice versa which to my research is limited to the autocorrect tool as well.) |
@jpsim Any update on this? I'd like to get this merged and I'll willing to do some extra work to make sure it does as I believe it would be helpful to others. I think it is fine as is because my changes followed the pattern set by the useTabs settings, which also only exists in the autoCorrect tool, but I can understand wanting the indentWidth setting to be in the .swiftlint-ci.yml file. However, if that happens I think these should also happen:
Otherwise, I believe people will be confused if the useTabs or indentWidth settings are only used for one of the tools in the toolbox. So because of that, I think this work should be merged as a first step towards the goal of supporting all of those features. |
My thoughts on this haven't changed. This should be a configuration setting rather than a CLI flag. Perhaps: indentation: tabs
# or number of spaces
indentation: 4
# or
indentation: 2 We could introduce this in stages similar to what you described in your last comment:
|
@RubenSandwich @jpsim Isn't this superseded by #1893 by now? We should close this if so. |
@Dschee I believe it this was added in V2.41 . I don't write much Swift anymore so I haven't tried the recent versions of SwiftLint. I'm closing this pull request as I'm surprised it's still open, sorry about not cleaning it up earlier. |
Thanks @RubenSandwich, no worries! 👍 |
This pull request adds an option to set the indent width when reformating code.
This partially resolves the issue: #319, specifically the part related to: