File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed
Source/SwiftLintFramework/Rules/Metrics
Tests/SwiftLintFrameworkTests Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 3030 [ Kane Cheshire] ( https://github.com/kanecheshire )
3131 [ #3624 ] ( https://github.com/realm/SwiftLint/issues/3624 )
3232
33+ * Improve language and positioning of ` file_length ` warnings when
34+ ` ignore_comment_only_lines: true ` .
35+ [ Steven Grosmark] ( https://github.com/g-mark )
36+ [ #3654 ] ( https://github.com/realm/SwiftLint/pull/3654 )
37+
3338#### Bug Fixes
3439
3540* Fix false positives in ` empty_enum_arguments ` rule when comparing values
Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ public struct FileLengthRule: ConfigurationProviderRule {
1515 ] ,
1616 triggeringExamples: [
1717 Example ( repeatElement ( " print( \" swiftlint \" ) \n " , count: 401 ) . joined ( ) ) ,
18- Example ( ( repeatElement ( " print( \" swiftlint \" ) \n " , count: 400 ) + [ " // \n " ] ) . joined ( ) )
18+ Example ( ( repeatElement ( " print( \" swiftlint \" ) \n " , count: 400 ) + [ " // \n " ] ) . joined ( ) ) ,
19+ Example ( repeatElement ( " print( \" swiftlint \" ) \n \n " , count: 201 ) . joined ( ) )
1920 ]
2021 )
2122
@@ -38,11 +39,12 @@ public struct FileLengthRule: ConfigurationProviderRule {
3839 }
3940
4041 for parameter in configuration. severityConfiguration. params where lineCount > parameter. value {
41- let reason = " File should contain \( configuration. severityConfiguration. warning) lines or less: " +
42- " currently contains \( lineCount) "
42+ let reason = " File should contain \( configuration. severityConfiguration. warning) lines or less " +
43+ ( configuration. ignoreCommentOnlyLines ? " excluding comments and whitespaces " : " " ) +
44+ " : currently contains \( lineCount) "
4345 return [ StyleViolation ( ruleDescription: Self . description,
4446 severity: parameter. severity,
45- location: Location ( file: file. path, line: lineCount ) ,
47+ location: Location ( file: file. path, line: file . lines . count ) ,
4648 reason: reason) ]
4749 }
4850
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ class FileLengthRuleTests: XCTestCase {
1313 ]
1414 let nonTriggeringExamples = [
1515 Example ( ( repeatElement ( " print( \" swiftlint \" ) \n " , count: 400 ) + [ " // \n " ] ) . joined ( ) ) ,
16- Example ( repeatElement ( " print( \" swiftlint \" ) \n " , count: 400 ) . joined ( ) )
16+ Example ( repeatElement ( " print( \" swiftlint \" ) \n " , count: 400 ) . joined ( ) ) ,
17+ Example ( repeatElement ( " print( \" swiftlint \" ) \n \n " , count: 201 ) . joined ( ) )
1718 ]
1819
1920 let description = FileLengthRule . description
You can’t perform that action at this time.
0 commit comments