0.50.0-rc.1
版本发布时间: 2022-10-07 23:00:10
realm/SwiftLint最新发布版本:0.57.0(2024-09-09 00:02:39)
This is a prerelease version. It won't be published to Homebrew or CocoaPods. But there are many other ways to install:
- Downloading the attached
SwiftLint.pkg
installer and launching it - Downloading the attached
portable_swiftlint.zip
archive, extracting it and moving the binary fromportable_swiftlint/swiftlint
to/usr/local/bin
or elsewhere in yourPATH
- Using Mint:
mint install realm/SwiftLint@0.50.0-rc.1
- Cloning and building from source:
git clone https://github.com/realm/SwiftLint.git && cd SwiftLint && git checkout 0.50.0-rc.1 && make install
- Docker:
docker run -it -v `pwd`:`pwd` -w `pwd` ghcr.io/realm/swiftlint:0.50.0-rc.1
- Bazel: See instructions at the bottom
Changes from 0.49.1: https://github.com/realm/SwiftLint/compare/0.49.1...0.50.0-rc.1
Breaking
-
SwiftLint now requires Swift 5.7 or higher to build.
JP Simard -
Exclude
weak_delegate
rule from autocorrection due to behavioral changes leading to potential undefined behavior or bugs.
SimplyDanny #3577 -
The
anyobject_protocol
rule is now deprecated and will be completely removed in a future release because it is now handled by the Swift compiler.
JP Simard
Experimental
- None.
Enhancements
-
SwiftSyntax libraries have been updated from the previous 5.6 release and now use the new parser written in Swift. Swift 5.7+ features should now be parsed more accurately. We've also measured an improvement in lint times of up to 15%. This should also fix some deployment issues where the exact version of the internal SwiftSyntax parser needed to be available. If you notice any unexpected changes to lint results, please file an issue on the SwiftLint issue tracker. We can look into it and if it's a SwiftSyntax parser regression we can re-file it upstream.
JP Simard #4031 -
Add ability to filter rules for
generate-docs
subcommand.
kattouf -
Add new
excludes_trivial_init
configuration formissing_docs
rule to exclude initializers without any parameters.
Marcelo Fabri #4107 -
Rewrite some rules with SwiftSyntax, fixing some false positives and catching more violations:
-
anonymous_argument_in_multiline_closure
-
array_init
-
block_based_kvo
-
class_delegate_protocol
-
closing_brace
-
closure_parameter_position
-
computed_accessors_order
-
contains_over_filter_count
-
contains_over_range_nil_comparison
-
deployment_target
-
discouraged_object_literal
-
discouraged_optional_boolean
-
duplicate_enum_cases
-
dynamic_inline
-
empty_collection_literal
-
empty_enum_arguments
-
empty_parameters
-
empty_parentheses_with_trailing_closure
-
empty_string
-
explicit_init
-
fallthrough
-
flatmap_over_map_reduce
-
force_try
-
force_unwrapping
-
generic_type_name
-
ibinspectable_in_extension
-
implicit_getter
-
inert_defer
-
large_tuple
-
legacy_cggeometry_functions
-
legacy_constant
-
legacy_nsgeometry_functions
-
multiple_closures_with_trailing_closure
-
no_extension_access_modifier
-
no_fallthrough_only
-
no_space_in_method_call
-
nsobject_prefer_isequal
-
private_action
-
private_outlet
-
private_unit_test
-
protocol_property_accessors_order
-
redundant_nil_coalescing
-
redundant_string_enum_value
-
strong_iboutlet
-
switch_case_on_newline
-
toggle_bool
-
trailing_semicolon
-
unneeded_break_in_switch
-
unneeded_parentheses_in_closure_argument
-
unowned_variable_capture
-
untyped_error_in_catch
-
xctfail_message
Marcelo Fabri SimplyDanny JP Simard #2915
-
-
Add
accessibility_trait_for_button
rule to warn if a SwiftUI View has a tap gesture added to it without having the button or link accessibility trait.
Ryan Cole -
Add methods from SE-0348 to
UnusedDeclarationRule
.
JP Simard -
Include the configured
bind_identifier
inself_binding
violation messages.
JP Simard -
Add
library_content_provider
file type tofile_types_order
rule to allowLibraryContentProvider
to be ordered independent frommain_type
.
dahlborn -
Add
test_parent_classes
option totest_case_accessibility
rule, which allows detection in subclasses of XCTestCase.
Martin Redington #4200 -
Add a new
if_let_shadowing
opt-in rule that triggers in Swift 5.7 when a shadowing optional binding is created in an if- or guard-statement.
SimplyDanny #4202 -
Use SwiftSyntax instead of SourceKit to determine if a file has parser errors before applying corrections. This speeds up corrections significantly when none of the rules use SourceKit.
JP Simard -
Add Swift Package Build Tool Plugin with support for Swift Packages and Xcode projects.
Johannes Ebeling #3679 #3840 -
Make
private_unit_test
rule correctable.
SimplyDanny
Bug Fixes
-
Respect
validates_start_with_lowercase
option when linting function names.
Chris Brakebill #2708 -
Do not report variables annotated with
@NSApplicationDelegateAdaptor
and@WKExtensionDelegateAdaptor
inweak_delegate
rule.
Till Hainbach #3598 #3611 -
Fix false-positives related to the
willMove
lifecycle method intype_contents_order
rule.
SimplyDanny #3478 -
Do no longer autocorrect usage of
NSIntersectionRect
inlegacy_nsgeometry_functions
rule.
SimplyDanny #3703 -
Fix Analyzer rules in Xcode 14.
SimplyDanny #4208 -
Add column for SourceKit usage to
rules
command.
JP Simard
Using Bazel
Put this in your WORKSPACE
:
WORKSPACE
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "build_bazel_rules_apple",
sha256 = "90e3b5e8ff942be134e64a83499974203ea64797fd620eddeb71b3a8e1bff681",
url = "https://github.com/bazelbuild/rules_apple/releases/download/1.1.2/rules_apple.1.1.2.tar.gz",
)
load(
"@build_bazel_rules_apple//apple:repositories.bzl",
"apple_rules_dependencies",
)
apple_rules_dependencies()
load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)
swift_rules_dependencies()
load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)
swift_rules_extra_dependencies()
http_archive(
name = "SwiftLint",
sha256 = "ee13554c48ca7845513ae307863525afbb5b8f22d4c3b34b5b2e87311c3d5e26",
url = "https://github.com/realm/SwiftLint/releases/download/0.50.0-rc.1/bazel.tar.gz",
)
load("@SwiftLint//bazel:repos.bzl", "swiftlint_repos")
swiftlint_repos()
load("@SwiftLint//bazel:deps.bzl", "swiftlint_deps")
swiftlint_deps()
Then you can run SwiftLint in the current directory with this command:
bazel run @SwiftLint//:swiftlint -- --help
1、 bazel.tar.gz 391.83KB
2、 bazel.tar.gz.sha256 116B
3、 portable_swiftlint.zip 11.15MB
4、 SwiftLint.pkg 11.16MB
5、 SwiftLintBinary-macos.artifactbundle.zip 11.15MB
6、 swiftlint_linux.zip 36.1MB