Releases: realm/SwiftLint
0.50.3: Bundle of Towels
Breaking
- None.
Experimental
- None.
Enhancements
-
The
SwiftLintPlugin
SwiftPM plugin now uses a prebuilt binary on
macOS.
Tony Arnold
JP Simard
#4558 -
Don't trigger
shorthand_operator
violations inside a shorthand
operator function declaration.
Marcelo Fabri
#4611 -
The
balanced_xctest_lifecycle
,single_test_class
,
empty_xctest_method
andtest_case_accessibility
rules will now be
applied to subclasses ofQuickSpec
, as well asXCTestCase
, by
default.
Martin Redington -
Add
test_parent_classes
option tobalanced_xctest_lifecycle
,
single_test_class
andempty_xctest_method
rules.
Martin Redington
#4200 -
Show warnings in the console for Analyzer rules that are listed in the
opt_in_rules
configuration section.
SimplyDanny
#4612
Bug Fixes
-
Fix configuration parsing error in
unused_declaration
rule.
SimplyDanny
#4612 -
Skip
defer
statements being last in an#if
block if the#if
statement is not itself the last statement in a block.
SimplyDanny
#4615 -
Fix false positives in
empty_enum_arguments
when the called
expression is an identifier or an init call.
Steffen Matthischke
#4597 -
Fix correction issue in
comma
when there was too much whitespace
following the comma.
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 = "f94e6dddf74739ef5cb30f000e13a2a613f6ebfa5e63588305a71fce8a8a9911",
url = "https://github.com/bazelbuild/rules_apple/releases/download/1.1.3/rules_apple.1.1.3.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 = "b8c4d765bcd8b533fcc2e15f32482a1a17572f143b65af388f7d5ac99994a99a",
url = "https://github.com/realm/SwiftLint/releases/download/0.50.3/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 -c opt @SwiftLint//:swiftlint -- --help
0.50.1: Artisanal Clothes Pegs Fixup Edition
Breaking
- None.
Experimental
- None.
Enhancements
-
Moved the validation of doc comments in local scopes out of
orphaned_doc_comment
and into a new opt-inlocal_doc_comment
rule.
JP Simard
#4573 -
SwiftLint's Swift Package Build Tool Plugin will now only scan files
in the target being built.
Tony Arnold
#4406
Bug Fixes
-
Fix building with
swift build -c release
.
JP Simard
#4559
#4560 -
Fix false positives in
lower_acl_than_parent
when the nominal parent
is an extension.
Steffen Matthischke
#4564 -
Fix
minimum_fraction_length
handling innumber_separator
.
JP Simard
#4576 -
Fix false positives in
closure_spacing
.
JP Simard
#4565
#4582 -
Fix line count calculation for multiline string literals.
JP Simard
#4585 -
Fix false positives in
unused_closure_parameter
when using
identifiers with backticks.
JP Simard
#4588 -
Fix
type_name
regression where names with backticks would trigger
violations.
JP Simard
#4571
0.50.0: Artisanal Clothes Pegs
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 -
Built-in SwiftLint rules are no longer marked as
public
in
SwiftLintFramework. This only impacts the programmatic API for the
SwiftLintFramework module.
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 -
Rewrite some rules with SwiftSyntax, fixing some false positives and catching
more violations:anonymous_argument_in_multiline_closure
array_init
attributes
balanced_xctest_lifecycle
block_based_kvo
class_delegate_protocol
closing_brace
closure_body_length
closure_parameter_position
collection_alignment
comment_spacing
computed_accessors_order
conditional_returns_on_newline
contains_over_filter_count
contains_over_filter_is_empty
contains_over_first_not_nil
contains_over_range_nil_comparison
convenience_type
deployment_target
discarded_notification_center_observer
discouraged_assert
discouraged_direct_init
discouraged_none_name
discouraged_object_literal
discouraged_optional_boolean
duplicate_enum_cases
duplicated_key_in_dictionary_literal
dynamic_inline
empty_collection_literal
empty_count
empty_enum_arguments
empty_parameters
empty_parentheses_with_trailing_closure
empty_string
enum_case_associated_values_count
explicit_enum_raw_value
explicit_init
explicit_top_level_acl
fallthrough
file_name
first_where
flatmap_over_map_reduce
for_where
force_try
force_unwrapping
function_body_length
function_default_parameter_at_end
function_parameter_count
generic_type_name
ibinspectable_in_extension
identical_operands
implicit_getter
implicitly_unwrapped_optional
inclusive_language
inert_defer
is_disjoint
joined_default_parameter
large_tuple
last_where
legacy_cggeometry_functions
legacy_constant
legacy_constructor
legacy_hashing
legacy_multiple
legacy_nsgeometry_functions
legacy_objc_type
legacy_random
lower_acl_than_parent
multiline_arguments_brackets
multiline_parameters
multiple_closures_with_trailing_closure
no_extension_access_modifier
no_fallthrough_only
no_space_in_method_call
notification_center_detachment
nslocalizedstring_key
nslocalizedstring_require_bundle
nsobject_prefer_isequal
number_separator
object_literal
operator_whitespace
optional_enum_case_matching
orphaned_doc_comment
overridden_super_call
override_in_extension
pattern_matching_keywords
prefer_nimble
prefer_self_in_static_references
prefer_self_type_over_type_of_self
prefer_zero_over_explicit_init
prefixed_toplevel_constant
private_action
private_outlet
private_over_fileprivate
private_subject
private_unit_test
prohibited_interface_builder
prohibited_super_call
protocol_property_accessors_order
quick_discouraged_focused_test
quick_discouraged_pending_test
raw_value_for_camel_cased_codable_enum
reduce_boolean
reduce_into
redundant_discardable_let
redundant_nil_coalescing
redundant_objc_attribute
redundant_optional_initialization
redundant_set_access_control
redundant_string_enum_value
required_deinit
required_enum_case
return_arrow_whitespace
self_in_property_initialization
shorthand_operator
single_test_class
sorted_first_last
static_operator
strict_fileprivate
strong_iboutlet
switch_case_alignment
switch_case_on_newline
test_case_accessibility
toggle_bool
trailing_comma
trailing_semicolon
type_body_length
type_name
unneeded_break_in_switch
unneeded_parentheses_in_closure_argument
unowned_variable_capture
untyped_error_in_catch
unused_capture_list
unused_closure_parameter
unused_control_flow_label
unused_enumerated
unused_optional_binding
unused_setter_value
valid_ibinspectable
vertical_parameter_alignment
weak_delegate
xct_specific_matcher
xctfail_message
Marcelo Fabri
SimplyDanny
JP Simard
#2915
-
The "body length" family of rules have changed how they calculate body
line count to be significantly more correct and intuitive. However,
this is likely to require adjustments to your configuration or disable
commands to account for the changes.
JP Simard -
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 -
Add new
ns_number_init_as_function_reference
rule to catchNSNumber.init
andNSDecimalNumber.init
being used as function references since it
can cause the wrong initializer to be used, causing crashes. See
swiftlang/swift#51036 for more info.
Marcelo Fabri -
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 -
The
self_binding
rule now catches shorthand optional bindings (for example
if let self {}
) when using abind_identifier
different thanself
.
Marcelo Fabri -
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
shorthand_optional_binding
opt-in rule that triggers in Swift 5.7
when a shadowing optional binding is created in anif
orguard
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 -
Disregard whitespace differences in
identical_operands
rule. That is, the rule
now also triggers if the left-hand side and the right-hand side of an operation
only differ in trivia.
SimplyDanny -
Print violations in realtime if
--progress
and--output
are both set.
JP Simard -
Trigger
prefer_self_in_static_references
rule on more type references like:- Key paths (e.g.
\MyType.myVar
->\Self.myVar
) - Computed properties (e.g.
var i: Int { MyType.myVar )
->var i: Int { Self.myVar }
) - Constructor calls (e.g.
MyType()
->Self()
)
- Key paths (e.g.
-
Update
for_where
rule, adding a new configuration
allow_for_as_filter
to allow usingfor in
with a singleif
inside
when there's areturn
statement inside theif
's body.
Marcelo Fabri
#4040 -
`quick_disco...
0.50.0-rc.4: Artisanal Clothes Pegs
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/[email protected]
- Cloning and building from source:
git clone https://github.com/realm/SwiftLint.git && cd SwiftLint && git checkout 0.50.0-rc.4 && make install
- Docker:
docker run -it -v `pwd`:`pwd` -w `pwd` ghcr.io/realm/swiftlint:0.50.0-rc.4
- Bazel: See instructions at the bottom
Changes from 0.49.1: 0.49.1...0.50.0-rc.4
Changes from 0.50.0-rc.3: 0.50.0-rc.3...0.50.0-rc.4
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
-
Adds
NSError
to the list of types indiscouraged_direct_init
.
jszumski
#4508 -
Fix SwiftLint support on Xcode Cloud.
JagCesar
westerlund
#4484 -
Add
no_magic_numbers
rule to avoid "Magic Numbers".
Henrik Storch
#4031 -
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 -
Add new
ns_number_init_as_function_reference
rule to catchNSNumber.init
andNSDecimalNumber.init
being used as function references since it
can cause the wrong initializer to be used, causing crashes. See
swiftlang/swift#51036 for more info.
Marcelo Fabri -
Rewrite some rules with SwiftSyntax, fixing some false positives and catching
more violations:anonymous_argument_in_multiline_closure
array_init
attributes
block_based_kvo
class_delegate_protocol
closing_brace
closure_body_length
closure_parameter_position
collection_alignment
comment_spacing
computed_accessors_order
conditional_returns_on_newline
contains_over_filter_count
contains_over_filter_is_empty
contains_over_first_not_nil
contains_over_range_nil_comparison
convenience_type
deployment_target
discarded_notification_center_observer
discouraged_assert
discouraged_direct_init
discouraged_none_name
discouraged_object_literal
discouraged_optional_boolean
duplicate_enum_cases
duplicated_key_in_dictionary_literal
dynamic_inline
empty_collection_literal
empty_count
empty_enum_arguments
empty_parameters
empty_parentheses_with_trailing_closure
empty_string
enum_case_associated_values_count
explicit_enum_raw_value
explicit_init
explicit_top_level_acl
fallthrough
file_name
first_where
flatmap_over_map_reduce
for_where
force_try
force_unwrapping
function_body_length
function_default_parameter_at_end
function_parameter_count
generic_type_name
ibinspectable_in_extension
identical_operands
implicit_getter
implicitly_unwrapped_optional
inclusive_language
inert_defer
is_disjoint
joined_default_parameter
large_tuple
last_where
legacy_cggeometry_functions
legacy_constant
legacy_constructor
legacy_hashing
legacy_multiple
legacy_nsgeometry_functions
legacy_objc_type
legacy_random
lower_acl_than_parent
multiline_arguments_brackets
multiline_parameters
multiple_closures_with_trailing_closure
no_extension_access_modifier
no_fallthrough_only
no_space_in_method_call
notification_center_detachment
nslocalizedstring_require_bundle
nsobject_prefer_isequal
number_separator
operator_whitespace
optional_enum_case_matching
orphaned_doc_comment
overridden_super_call
override_in_extension
prefer_nimble
prefer_self_type_over_type_of_self
prefer_zero_over_explicit_init
prefixed_toplevel_constant
private_action
private_outlet
private_over_fileprivate
private_subject
private_unit_test
prohibited_interface_builder
prohibited_super_call
protocol_property_accessors_order
quick_discouraged_focused_test
quick_discouraged_pending_test
raw_value_for_camel_cased_codable_enum
reduce_boolean
reduce_into
redundant_discardable_let
redundant_nil_coalescing
redundant_objc_attribute
redundant_optional_initialization
redundant_set_access_control
redundant_string_enum_value
required_deinit
return_arrow_whitespace
self_in_property_initialization
shorthand_operator
single_test_class
sorted_first_last
static_operator
strict_fileprivate
strong_iboutlet
switch_case_alignment
switch_case_on_newline
test_case_accessibility
toggle_bool
trailing_comma
trailing_semicolon
type_body_length
type_name
unneeded_break_in_switch
unneeded_parentheses_in_closure_argument
unowned_variable_capture
untyped_error_in_catch
unused_capture_list
unused_closure_parameter
unused_control_flow_label
unused_enumerated
unused_optional_binding
unused_setter_value
valid_ibinspectable
vertical_parameter_alignment
weak_delegate
xct_specific_matcher
xctfail_message
Marcelo Fabri
SimplyDanny
JP Simard
#2915
-
The "body length" family of rules have changed how they calculate body
line count to be significantly more correct and intuitive. However,
this is likely to require adjustments to your configuration or disable
commands to account for the changes.
JP Simard -
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
shorthand_optional_binding
opt-in rule that triggers in Swift 5.7
when a shadowing optional binding is created in anif
orguard
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 -
Disregard whitespace differences in
identical_operands
rule. That is, the rule
now also triggers if the left-hand side and the right-h...
0.50.0-rc.3: Artisanal Clothes Pegs
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/[email protected]
- Cloning and building from source:
git clone https://github.com/realm/SwiftLint.git && cd SwiftLint && git checkout 0.50.0-rc.3 && make install
- Docker:
docker run -it -v `pwd`:`pwd` -w `pwd` ghcr.io/realm/swiftlint:0.50.0-rc.3
- Bazel: See instructions at the bottom
Changes from 0.49.1: 0.49.1...0.50.0-rc.3
Changes from 0.50.0-rc.2: 0.50.0-rc.2...0.50.0-rc.3
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 -
Add new
ns_number_init_as_function_reference
rule to catchNSNumber.init
andNSDecimalNumber.init
being used as function references since it
can cause the wrong initializer to be used, causing crashes. See
swiftlang/swift#51036 for more info.
Marcelo Fabri -
Rewrite some rules with SwiftSyntax, fixing some false positives and catching
more violations:anonymous_argument_in_multiline_closure
array_init
attributes
block_based_kvo
class_delegate_protocol
closing_brace
closure_body_length
closure_parameter_position
collection_alignment
comment_spacing
computed_accessors_order
conditional_returns_on_newline
contains_over_filter_count
contains_over_filter_is_empty
contains_over_first_not_nil
contains_over_range_nil_comparison
convenience_type
deployment_target
discarded_notification_center_observer
discouraged_assert
discouraged_direct_init
discouraged_none_name
discouraged_object_literal
discouraged_optional_boolean
duplicate_enum_cases
duplicated_key_in_dictionary_literal
dynamic_inline
empty_collection_literal
empty_count
empty_enum_arguments
empty_parameters
empty_parentheses_with_trailing_closure
empty_string
enum_case_associated_values_count
explicit_enum_raw_value
explicit_init
explicit_top_level_acl
fallthrough
file_name
first_where
flatmap_over_map_reduce
for_where
force_try
force_unwrapping
function_body_length
function_default_parameter_at_end
function_parameter_count
generic_type_name
ibinspectable_in_extension
identical_operands
implicit_getter
implicitly_unwrapped_optional
inclusive_language
inert_defer
is_disjoint
joined_default_parameter
large_tuple
last_where
legacy_cggeometry_functions
legacy_constant
legacy_constructor
legacy_hashing
legacy_multiple
legacy_nsgeometry_functions
legacy_objc_type
legacy_random
lower_acl_than_parent
multiple_closures_with_trailing_closure
multiline_parameters
no_extension_access_modifier
no_fallthrough_only
no_space_in_method_call
notification_center_detachment
nslocalizedstring_require_bundle
nsobject_prefer_isequal
number_separator
operator_whitespace
override_in_extension
nsobject_prefer_isequal
prefer_nimble
prefer_self_type_over_type_of_self
prefer_zero_over_explicit_init
prefixed_toplevel_constant
private_action
private_over_fileprivate
private_outlet
private_unit_test
prohibited_interface_builder
protocol_property_accessors_order
quick_discouraged_focused_test
quick_discouraged_pending_test
raw_value_for_camel_cased_codable_enum
reduce_boolean
reduce_into
redundant_discardable_let
redundant_nil_coalescing
redundant_objc_attribute
redundant_set_access_control
redundant_optional_initialization
redundant_string_enum_value
required_deinit
return_arrow_whitespace
self_in_property_initialization
shorthand_operator
single_test_class
sorted_first_last
static_operator
strict_fileprivate
strong_iboutlet
switch_case_alignment
switch_case_on_newline
test_case_accessibility
toggle_bool
trailing_comma
trailing_semicolon
type_body_length
type_name
unneeded_break_in_switch
unneeded_parentheses_in_closure_argument
unowned_variable_capture
untyped_error_in_catch
unused_capture_list
unused_closure_parameter
unused_control_flow_label
unused_enumerated
unused_optional_binding
unused_setter_value
valid_ibinspectable
vertical_parameter_alignment
weak_delegate
xct_specific_matcher
xctfail_message
Marcelo Fabri
SimplyDanny
JP Simard
#2915
-
The "body length" family of rules have changed how they calculate body
line count to be significantly more correct and intuitive. However,
this is likely to require adjustments to your configuration or disable
commands to account for the changes.
JP Simard -
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
shorthand_optional_binding
opt-in rule that triggers in Swift 5.7
when a shadowing optional binding is created in anif
orguard
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 -
Disregard whitespace differences in
identical_operands
rule. That is, the rule
now also triggers if the left-hand side and the right-hand side of an operation
only differ in trivia.
SimplyDanny -
Print violations in realtime if
--progress
and--output
are both set.
JP Simard -
Update
for_where
rule, adding a new configuration
allow_for_as_filter
to allow usingfor in
with a singleif
inside
when there's areturn
statement inside theif
's body.
Marcelo Fabri
#4040 -
quick_discouraged_call
,quick_discouraged_focused_test
and
quick_discouraged_pending_test
rules now trigger on subclasses of
QuickSpec
.
[Ma...
0.50.0-rc.2: Artisanal Clothes Pegs
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/[email protected]
- Cloning and building from source:
git clone https://github.com/realm/SwiftLint.git && cd SwiftLint && git checkout 0.50.0-rc.2 && make install
- Docker:
docker run -it -v `pwd`:`pwd` -w `pwd` ghcr.io/realm/swiftlint:0.50.0-rc.2
- Bazel: See instructions at the bottom
Changes from 0.49.1: 0.49.1...0.50.0-rc.2
Changes from 0.50.0-rc.1: 0.50.0-rc.1...0.50.0-rc.2
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
attributes
block_based_kvo
class_delegate_protocol
closing_brace
closure_body_length
closure_parameter_position
computed_accessors_order
conditional_returns_on_newline
contains_over_filter_count
contains_over_filter_is_empty
contains_over_first_not_nil
contains_over_range_nil_comparison
deployment_target
discouraged_assert
discouraged_direct_init
discouraged_none_name
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
enum_case_associated_values_count
explicit_enum_raw_value
explicit_init
fallthrough
first_where
flatmap_over_map_reduce
force_try
force_unwrapping
function_body_length
function_default_parameter_at_end
function_parameter_count
generic_type_name
ibinspectable_in_extension
identical_operands
implicit_getter
implicitly_unwrapped_optional
inert_defer
is_disjoint
large_tuple
last_where
legacy_cggeometry_functions
legacy_constant
legacy_constructor
legacy_hashing
legacy_multiple
legacy_nsgeometry_functions
legacy_random
multiple_closures_with_trailing_closure
no_extension_access_modifier
no_fallthrough_only
no_space_in_method_call
nslocalizedstring_require_bundle
nsobject_prefer_isequal
number_separator
operator_whitespace
nsobject_prefer_isequal
private_action
private_over_fileprivate
private_outlet
private_unit_test
prohibited_interface_builder
protocol_property_accessors_order
quick_discouraged_focused_test
quick_discouraged_pending_test
reduce_boolean
redundant_discardable_let
redundant_nil_coalescing
redundant_string_enum_value
self_in_property_initialization
shorthand_operator
sorted_first_last
static_operator
strict_fileprivate
strong_iboutlet
switch_case_alignment
switch_case_on_newline
toggle_bool
trailing_comma
trailing_semicolon
type_body_length
unneeded_break_in_switch
unneeded_parentheses_in_closure_argument
unowned_variable_capture
untyped_error_in_catch
unused_closure_parameter
unused_control_flow_label
unused_enumerated
unused_setter_value
valid_ibinspectable
weak_delegate
xctfail_message
Marcelo Fabri
SimplyDanny
JP Simard
#2915
-
The "body length" family of rules have changed how they calculate body
line count to be significantly more correct and intuitive. However,
this is likely to require adjustments to your configuration or disable
commands to account for the changes.
JP Simard -
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
shorthand_optional_binding
opt-in rule that triggers in Swift 5.7
when a shadowing optional binding is created in anif
orguard
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 -
Disregard whitespace differences in
identical_operands
rule. That is, the rule
now also triggers if the left-hand side and the right-hand side of an operation
only differ in trivia.
SimplyDanny -
Print violations in realtime if
--progress
and--output
are both set.
JP Simard
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 in
type_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 -
Make
nsobject_prefer_isequal
rule work for nested@objc
classes. Also consider
the@objcMembers
annotation.
SimplyDanny -
Print fixed content at most once to STDOUT.
SimplyDanny
#4211 -
Fix fatal error when content given via STDIN is corrected in the
trailing_newline
rule.
SimplyDanny
#4234
Using Bazel
Put this in your WORKSPACE
:
...
0.50.0-rc.1: Artisanal Clothes Pegs
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/[email protected]
- 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: 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 in
type_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
0.49.1: Buanderie Principale
Note: The default branch for the SwiftLint git repository was renamed from
master
to main
on September 1st. Please update any code or automation
accordingly.
Breaking
- None.
Experimental
- None.
Enhancements
-
Add new
self_binding
opt-in rule to enforce thatself
identifiers are
consistently re-bound to a common identifier name. Configurebind_identifier
to the name you want to use. Defaults toself
.
JP Simard
#2495 -
Add
--output
option to lint and analyze commands to write to a file instead
of to stdout.
JP Simard
#4048 -
Add
--progress
flag to lint and analyze commands to show a live-updating
progress bar instead of each file being processed.
JP Simard -
--fix
now works with--use-stdin
, printing the output to to STDOUT instead
of crashing.
SimplyDanny
#4127
Bug Fixes
-
Migrate
empty_xctest_method
rule to SwiftSyntax fixing some false positives.
SimplyDanny
#3647
#3691 -
Fix false positives in
redundant_discardable_let
when using
async let
.
Martin Hosna
#4142 -
Consistently print error/info messages to stderr instead of stdout,
which wasn't being done for errors regarding remote configurations.
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 = "f003875c248544009c8e8ae03906bbdacb970bc3e5931b40cd76cadeded99632",
url = "https://github.com/bazelbuild/rules_apple/releases/download/1.1.0/rules_apple.1.1.0.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 = "7c454ff4abeeecdd9513f6293238a6d9f803b587eb93de147f9aa1be0d8337c4",
url = "https://github.com/realm/SwiftLint/releases/download/0.49.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
0.49.0: Asynchronous Defuzzer
Note: The default branch for the SwiftLint git repository will be renamed from
master
to main
on September 1st. Please update any code or automation
accordingly.
Breaking
-
SwiftLint now requires Swift 5.6 or higher to build, and macOS 12
or higher to run.
JP Simard -
Code Climate reports now use SHA256 strings as the issue fingerprint
values.
JP Simard -
Make
comma_inheritance
an opt-in rule.
Steve Madsen
#4027 -
The
autocorrect
command that was deprecated in 0.43.0 has now been
completely removed. Use--fix
instead.
JP Simard -
Remove the
AutomaticTestableRule
protocol. All examples listed in rules are
now tested automatically to make sure they are correct.
SimplyDanny -
Deprecate the
--in-process-sourcekit
command line flag. SwiftLint now always
uses an in-process SourceKit.
JP Simard
Experimental
- None.
Enhancements
-
Make
duplicate_imports
rule correctable. Fixduplicate_imports
rule
reporting redundant violations when more than one duplicate is present.
Timofey Solonin -
Support for building SwiftLint with bazel.
JP Simard -
Support for writing custom private native rules when building with
bazel.
JP Simard
Keith Smiley
#3516 -
Make
comma
rule about 10x faster, finding some previously missed cases and
fixing some previously wrong corrections.
JP Simard -
Make
colon
rule about 7x faster, finding some previously missed cases.
JP Simard -
Make
closure_spacing
rule about 9x faster, finding some previously missed
cases and fixing some previously wrong corrections.
JP Simard
SimplyDanny
#4090 -
Introduce new configuration option
include_compiler_directives
(true
by
default) for theindentation_width
rule that allows to ignore compiler
directives in the indentation analysis. This is especially useful if one (or
a formatter) prefers to have compiler directives always at the very beginning
of a line.
SimplyDanny
#4030 -
Enable (recursive) globs in
included
file paths.
sarastro-nl -
Custom rules are now broken down per rule instead of in aggregate in
--benchmark
.
JP Simard -
The
version
command now has an optional--verbose
flag that prints out the
full version info, notably the build ID, which can be used to determine if two
swiftlint
executables are identical.
JP Simard -
Update documentation for
multiline_arguments_brackets
and
multiline_literal_brackets
to make it immediately obvious that common
examples will trigger.
chrisjf
#4060 -
The
--compile-commands
argument can now parse SwiftPM yaml files produced
when runningswift build
at.build/{debug,release}.yaml
.
JP Simard -
Add new configuration option
allowed_no_space_operators
to
operator_usage_whitespace
rule. It allows to specify custom operators which
shall not be considered by the rule.
imben123 -
Add new protocols to remove some boilerplate involved in writing
SwiftSyntax-based rules.
JP Simard
Bug Fixes
-
Fix false positive in
self_in_property_initialization
rule when using
closures insidedidSet
and other accessors.
Marcelo Fabri
#4041 -
Fix false positive in
Duplicated Key in Dictionary Literal Violation
rule
when using keys that are generated at runtime with the same source code.
OrEliyahu
#4012 -
Fix false positive in
yoda_condition
rule by basing it on SwiftSyntax.
SimplyDanny
#4081 -
Fix false negatives in
first_where
rule when filtering array of dictionaries
with String keys.
KS1019 -
Fix broken correction for
explicit_init
rule.
KS1019
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 = "f003875c248544009c8e8ae03906bbdacb970bc3e5931b40cd76cadeded99632",
url = "https://github.com/bazelbuild/rules_apple/releases/download/1.1.0/rules_apple.1.1.0.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 = "ec566314e9220ff681ddb639d3a0532834f66f7e733f5a59c7390469dcb5bd3e",
url = "https://github.com/realm/SwiftLint/releases/download/0.49.0/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
0.49.0-rc.2: Asynchronous Defuzzer
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/[email protected]
- Cloning and building from source:
git clone https://github.com/realm/SwiftLint.git && cd SwiftLint && git checkout 0.49.0-rc.2 && make install
- Docker:
docker run -it -v `pwd`:`pwd` -w `pwd` ghcr.io/realm/swiftlint:0.49.0-rc.2
- Bazel: See instructions at the bottom
Changes from 0.48.0: 0.48.0...0.49.0-rc.2
Changes from 0.49.0-rc.1: 0.49.0-rc.1...0.49.0-rc.2
Note: The default branch for the SwiftLint git repository will be renamed from
master
to main
on September 1st. Please update any code or automation
accordingly.
Breaking
-
SwiftLint now requires Swift 5.6 or higher to build, and macOS 12
or higher to run.
JP Simard -
Code Climate reports now use SHA256 strings as the issue fingerprint
values.
JP Simard -
Make
comma_inheritance
an opt-in rule.
Steve Madsen
#4027 -
The
autocorrect
command that was deprecated in 0.43.0 has now been
completely removed. Use--fix
instead.
JP Simard -
Remove the
AutomaticTestableRule
protocol. All examples listed in rules are
now tested automatically to make sure they are correct.
SimplyDanny -
Deprecate the
--in-process-sourcekit
command line flag. SwiftLint now always
uses an in-process SourceKit.
JP Simard
Experimental
- None.
Enhancements
-
Make
duplicate_imports
rule correctable. Fixduplicate_imports
rule
reporting redundant violations when more than one duplicate is present.
Timofey Solonin -
Support for building SwiftLint with bazel.
JP Simard -
Support for writing custom private native rules when building with
bazel.
JP Simard
Keith Smiley
#3516 -
Make
comma
rule about 10x faster, finding some previously missed cases and
fixing some previously wrong corrections.
JP Simard -
Make
colon
rule about 7x faster, finding some previously missed cases.
JP Simard -
Make
closure_spacing
rule about 9x faster, finding some previously missed
cases and fixing some previously wrong corrections.
JP Simard
SimplyDanny
#4090 -
Introduce new configuration option
include_compiler_directives
(true
by
default) for theindentation_width
rule that allows to ignore compiler
directives in the indentation analysis. This is especially useful if one (or
a formatter) prefers to have compiler directives always at the very beginning
of a line.
SimplyDanny
#4030 -
Enable (recursive) globs in
included
file paths.
sarastro-nl -
Custom rules are now broken down per rule instead of in aggregate in
--benchmark
.
JP Simard -
The
version
command now has an optional--verbose
flag that prints out the
full version info, notably the build ID, which can be used to determine if two
swiftlint
executables are identical.
JP Simard -
Update documentation for
multiline_arguments_brackets
and
multiline_literal_brackets
to make it immediately obvious that common
examples will trigger.
chrisjf
#4060
Bug Fixes
-
Fix false positive in
self_in_property_initialization
rule when using
closures insidedidSet
and other accessors.
Marcelo Fabri
#4041 -
Fix false positive in
Duplicated Key in Dictionary Literal Violation
rule
when using keys that are generated at runtime with the same source code.
OrEliyahu
#4012 -
Fix false positive in
yoda_condition
rule by basing it on SwiftSyntax.
SimplyDanny
#4081 -
Fix false negatives in
first_where
rule when filtering array of dictionaries
with String keys.
KS1019 -
Fix broken correction for
explicit_init
rule.
KS1019
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 = "36072d4f3614d309d6a703da0dfe48684ec4c65a89611aeb9590b45af7a3e592",
url = "https://github.com/bazelbuild/rules_apple/releases/download/1.0.1/rules_apple.1.0.1.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 = "d34bf123e6380a7527ee78c5f6ec7ede5e00e8c39a9c3b394f590374f566c57d",
url = "https://github.com/realm/SwiftLint/releases/download/0.49.0-rc.2/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