0.53.0: Laundry List
Breaking
-
Hide all
Reporter
s from SwiftLint's' public interface.
SimplyDanny -
The options
inlcuded
,name
andmessage
are from now on ignored in the
configuration for theprivate_unit_test
rule. The optionregex
is still
supported but is deprecated. It's recommended to use the list
test_parent_classes
instead which accepts names of parent test classes.
SimplyDanny -
Remove support for disable and enable commands in multiline comments.
Martin Redington
#4798
Experimental
- None.
Enhancements
-
Show specific violation message for the
attributes
rule when the option
always_on_line_above
orattributes_with_arguments_always_on_line_above
is involved.
chrisngabp
5103 -
Rewrite
control_statement
rule using SwiftSyntax.
SimplyDanny -
Add new
non_overridable_class_declaration
rule that triggers onclass
function and variable declarations in final classes that are not final
themselves or private.
SimplyDanny -
The Homebrew formula for SwiftLint now also installs completion scripts for
Bash, Zsh and fish.
SimplyDanny -
Add new
private_swiftui_state_property
opt-in rule to encourage setting
SwiftUI@State
and@StateObject
properties to private.
mt00chikin
#3173 -
The
implicit_return
rule now supports the kindssubscript
and
initializer
in theincluded
configuration list.
SimplyDanny -
Add
unneeded_override
rule to remove function overrides that only
call super.
keith
5139 -
Show a rule's active YAML configuration in output of
swiftlint rules <rule>
.
SimplyDanny -
Add
invokeTest()
tooverridden_super_call
defaults.
DylanBettermannDD -
Add
--config-only
option torules
command allowing to print only the YAML
configuration of a single or all rules.
SimplyDanny -
Add
--default-config
option torules
command allowing to use default
values for configurations being printed for a single rule or all rules.
SimplyDanny -
Add
include_bare_init
option to theexplicit_init
rule.include_bare_init
encourages using named constructors over.init()
and type inference.
Martin Redington
#5203 -
Improved the reported location and reasons provided for issues
detected by theinvalid_seiftlint_command
rule.
Martin Redington
#5204 -
100 is no longer considered to be a magic number by the
no_magic_numbers
rule.
Martin Redington
#5215 -
Adds a
strict
configuration file setting, equivalent to the--strict
command line option.
Martin Redington
#5226 -
Extend
implicitly_unwrapped_optional
rule with the new mode
weak_except_iboutlets
that only checksweak
variables.
Ricky Tan
Bug Fixes
-
Respect grapheme clusters in counting the number of characters in the
collection_alignment
rule.
kishikawakatsumi
#4837 -
Fix false positive in
control_statement
rule that triggered on conditions
with trailing closures where parentheses are recommended by the compiler.
SimplyDanny
#5135 -
Fix runtime error when an excluded directory does not exist.
SimplyDanny
#5078 -
Support
switch
expressions used in expression contexts in
switch_case_alignment
rule.
SimplyDanny
#5191
#5227
#5080 -
Fix bug in
prefer_self_in_static_references
rule that triggered on
initializers of computed properties in classes when the property had an
accessor block.
SimplyDanny
#5118 -
Document
exclude_ranges
option fornumber_separator
rule.
SimplyDanny -
Rewrite
implicit_return
rule with SwiftSyntax fixing a few false positives
and false negatives in the process.
SimplyDanny
#5161 -
Make sure
severity
is configurable fortype_contents_order
rule.
SimplyDanny -
Bazel: Mark
rules_xcodeproj
as a development dependency.
Thi Doãn
JP Simard
#4737 -
Fix false negatives for the
unneeded_synthesized_initializer
rule
for nested structs in classes.
Martin Redington
#5120 -
Fix some unexpected rule enablement interactions between parent and
child configurations.
Martin Redington
#4876 -
The
no_magic_numbers
rule will not trigger for violations in an
extension, if the extended class inherits from one of the specified
test_parent_classes
, as long as the class declaration and the
extension are in the same source file.
Martin Redington
#5137 -
Fix false positive in the
ns_number_init_as_function_reference
rule
when callingNSNumber.init(value:)
directly.
Marcelo Fabri
#5172 -
The
no_magic_numbers
rule will not trigger for bitwise shift
operations.
Martin Redington
#5171 -
The
accessibility_label_for_image
rule will no longer ignore the
Image(systemName:)
constructor, as many system images do not
have good accessibility labels.
Martin Redington
#5165 -
Fix false positives for
superfluous_disable_command
rule.
Martin Redington
#4798 -
Fix false positive in the
test_case_accessibility
rule.
gibachan
#5211
Using Bazel
With bzlmod:
// Pending BCR update
bazel_dep(name = "swiftlint", version = "0.53.0", repo_name = "SwiftLint")
Without bzlmod, 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 = "9e26307516c4d5f2ad4aee90ac01eb8cd31f9b8d6ea93619fc64b3cbc81b0944",
url = "https://github.com/bazelbuild/rules_apple/releases/download/2.2.0/rules_apple.2.2.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 = "75839dc9e8a492a86bb585a3cda3d73b58997d7a14d02f1dba94171766bb8599",
url = "https://github.com/realm/SwiftLint/releases/download/0.53.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