Skip to content
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

False positive on @Environment(\.presentationMode) #5103

Closed
2 tasks done
chrisngabp opened this issue Jul 6, 2023 · 2 comments
Closed
2 tasks done

False positive on @Environment(\.presentationMode) #5103

chrisngabp opened this issue Jul 6, 2023 · 2 comments

Comments

@chrisngabp
Copy link
Contributor

New Issue Checklist

Describe the bug

The line @Environment(\.presentationMode) private var presentationMode is complaining with an attributes violation: Attributes Violation: Attributes should be on their own lines in functions and types, but on the same line as variables and imports (attributes).

Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint
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 1639 files.

Environment

  • SwiftLint version (run swiftlint version to be sure)? 0.52.3
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? CocoaPods
  • Which Xcode version are you using (check xcodebuild -version)? 14.3
// This triggers a violation:
@Environment(\.presentationMode) private var presentationMode
@SimplyDanny
Copy link
Collaborator

The rule has an option attributes_with_arguments_always_on_line_above which is true by default.

@chrisngabp
Copy link
Contributor Author

chrisngabp commented Jul 7, 2023

@SimplyDanny maybe we can improve the text Attributes should be on their own lines in functions and types, but on the same line as variables and imports (attributes) to be Attributes should be on their own lines in functions, variables with attributes and types, but on the same line as variables and imports (attributes) but I'm wondering if we can change the text if attributes_with_arguments_always_on_line_above is false?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants