Closed rist closed 2 years ago
Looks like there is also another issue with Attributes:
The below triggers Attributes should be on their own lines in functions and types, but on the same line as variables and imports
even if my config says:
attributes:
always_on_same_line: ["@IBAction", "@IBDesignable", "@NSManaged", "@objc"]
always_on_line_above: ["@discardableResult", "@WidgetBundleBuilder"]
@available(iOSApplicationExtension 14.0, *)
@WidgetBundleBuilder
static var includedWidgets: some Widget {
...widget
...widget
}
Now this works as expected
@WidgetBundleBuilder
static var includedWidgets: some Widget {
...widget
...widget
}
@rist you have a few options for how to structure this:
@objc // swiftlint:disable:next function_body_length
fileprivate func setupDataSource() {
or
@objc
fileprivate func setupDataSource() {
// swiftlint:disable:previous function_body_length
or
@objc
fileprivate func setupDataSource() { // swiftlint:disable:this function_body_length
or
// swiftlint:disable function_body_length
@objc
fileprivate func setupDataSource() {
...
// swiftlint:enable function_body_length
oh wow I'll use the first option as it's most in line with my other settings
thanks for explaining and these examples
New Issue Checklist
Describe the bug
For a function which has an attribute (e.g.
@objc
) theattribute
warning gets triggered when adding a comment - e.g.// swiftlint:disable:next function_body_length
Complete output when running SwiftLint, including the stack trace and command used
So with this file
I get either
or
depending if I add the line containing
swiftlint:disable:next
or not. I also tried placing the SwiftLint comment above@objc
but this also didn't workI configured SwiftLint like this to keep the example size small
Environment