Compare commits
3 Commits
main
...
release-0.
Author | SHA1 | Date |
---|---|---|
![]() |
180d941327 | |
![]() |
384e8f12ef | |
![]() |
958a8c5299 |
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -1,4 +1,4 @@
|
|||
## Master
|
||||
## 0.43.1: Laundroformat
|
||||
|
||||
#### Breaking
|
||||
|
||||
|
@ -14,7 +14,14 @@
|
|||
|
||||
#### Bug Fixes
|
||||
|
||||
* None.
|
||||
* Fix the File Length rule name.
|
||||
[onato](https://github.com/onato)
|
||||
[#3560](https://github.com/realm/SwiftLint/issues/3560)
|
||||
|
||||
* Re-add `--format` flag to reformat Swift files using SourceKit.
|
||||
Only applied with `--fix`/`--autocorrect`.
|
||||
[JP Simard](https://github.com/jpsim)
|
||||
[#3571](https://github.com/realm/SwiftLint/issues/3571)
|
||||
|
||||
## 0.43.0: Clothes Line Interface
|
||||
|
||||
|
|
|
@ -4,5 +4,5 @@ public struct Version {
|
|||
public let value: String
|
||||
|
||||
/// The current SwiftLint version.
|
||||
public static let current = Version(value: "0.43.0")
|
||||
public static let current = Version(value: "0.43.1")
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ public struct FileLengthRule: ConfigurationProviderRule {
|
|||
|
||||
public static let description = RuleDescription(
|
||||
identifier: "file_length",
|
||||
name: "File Line Length",
|
||||
name: "File Length",
|
||||
description: "Files should not span too many lines.",
|
||||
kind: .metrics,
|
||||
nonTriggeringExamples: [
|
||||
|
|
|
@ -43,6 +43,7 @@ extension SwiftLint {
|
|||
ignoreCache: true,
|
||||
enableAllRules: false,
|
||||
autocorrect: common.fix,
|
||||
format: common.format,
|
||||
compilerLogPath: compilerLogPath,
|
||||
compileCommands: compileCommands
|
||||
)
|
||||
|
|
|
@ -47,6 +47,7 @@ extension SwiftLint {
|
|||
ignoreCache: noCache,
|
||||
enableAllRules: enableAllRules,
|
||||
autocorrect: common.fix,
|
||||
format: common.format,
|
||||
compilerLogPath: nil,
|
||||
compileCommands: nil
|
||||
)
|
||||
|
|
|
@ -20,6 +20,11 @@ struct LintOrAnalyzeArguments: ParsableArguments {
|
|||
var config = [String]()
|
||||
@Flag(name: [.long, .customLong("autocorrect")], help: "Correct violations whenever possible.")
|
||||
var fix = false
|
||||
@Flag(help: """
|
||||
Should reformat the Swift files using the same mechanism used by Xcode (via SourceKit).
|
||||
Only applied with `--fix`/`--autocorrect`.
|
||||
""")
|
||||
var format = false
|
||||
@Flag(help: "Use an alternative algorithm to exclude paths for `excluded`, which may be faster in some cases.")
|
||||
var useAlternativeExcluding = false
|
||||
@Flag(help: "Read SCRIPT_INPUT_FILE* environment variables as files.")
|
||||
|
|
|
@ -157,6 +157,15 @@ struct LintOrAnalyzeCommand {
|
|||
let storage = RuleStorage()
|
||||
let configuration = Configuration(options: options)
|
||||
return configuration.visitLintableFiles(options: options, cache: nil, storage: storage) { linter in
|
||||
if options.format {
|
||||
switch configuration.indentation {
|
||||
case .tabs:
|
||||
linter.format(useTabs: true, indentWidth: 4)
|
||||
case .spaces(let count):
|
||||
linter.format(useTabs: false, indentWidth: count)
|
||||
}
|
||||
}
|
||||
|
||||
let corrections = linter.correct(using: storage)
|
||||
if !corrections.isEmpty && !options.quiet {
|
||||
let correctionLogs = corrections.map({ $0.consoleDescription })
|
||||
|
@ -191,6 +200,7 @@ struct LintOrAnalyzeOptions {
|
|||
let ignoreCache: Bool
|
||||
let enableAllRules: Bool
|
||||
let autocorrect: Bool
|
||||
let format: Bool
|
||||
let compilerLogPath: String?
|
||||
let compileCommands: String?
|
||||
|
||||
|
|
Loading…
Reference in New Issue