attributes rule gives violation report with @testable #2211
Closed
Description
New Issue Checklist
- Updated SwiftLint to the latest version
- I searched for existing GitHub issues
Bug Report
The attributes rule seems to give wrong results with @testable
. In the sample code to reproduce below, if you remove the blank line between @testable
and @available
the violation warning goes away, but that is wrong. @testable
is not an attribute of the class and is correctly separated by vertical white space.
Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint --config swiftlint.yml
Loading configuration from 'swiftlint.yml'
Linting Swift files in current working directory
Linting 'DeleteMeTests.swift' (1/1)
/Users/bestave/Desktop/DeleteMe/DeleteMeFP/AttributeTest/DeleteMeTests.swift:13:1: warning: Attributes Violation: Attributes should be on their own lines in functions and types, but on the same line as variables and imports. (attributes)
Done linting! Found 1 violation, 0 serious in 1 file.
Environment
- SwiftLint version: 0.25.1 (release and latest source)
- Installation method used: SwiftLint.pkg installer and also cloned/built from master source
- Paste your configuration file:
opt_in_rules:
- attributes
- Are you using [nested configurations]? No
- Which Xcode version are you using? 9.3.1
- Do you have a sample that shows the issue? Yes:
import XCTest
@testable import DeleteMe
@available (iOS 11.0, *)
class DeleteMeTests: XCTestCase {
}