Releases: realm/SwiftLint
0.61.0: Even Fresher Breeze
Breaking
-
If
SWIFTLINT_DISABLE_SOURCEKIT
is set to prohibit loadinglibsourcekitdInProc
at runtime,
rules requiring SourceKit will be disabled and a warning will be printed once per rule.
SimplyDanny -
The
operator_whitespace
rule has been removed and its functionality merged into the
function_name_whitespace
rule. The latter now also checks spacing around thefunc
keyword, the function name/operator and its generic parameters while respecting comments.
On top of that, it supports autocorrection.
SimplyDanny -
Expose only
TestHelpers
andExtraRulesTests
as part of Bazel releases.
SimplyDanny
Experimental
- Both Linux release archives (for AMD64 and ARM64) now contain two binaries:
- A dynamically linked binary that requires
libsourcekitdInProc.so
together with its
transitive dependencies to be present on the system at runtime. It is namedswiftlint
and the same binary as before. It supports all built-in rules. - A fully statically linked binary named
swiftlint-static
that does not require
any dynamic libraries at runtime. Rules requiring SourceKit will be disabled and
reported to the console when running this binary.
- A dynamically linked binary that requires
Enhancements
-
A fully statically linked Linux binary can now be built with the Swift SDK and
the compiler options-Xswiftc -DSWIFTLINT_DISABLE_SOURCEKIT
. This binary does not
requirelibsourcekitdInProc.so
or any other dynamic libraries to be present on the
system at runtime. Rules requiring SourceKit will be disabled and reported to the console
when running this binary.
SimplyDanny -
Add
function_name_whitespace
rule to enforce consistent spacing between thefunc
keyword, function name, and its generic parameters. Ensures exactly one space between
func
and the function name, and configurable spacing around generics via
generic_spacing
:no_space
(default):func name<T>()
leading_space
:func name <T>()
trailing_space
:func name<T> ()
leading_trailing_space
:func name <T> ()
Supports autocorrection.
GandaLF2006 -
The
operator_whitespace
rule now supports autocorrection and better respects comments in
function declarations. The rule has been deprecated in favor of the newfunction_name_whitespace
rule. You can still refer to it by its identifier, but get checking for normal function names
on top.
SimplyDanny -
In
line_length
rule, treat strings with opening and closing quotes in the same line as
single-line strings no matter if they are enclosed by triple quotes or not. Furthermore,
improve detection of comment-only lines.
SimplyDanny
#6220
#6219 -
Improve detection of comment-only lines in
file_length
rule.
SimplyDanny
#6219 -
Rewrite
quick_discouraged_call
rule with SwiftSyntax.
SimplyDanny
Bug Fixes
-
Ensure that header matched against always end in a newline in
file_header
rule.
SimplyDanny
#6227 -
Fix
closure_end_indentation
rule reporting violations when the called base
involves chained optional expressions.
SimplyDanny
#6216
Using Bazel
With bzlmod:
// Pending BCR update
bazel_dep(name = "swiftlint", version = "0.61.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 = "ee8ca2eeb93b8f294a8ca2d76fead1a6510b4d40421b39b0bf88b73f7182c313",
url = "https://github.com/realm/SwiftLint/releases/download/0.61.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.60.0: Fresh Breeze
Breaking
-
Remove support for boolean values in the
validates_start_with_lowercase
option entirely.
Use the severity levelsoff
,warning
orerror
instead.
kaseken -
SwiftLint now requires macOS 13 or higher to run.
JP Simard -
In
SwiftLintBuildToolPlugin
, print the content of theBUILD_WORKSPACE_DIRECTORY
environment variable only in debug builds.
SimplyDanny
#6135 -
The
redundant_optional_initialization
rule has been replaced by the
implicit_optional_initialization
rule that enforces implicit or explicit initialization
of optional variables. Its default stylealways
mimics the behavior of the
redundant_optional_initialization
rule by default.redundant_optional_initialization
is now an alias forimplicit_optional_initialization
.
leo-lem
#1940 -
The
swiftlint_linux.zip
release archive has been renamed toswiftlint_linux_amd64.zip
to avoid confusion with the newswiftlint_linux_arm64.zip
archive.
Bradley Mackey
SimplyDanny
Experimental
- None.
Enhancements
-
Linting got up to 30% faster due to the praiseworthy performance
improvements done in the SwiftSyntax library. -
Ignore locally defined
count
identifiers inempty_count
rule.
SimplyDanny
#5326 -
The
private_swiftui_state
rule now applies toViewModifier
types.
mt00chikin -
Support for ARM64 Linux binaries has been added. The
swiftlint_linux.zip
release archive
has been renamed toswiftlint_linux_amd64.zip
. Next to it, a newswiftlint_linux_arm64.zip
archive has been added. TheSwiftLintBinary.artifactbundle.zip
now contains both versions
of the Linux binary, so that the binary plugins
can now be used on Linux and macOS running both AMD64 and ARM64 architectures.
Bradley Mackey
SimplyDanny -
Add
include_variables
configuration option tonon_optional_string_data_conversion
rule.
When enabled, the rule will trigger on variables, properties, and function calls in addition
to string literals. Defaults tofalse
for backward compatibility.
SimplyDanny
#6094 -
Add Sendable conformance to Rule.Type for building with Swift 6.
erikkerber -
Fix false positives for
Actor
-conforming delegate protocols in the
class_delegate_protocol
rule.
imsonalbajaj
#6054 -
Support extensions and protocols in
type_body_length
rule. They can be configured using the
newexcluded_types
option which by default excludesextension
andprotocol
types.
This means the rule now checksstruct
,class
,actor
andenum
by default. To enable
checking of extensions and protocols, setexcluded_types
to an empty array or exclude other
types as needed.
SimplyDanny -
Exclude explicit system modules from
duplicate_imports
analysis, that is, modules
that are part of the system frameworks but need to be imported explicitly due to being
declared asexplicit module
in their module map.
SimplyDanny
#6098 -
Ignore various assignment operators like
=
,+=
,&=
, etc. with right-hand side
ternary expressions otherwise violating thevoid_function_in_ternary
rule.
SimplyDanny
#5611 -
Rewrite the following rules with SwiftSyntax:
accessibility_label_for_image
accessibility_trait_for_button
closure_end_indentation
expiring_todo
file_header
file_length
line_length
trailing_whitespace
vertical_whitespace
-
Add
excluded_paths
option to thefile_name
rule. It allows to exclude complete file
paths from analysis. All entries are treated as regular expressions. A single match in
its full path is enough to ignore a file. This is different from theexcluded
option
that only accepts and checks against file names.
Ueeek
#6066 -
Fix false positives of
redundant_discardable_let
rule in@ViewBuilder
functions,
#Preview
macro bodies and preview providers whenignore_swiftui_view_bodies
is
enabled.
kaseken
#6063 -
Improve
multiline_parameters
rule to correctly support
max_number_of_single_line_parameters
and detect mixed formatting.
GandaLF2006 -
Add new
prefer_condition_list
rule that triggers when aguard
/if
/while
condition is composed of multiple expressions connected by the&&
operator.
It suggests to use a condition list instead, which is more idiomatic.
SimplyDanny -
Add
ignore_coding_keys
parameter tonesting
rule. Setting this to true prevents
CodingKey
enums from violating the rule.
braker1nine
#5641 -
Support deinitializers and subscripts in
function_body_length
rule.
SimplyDanny -
Extend the
xct_specific_matcher
rule to support identity operators (===
and!==
)
in addition to the existing equality operators (==
and!=
).
SimplyDanny
#5849 -
Add new
implicit_optional_initialization
rule to enforce implicit or explicit
initialization of optional variables, configurable viastyle: always | never
.
It replaces theredundant_optional_initialization
rule mimicking it with the
style: always
option which is the default.
leo-lem
#1940 -
Add new
ignore_identity_closures
parameter toprefer_key_paths
rule to skip
conversion of identity closures ({ $0 }
) to identity key paths (\.self
).
Note that identity key paths are only supported from Swift 6 on, hence this option
will be implicitly ignored/set totrue
when SwiftLint detects a Swift <6 compiler
to avoid causing compilation errors.
p4checo
#5965
Bug Fixes
-
Fix
no_extension_access_modifier
rule incorrectly triggering fornonisolated extension
.
The rule now only flags actual access control modifiers (private
,public
,open
,
internal
,fileprivate
) and ignores isolation modifiers likenonisolated
.
copilot
#6168 -
Improved error reporting when SwiftLint exits, because of an invalid configuration file
or other error.
Martin Redington
#6052 -
Keep the default severity levels when neither
warning
norerror
values are configured.
Ensure especially that theerror
level is not set tonil
when thewarning
level
isn't set either.
SimplyDanny
Using Bazel
With bzlmod:
// Pending BCR update
bazel_dep(name = "swiftlint", version = "0.60.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 = "639a2d1719dc3bf63cacf298ac936aece542343155e7847adff5384d4c3807fd",
url = "https://github.com/realm/SwiftLint/releases/download/0.60.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.59.1: Crisp Spring Clean
Breaking
- Remove
opaque_over_existential
opt-in rule as it causes too many false positives
that can even lead to wrong-compilable code whenany
is required by a protocol the
type conforms to. In this case, usingsome
can be totally valid even though the
protocol requirement is not reimplemented for the type causing behavioral changes.
SimplyDanny
Experimental
- None.
Enhancements
- Add new
allowed_numbers
option to theno_magic_numbers
rule.
Martin Redington
Bug Fixes
- None.
Using Bazel
With bzlmod:
// Pending BCR update
bazel_dep(name = "swiftlint", version = "0.59.1", 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 = "5c7aa164801b766bd19aa0968ee7cf07c8d89c9813a63e8cfb0fec9dbb6cd788",
url = "https://github.com/realm/SwiftLint/releases/download/0.59.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.59.0: Crisp Spring Clean
Breaking
- Remove tracking of correction positions. Print the number of corrections applied instead.
SimplyDanny
Experimental
- Introduce
swiftlint-dev
command line tool that's intended to help to develop SwiftLint by encapsulating repetitive
tasks. It can already be used to generate templates for new rules including optional configurations and tests. Run
swift run swiftlint-dev rules template -h
to get an overview of the command's usage and the available
customization options. To register new rules, runswift run swiftlint-dev rules register
.
SimplyDanny
Enhancements
-
Add new option
ignores_multiline_strings
toline_length
rule. It allows to ignore too long
lines inside of multiline strings.
thisIsTheFoxe
#2689 -
Ignore
UIColor
initializers inno_magic_numbers
rule.
suojae
hyeffie
#5183 -
Exclude types with a
@Suite
attribute and functions annotated with@Test
fromno_magic_numbers
rule.
Also treat a type as a@Suite
if it contains@Test
functions.
SimplyDanny
#5964 -
Add new
opaque_over_existential
opt-in rule that triggers when the existentialany
type of a
function parameter can be replaced with an opaquesome
type.
SimplyDanny -
Add a new rationale property to rule descriptions, providing a more expansive
description of the motivation behind each rule.
Martin Redington
#5681 -
Add new
allowed_types
option tolegacy_objc_type
rule to ignore certain types.
kapitoshka438
#3723 -
Add
excluded_methods
configuration option tounneeded_override
to opt out checking methods with a given name.
For example, this helps avoid a conflict withbalanced_xctest_lifecycle
where one ofsetUp/tearDown
is empty but the other is not.
jaredgrubb
Bug Fixes
-
Fix issue referencing the Tests package from another Bazel workspace.
jszumski -
Fix crash when a disable command is preceded by a unicode character.
SimplyDanny
#5945 -
Allow severity of
duplicate_imports
rule to be configurable.
SimplyDanny
#5978 -
Silence
no_magic_numbers
rule in conditions of#if
directives.
SimplyDanny
#6000 -
Consider types restricting a protocol to classes in composed inherited types in
class_delegate_protocol
rule.
SimplyDanny
#5982 -
Rewrite
type_contents_order
rule with SwiftSyntax fixing an issue with experimental availability macros.
SimplyDanny
#5999 -
Update
file_name
rule to considermacro
types.
fraioli
#6026
Using Bazel
With bzlmod:
// Pending BCR update
bazel_dep(name = "swiftlint", version = "0.59.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 = "e2ddd07deaa0473ba557ce51c3f4fb87f737f43c87fd01d1c05d8f8ac143a876",
url = "https://github.com/realm/SwiftLint/releases/download/0.59.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.58.2: New Yearβs Fresh Fold
Breaking
- None.
Experimental
- None.
Enhancements
- None.
Bug Fixes
- Fix version being reported by the binary consumed from the Docker image.
SimplyDanny
#5966
Using Bazel
With bzlmod:
// Pending BCR update
bazel_dep(name = "swiftlint", version = "0.58.2", 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 = "3377c9115221a14a52fa7533c065e48d7de729114cc534c10dcf61036dc59807",
url = "https://github.com/realm/SwiftLint/releases/download/0.58.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
0.58.1: New Yearβs Fresh Fold
Breaking
-
If you are referring to the
swiftlint
binary from an Artifact Bundle consumed via Swift Package Manager
in an Xcode Run Script Build Phase, make sure to update the path from"$SWIFT_PACKAGE_DIR"/swiftlintplugins/SwiftLintBinary/SwiftLintBinary.artifactbundle/swiftlint-*/bin/swiftlint
to
"$SWIFT_PACKAGE_DIR"/swiftlintplugins/SwiftLintBinary/SwiftLintBinary.artifactbundle/swiftlint-*-macos/bin/swiftlint
in order to make Xcode use the binary built for macOS.
SimplyDanny
#5954 -
Revert changes to improve performance when exclude patterns resolve to a large set of files. While resolving files
indeed got much faster in certain setups, it leads to missed exclusions for nested configurations and when the linted
folder is not the current folder.
SimplyDanny
#5953
Experimental
- None.
Enhancements
- None.
Bug Fixes
-
Fix
redundant_sendable
correction by removing a remaining trailing comma as well whenSendable
was last.
SimplyDanny
#5952 -
Remove lints for
redundant_sendable
on protocols, whereSendable
is not redundant.
riley-williams
#5958 -
Add
ib_segue_action
to default configuration oftype_contents_order
rule on the same level asib_action
to define and document a standard position.
SimplyDanny
#5524
Using Bazel
With bzlmod:
// Pending BCR update
bazel_dep(name = "swiftlint", version = "0.58.1", 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 = "94b2c63592859e0fc60f53ff4002b9ceb87fb712106ce250548261860d8a9575",
url = "https://github.com/realm/SwiftLint/releases/download/0.58.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.58.0: New Yearβs Fresh Fold
Breaking
-
The command plugin now requires write permissions so that it works with the
--fix
option without an error.
SimplyDanny -
The artifact bundle name has changed.
SwiftLintBinary-macos.artifactbundle.zip
is now called
SwiftLintBinary.artifactbundle.zip
. It now includes an AMD64 Linux binary.
Bradley Mackey
#5514 -
The
inert_defer
andunused_capture_list
rules have completely been removed after being deprecated for 2 years.
SimplyDanny -
SwiftLint now requires a Swift 5.10 or higher compiler to build. The Swift Package Manager plugins continue to work with Swift 5.9.
SimplyDanny -
The
private_unit_test
rule's deprecatedregex
configuration option has been removed after 2 years.
Martin Redington
#5912
Experimental
- None.
Enhancements
-
Add Xcode command plugin allowing to run SwiftLint from within Xcode.
SimplyDanny -
Add new
async_without_await
opt-in rule that checks if anasync
declaration contains at least oneawait
.
Jan Kolarik
#5082 -
Support replacing identity expressions with
\.self
inprefer_key_path
rule from Swift 6 on.
SimplyDanny -
Support linting only provided file paths with command plugins.
DanSkeel -
Add new category for
@IBSegueAction
totype_contents_order
rule.
dk-talks
SimplyDanny -
Add option to disable
redundant_discardable_let
rule in SwiftUI view bodies.
SimplyDanny
#3855 -
Add new
redundant_sendable
rule that triggers onSendable
conformances of
types that are implicitly alreadySendable
due to being actor-isolated. It
is enabled by default.
SimplyDanny -
Improve performance when exclude patterns resolve to a large set of files.
SimplyDanny
#5018
Bug Fixes
-
Ignore TipKit's
#Rule
macro inempty_count
rule.
Ueeek
#5883 -
Ignore super calls with trailing closures in
unneeded_override
rule.
SimplyDanny
#5886 -
If violations are detected by
lint
oranalyze
, still perform an update
check for new versions of SwiftLint if requested.
Martin Redington
#5904
Using Bazel
With bzlmod:
// Pending BCR update
bazel_dep(name = "swiftlint", version = "0.58.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 = "7f069bc44c548896f78b80cdf223643f6f6da5093a934e834dd7f68eaf1d1940",
url = "https://github.com/realm/SwiftLint/releases/download/0.58.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.57.1: Squeaky Clean Cycle
Breaking
- None.
Experimental
- None.
Enhancements
-
Suggest failable
String(bytes:encoding:)
initializer in
optional_data_string_conversion
rule as it accepts allSequence
types.
Jordan Rose
SimplyDanny -
Support reading files to lint from Input File Lists provided
by Run Script Build Phases in Xcode using the command-line
argument--use-script-input-file-lists
.
BlueVirusX -
Adds a
lenient
configuration file setting, equivalent to the--lenient
command line option.
Martin Redington
#5801 -
Support type casting on configuration option values defined by environment variables.
Without a cast, these values would always be treated as strings leading to a potentially
invalid configuration.
SimplyDanny
#5774 -
Add new option
max_number_of_single_line_parameters
that allows only the specified maximum
number of parameters to be on one line whenallows_single_line = true
. If the limit is
exceeded, the rule will still trigger. Confusing option combinations likeallows_single_line = false
together withmax_number_of_single_line_parameters > 1
will be reported.
kimdv
SimplyDanny
#5781 -
The
redundant_type_annotation
rule gains a new option,
ignore_properties
, that skips enforcement on members in a
type declaration (like astruct
). This helps the rule coexist with
theexplicit_type_interface
rule that requires such redundancy.
jaredgrubb
#3750 -
Allow inherited isolation parameter to be first in function signatures
depending on the new optionignore_first_isolation_inheritance_parameter
which istrue
by default.
SimplyDanny
#5793
Bug Fixes
-
Run command plugin in whole package if no targets are defined in the
package manifest.
SimplyDanny
#5787 -
Silence
superfluous_else
rule onif
expressions with only a single
availability condition.
SimplyDanny
#5833 -
Stop triggering the
control_statement
rule on closures being directly
called as conditions.
SimplyDanny
#5846 -
Do not trigger
self_in_property_initialization
rule onself
in
key paths expressions.
SimplyDanny
#5835 -
Allow to specify transitive modules to be taken into account by
unused_import
rule. This avoids that required imports are removed.
Paul Taykalo
SimplyDanny
#5167 -
Only pass cache path and directory paths to commands that accept these arguments
in the command plugin.
SimplyDanny
#5848 -
Do not throw deprecation warning if deprecated property is not
presented in configuration.
chipp
#5791 -
The
prefer_type_checking
rule will no longer trigger for non-optional
type casting (as
), or for comparisons to optional types.
Martin Redington
#5802 -
Fixes an issue where the
superfluous_disable_command
rule could generate
false positives for nested disable commands for custom rules.
Martin Redington
#5788 -
Fixes the
--only-rule
command line option, when a default.swiftlint.yml
is absent. Additionally rules specified with--only-rule
on the command
line can now be disabled in a child configuration, to allow specific
directories to be excluded from the rule (or from being auto-corrected by
the rule), and--only-rule
can now be specified multiple times
to run multiple rules.
Martin Redington
#5711
Using Bazel
With bzlmod:
// Pending BCR update
bazel_dep(name = "swiftlint", version = "0.57.1", 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 = "78f9a8dfd3cb4b6b5ff173892c7f273cae0b67f3a0a1bd8651fe10029693f5f4",
url = "https://github.com/realm/SwiftLint/releases/download/0.57.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.57.0: Squeaky Clean Cycle
Breaking
-
The deprecated
anyobject_protocol
rule has now been removed.
Martin Redington
#5769 -
Revert the part of the
non_optional_string_data_conversion
rule that enforces non-failable conversions ofData
to UTF-8
String
. This is due to the fact that the data to be converted
can be arbitrary and especially doesn't need to represent a valid
UTF-8-encoded string.
Sam Rayner
#5263
Experimental
- None.
Enhancements
-
Add
ignore_multiline_type_headers
andignore_multiline_statement_conditions
options toopening_brace
rule to allow opening braces to be on a new line after
multiline type headers or statement conditions. Renameallow_multiline_func
to
ignore_multiline_function_signatures
.
leonardosrodrigues0
#3720 -
Add new
optional_data_string_conversion
rule to enforce
failable conversions ofData
to UTF-8String
.
Sam Rayner
#5263 -
The
no_magic_numbers
rule will now ignore violations in
SwiftUI'sPreview
macro.
Martin Redington
#5778
Bug Fixes
-
superfluous_disable_command
violations are now triggered for
custom rules.
Marcelo Fabri
Martin Redington
SimplyDanny
#4754 -
Trailing comments are now preserved by the
opening_brace
rule when
rewriting.
Martin Redington
#5751
Using Bazel
With bzlmod:
// Pending BCR update
bazel_dep(name = "swiftlint", version = "0.57.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 = "82343de268e63d196cf878bd77e88289ec6ea64054d328e92fe1baae18733104",
url = "https://github.com/realm/SwiftLint/releases/download/0.57.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.56.2: Heat Pump Dryer
Breaking
- None.
Experimental
- None.
Enhancements
- None.
Bug Fixes
-
Ignore initializers with attributes in
unneeded_synthesized_initializer
rule.
SimplyDanny
#5153 -
Silence
prefer_key_path
rule on macro expansion expressions.
SimplyDanny
#5744 -
Check
if
expressions nested arbitrarily deep incontrasted_opening_brace
rule.
SimplyDanny
#5752 -
Align left closure brace with associated parent function call in
contrasted_opening_brace
rule.
SimplyDanny
#5752 -
Align left brace of additional trailing closures with right brace of previous trailing closure
incontrasted_opening_brace
rule.
SimplyDanny
#5752 -
Trigger on empty closure blocks in
no_empty_block
rule.
SimplyDanny
#5762 -
Silence
unneeded_override
rule on methods and initializers with attributes.
SimplyDanny
#5753
Using Bazel
With bzlmod:
// Pending BCR update
bazel_dep(name = "swiftlint", version = "0.56.2", 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 = "d607223592fb87c67e91d899e8e33b5e0b04da5306afd994c4331c2881b6832d",
url = "https://github.com/realm/SwiftLint/releases/download/0.56.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