Swiftpack.co - Swift Packages by realm

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.

Packages published by realm

realm/SwiftLint 0.54.0
A tool to enforce Swift style and conventions.
⭐️ 18,324
🕓 24 weeks ago
🔖 Release Notes

Releases

The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
0.54.0: Macro-Economic Forces
24 weeks ago
#### Breaking * SwiftLint now requires Swift 5.9 or higher to build. [SimplyDanny](https://github.com/SimplyDanny) [JP Simard](https://github.com/jpsim) #### Experimental * None. #### Enhancements * Add `only` configuration option to `todo` rule which allows to specify whether the rule shall trigger on `TODO`s, `FIXME`s or both. [gibachan](https://github.com/gibachan) [#5233](https://github.com/realm/SwiftLint/pull/5233) * Make `unneeded_break_in_switch` auto correctable. [KS1019](https://github.com/KS1019/) * Speed up `closure_parameter_position` rule when there are no violations. [Marcelo Fabri](https://github.com/marcelofabri) * Rewrite `cyclomatic_complexity` rule using SwiftSyntax. [Marcelo Fabri](https://github.com/marcelofabri) * Rewrite `redundant_void_return` rule using SwiftSyntax. Also include redundant void return clauses for closures in addition to functions. This can be disabled by configuring the rule with `include_closures: false`. [Marcelo Fabri](https://github.com/marcelofabri) [JP Simard](https://github.com/jpsim) * Rewrite `discouraged_optional_collection` rule using SwiftSyntax, catching more violations. [JP Simard](https://github.com/jpsim) * Rewrite `duplicate_imports` rule using SwiftSyntax. [JP Simard](https://github.com/jpsim) * Handle `viewIsAppearing` in the `type_contents_order` rule. [u-abyss](https://github.com/u-abyss) [#5259](https://github.com/realm/SwiftLint/issues/5259) * Rewrite `vertical_parameter_alignment_on_call` rule using SwiftSyntax, fixing some false positives. [Marcelo Fabri](https://github.com/marcelofabri) [#3581](https://github.com/realm/SwiftLint/issues/3581) * Rewrite `no_grouping_extension` rule using SwiftSyntax. [Marcelo Fabri](https://github.com/marcelofabri) #### Bug Fixes * Fix false positive in `implicit_getter` rule when using unknown accessors. [kabiroberai](https://github.com/kabiroberai) [#5300](https://github.com/realm/SwiftLint/issues/5300) * Fix correction of `explicit_init` rule by keeping significant trivia. [BB9z](https://github.com/BB9z) [#5289](https://github.com/realm/SwiftLint/issues/5289) * Fix invalid corrections for opaque and existential optionals in `syntactic_sugar` rule. [SimplyDanny](https://github.com/SimplyDanny) [#5277](https://github.com/realm/SwiftLint/issues/5277) * Fix false positive in `unused_import` rule that triggered on `@_exported` imports which could break downstream modules if removed. [jszumski](https://github.com/jszumski) [#5242](https://github.com/realm/SwiftLint/pull/5242) * Fix false positive in `unused_import` rule when using a constructor defined in a transitive module. [jszumski](https://github.com/jszumski) [#5246](https://github.com/realm/SwiftLint/pull/5246) --- ### Using Bazel With bzlmod: ``` // Pending BCR update bazel_dep(name = "swiftlint", version = "0.54.0", repo_name = "SwiftLint") ``` Without bzlmod, put this in your `WORKSPACE`: <details> <summary>WORKSPACE</summary> ```python 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 = "3a97a7d225c6a39716c48aea88eee38df052f678bf6dad73f62c746a3d9cc10c", url = "https://github.com/realm/SwiftLint/releases/download/0.54.0/bazel.tar.gz", ) load("@SwiftLint//bazel:repos.bzl", "swiftlint_repos") swiftlint_repos() load("@SwiftLint//bazel:deps.bzl", "swiftlint_deps") swiftlint_deps() ``` </details> Then you can run SwiftLint in the current directory with this command: ```console bazel run @SwiftLint//:swiftlint -- --help ```
0.53.0: Laundry List
31 weeks ago
#### Breaking * Hide all `Reporter`s from SwiftLint's' public interface. [SimplyDanny](https://github.com/SimplyDanny) * The options `inlcuded`, `name` and `message` are from now on ignored in the configuration for the `private_unit_test` rule. The option `regex` 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](https://github.com/SimplyDanny) * Remove support for disable and enable commands in multiline comments. [Martin Redington](https://github.com/mildm8nnered) [#4798](https://github.com/realm/SwiftLint/issues/4798) #### Experimental * None. #### Enhancements * Show specific violation message for the `attributes` rule when the option `always_on_line_above` or `attributes_with_arguments_always_on_line_above` is involved. [chrisngabp](https://github.com/chrisngabp) [5103](https://github.com/realm/SwiftLint/issues/5103) * Rewrite `control_statement` rule using SwiftSyntax. [SimplyDanny](https://github.com/SimplyDanny) * Add new `non_overridable_class_declaration` rule that triggers on `class` function and variable declarations in final classes that are not final themselves or private. [SimplyDanny](https://github.com/SimplyDanny) * The Homebrew formula for SwiftLint now also installs completion scripts for Bash, Zsh and fish. [SimplyDanny](https://github.com/SimplyDanny) * Add new `private_swiftui_state_property` opt-in rule to encourage setting SwiftUI `@State` and `@StateObject` properties to private. [mt00chikin](https://github.com/mt00chikin) [#3173](https://github.com/realm/SwiftLint/issues/3173) * The `implicit_return` rule now supports the kinds `subscript` and `initializer` in the `included` configuration list. [SimplyDanny](https://github.com/SimplyDanny) * Add `unneeded_override` rule to remove function overrides that only call super. [keith](https://github.com/keith) [5139](https://github.com/realm/SwiftLint/pull/5139) * Show a rule's active YAML configuration in output of `swiftlint rules <rule>`. [SimplyDanny](https://github.com/SimplyDanny) * Add `invokeTest()` to `overridden_super_call` defaults. [DylanBettermannDD](https://github.com/DylanBettermannDD) * Add `--config-only` option to `rules` command allowing to print only the YAML configuration of a single or all rules. [SimplyDanny](https://github.com/SimplyDanny) * Add `--default-config` option to `rules` command allowing to use default values for configurations being printed for a single rule or all rules. [SimplyDanny](https://github.com/SimplyDanny) * Add `include_bare_init` option to the `explicit_init` rule. `include_bare_init` encourages using named constructors over `.init()` and type inference. [Martin Redington](https://github.com/mildm8nnered) [#5203](https://github.com/realm/SwiftLint/issues/5203) * Improved the reported location and reasons provided for issues detected by the `invalid_seiftlint_command` rule. [Martin Redington](https://github.com/mildm8nnered) [#5204](https://github.com/realm/SwiftLint/issues/5204) * 100 is no longer considered to be a magic number by the `no_magic_numbers` rule. [Martin Redington](https://github.com/mildm8nnered) [#5215](https://github.com/realm/SwiftLint/issues/5215) * Adds a `strict` configuration file setting, equivalent to the `--strict` command line option. [Martin Redington](https://github.com/mildm8nnered) [#5226](https://github.com/realm/SwiftLint/issues/5226) * Extend `implicitly_unwrapped_optional` rule with the new mode `weak_except_iboutlets` that only checks `weak` variables. [Ricky Tan](https://github.com/rickytan) #### Bug Fixes * Respect grapheme clusters in counting the number of characters in the `collection_alignment` rule. [kishikawakatsumi](https://github.com/kishikawakatsumi) [#4837](https://github.com/realm/SwiftLint/issues/4837) * Fix false positive in `control_statement` rule that triggered on conditions with trailing closures where parentheses are recommended by the compiler. [SimplyDanny](https://github.com/SimplyDanny) [#5135](https://github.com/realm/SwiftLint/issues/5135) * Fix runtime error when an excluded directory does not exist. [SimplyDanny](https://github.com/SimplyDanny) [#5078](https://github.com/realm/SwiftLint/issues/5078) * Support `switch` expressions used in expression contexts in `switch_case_alignment` rule. [SimplyDanny](https://github.com/SimplyDanny) [#5191](https://github.com/realm/SwiftLint/issues/5191) [#5227](https://github.com/realm/SwiftLint/issues/5272) [#5080](https://github.com/realm/SwiftLint/issues/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](https://github.com/SimplyDanny) [#5118](https://github.com/realm/SwiftLint/issues/5118) * Document `exclude_ranges` option for `number_separator` rule. [SimplyDanny](https://github.com/SimplyDanny) * Rewrite `implicit_return` rule with SwiftSyntax fixing a few false positives and false negatives in the process. [SimplyDanny](https://github.com/SimplyDanny) [#5161](https://github.com/realm/SwiftLint/issues/5161) * Make sure `severity` is configurable for `type_contents_order` rule. [SimplyDanny](https://github.com/SimplyDanny) * Bazel: Mark `rules_xcodeproj` as a development dependency. [Thi Doãn](https://github.com/thii) [JP Simard](https://github.com/jpsim) [#4737](https://github.com/realm/SwiftLint/issues/4737) * Fix false negatives for the `unneeded_synthesized_initializer` rule for nested structs in classes. [Martin Redington](https://github.com/mildm8nnered) [#5120](https://github.com/realm/SwiftLint/issues/5120) * Fix some unexpected rule enablement interactions between parent and child configurations. [Martin Redington](https://github.com/mildm8nnered) [#4876](https://github.com/realm/SwiftLint/issues/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](https://github.com/mildm8nnered) [#5137](https://github.com/realm/SwiftLint/issues/5137) * Fix false positive in the `ns_number_init_as_function_reference` rule when calling `NSNumber.init(value:)` directly. [Marcelo Fabri](https://github.com/marcelofabri) [#5172](https://github.com/realm/SwiftLint/issues/5172) * The `no_magic_numbers` rule will not trigger for bitwise shift operations. [Martin Redington](https://github.com/mildm8nnered) [#5171](https://github.com/realm/SwiftLint/issues/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](https://github.com/mildm8nnered) [#5165](https://github.com/realm/SwiftLint/issues/5165) * Fix false positives for `superfluous_disable_command` rule. [Martin Redington](https://github.com/mildm8nnered) [#4798](https://github.com/realm/SwiftLint/issues/4798) * Fix false positive in the `test_case_accessibility` rule. [gibachan](https://github.com/gibachan) [#5211](https://github.com/realm/SwiftLint/issues/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`: <details> <summary>WORKSPACE</summary> ```python 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() ``` </details> Then you can run SwiftLint in the current directory with this command: ```console bazel run @SwiftLint//:swiftlint -- --help ```
0.52.4: Lid Switch
42 weeks ago
#### Breaking * None. #### Experimental * None. #### Enhancements * Handle static `spec` methods in `quick_discouraged_call` rule. The method type changed from an instance method to a class method in Quick 7. [SimplyDanny](https://github.com/SimplyDanny) [#5072](https://github.com/realm/SwiftLint/issues/5072) * Prettify the rule configuration presentation on the command line as well as on the website. [SimplyDanny](https://github.com/SimplyDanny) #### Bug Fixes * Fix false positives for the `unneeded_synthesized_initializer` rule, when no argument initializers had side-effects. [Martin Redington](https://github.com/mildm8nnered) [#5075](https://github.com/realm/SwiftLint/issues/5075) * Ignore `switch` expressions assigned to variables in `switch_case_alignment` rule. [SimplyDanny](https://github.com/SimplyDanny) [#5080](https://github.com/realm/SwiftLint/issues/5080) * Fix auto-correction for the `direct_return` rule, when statements have trailing comments. [Martin Redington](https://github.com/mildm8nnered) [#5081](https://github.com/realm/SwiftLint/issues/5081) * Fix false positives for the `private_subject` rule when creating subjects inside initializers. [kasrababaei](https://github.com/kasrababaei) * Fix false positive for `prefer_self_in_static_references` when a class inherits from another class with generic types. [kasrababaei](https://github.com/kasrababaei) --- ### Using Bazel With bzlmod: ``` // Pending BCR update: https://github.com/bazelbuild/bazel-central-registry/pull/750 bazel_dep(name = "swiftlint", version = "0.52.4", repo_name = "SwiftLint") ``` Without bzlmod, put this in your `WORKSPACE`: <details> <summary>WORKSPACE</summary> ```python 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 = "c6ea58b9c72082cdc1ada4a2d48273ecc355896ed72204cedcc586b6ccb8aca6", url = "https://github.com/realm/SwiftLint/releases/download/0.52.4/bazel.tar.gz", ) load("@SwiftLint//bazel:repos.bzl", "swiftlint_repos") swiftlint_repos() load("@SwiftLint//bazel:deps.bzl", "swiftlint_deps") swiftlint_deps() ``` </details> Then you can run SwiftLint in the current directory with this command: ```console bazel run @SwiftLint//:swiftlint -- --help ```
0.52.3: Duplicate Hampers
44 weeks ago
#### Breaking * None. #### Experimental * None. #### Enhancements * Make severity for unallowed symbols configurable. The option name is `unallowed_symbols_severity`. It accepts the two values `warning` and `error` (default) as usual. [SimplyDanny](https://github.com/SimplyDanny) * Mention a rule's identifier in the console message that is printed when the rule's associated configuration entry contains invalid values. [SimplyDanny](https://github.com/SimplyDanny) * Silence `xct_specific_matcher` rule on "one argument asserts" if there are potential types or tuples involved in the comparison as types and tuples do not conform to `Equatable`. [SimplyDanny](https://github.com/SimplyDanny) [#4990](https://github.com/realm/SwiftLint/issues/4990) * Add `grouping` option to the `sorted_imports` rule allowing to sort groups of imports defined by their preceding attributes (e.g. `@testable`, `@_exported`, ...). [hiltonc](https://github.com/hiltonc) * Add new `--silence-deprecation-warnings` flag that silences deprecation warnings that would otherwise be printed to the console. [SimplyDanny](https://github.com/SimplyDanny) [#4989](https://github.com/realm/SwiftLint/issues/4989) * Do not trigger `redundant_self_in_closure` rule when another idenfier `x` in scope shadows the field accessed by `self.x` to avoid semantical changes. [SimplyDanny](https://github.com/SimplyDanny) [#5010](https://github.com/realm/SwiftLint/issues/5010) * Rewrite `todo` rule with SwiftSyntax. [woxtu](https://github.com/woxtu) * Adds an `unneeded_synthesized_initializer` rule, based on `swift-format`'s `UseSynthesizedInitializer` rule, which warns when a defined default or memberwise initializer would have been automatically synthesized. [Martin Redington](https://github.com/mildm8nnered) #### Bug Fixes * The option `validates_start_with_lowercase` can now be disabled by setting it to `off`. [SimplyDanny](https://github.com/SimplyDanny) [#5036](https://github.com/realm/SwiftLint/issues/5036) * Do not trigger `prefer_self_in_static_references` rule on `typealias` declarations in classes. [SimplyDanny](https://github.com/SimplyDanny) [#5009](https://github.com/realm/SwiftLint/issues/5009) * Do not trigger `prefer_self_in_static_references` rule on collection types in classes, but on initializers like `[C]()` in all types. [SimplyDanny](https://github.com/SimplyDanny) [#5042](https://github.com/realm/SwiftLint/issues/5042) * Fix false positives on `redundant_objc_attribute` rule for enums and private members. [Martin Redington](https://github.com/mildm8nnered) [#4633](https://github.com/realm/SwiftLint/issues/4633) * Fix autocorrect for `CGIntersectionRect` in `legacy_cggeometry_functions` rule. [Haoocen](https://github.com/Haoocen) [#5023](https://github.com/realm/SwiftLint/pull/5023) * Fix false positives on `sorted_first_last` rule when `first`/`last` have a predicate. [woxtu](https://github.com/woxtu) [#3023](https://github.com/realm/SwiftLint/issues/3023) * Work around dyld warning about duplicate SwiftSyntax classes with Xcode 15 betas. [keith](https://github.com/keith) [JP Simard](https://github.com/jpsim) [#4782](https://github.com/realm/SwiftLint/issues/4782) --- ### Using Bazel With bzlmod: ``` bazel_dep(name = "swiftlint", version = "0.52.3", repo_name = "SwiftLint") ``` Without bzlmod, put this in your `WORKSPACE`: <details> <summary>WORKSPACE</summary> ```python 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 = "20c09504184d2496a4b40bc6f77a03d443fe4ba79b4bbbab61382bc5241d24aa", url = "https://github.com/realm/SwiftLint/releases/download/0.52.3/bazel.tar.gz", ) load("@SwiftLint//bazel:repos.bzl", "swiftlint_repos") swiftlint_repos() load("@SwiftLint//bazel:deps.bzl", "swiftlint_deps") swiftlint_deps() ``` </details> Then you can run SwiftLint in the current directory with this command: ```console bazel run @SwiftLint//:swiftlint -- --help ```
0.52.2: Crisper Clearer Pleats
50 weeks ago
#### Breaking * None. #### Experimental * None. #### Enhancements * Exclude simple assignments of the form `self.x = x` from being reported by the `redundant_self_in_closure` rule. [SimplyDanny](https://github.com/SimplyDanny) [#4988](https://github.com/realm/SwiftLint/issues/4988) #### Bug Fixes * Make `unhandled_throwing_task` opt-in instead of enabled by default. The rule is still prone to false positives at this point, so this makes enabling the rule a conscious decision by end-users. [JP Simard](https://github.com/jpsim) [#4987](https://github.com/realm/SwiftLint/issues/4987) * Fix `unhandled_throwing_task` false positives when the `Task` is returned or where the throwing code is handled in a `Result` initializer. [JP Simard](https://github.com/jpsim) [#4987](https://github.com/realm/SwiftLint/issues/4987) --- ### Using Bazel With bzlmod: ``` bazel_dep(name = "swiftlint", version = "0.52.2", repo_name = "SwiftLint") ``` Without bzlmod, put this in your `WORKSPACE`: <details> <summary>WORKSPACE</summary> ```python 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 = "2b95a592304bc377aa29d92683618376975f93553be62f132de7424819f6fc4a", url = "https://github.com/realm/SwiftLint/releases/download/0.52.2/bazel.tar.gz", ) load("@SwiftLint//bazel:repos.bzl", "swiftlint_repos") swiftlint_repos() load("@SwiftLint//bazel:deps.bzl", "swiftlint_deps") swiftlint_deps() ``` </details> Then you can run SwiftLint in the current directory with this command: ```console bazel run @SwiftLint//:swiftlint -- --help ```
0.52.1: Crisp Clear Pleats
50 weeks ago
## 0.52.1: Crisp Clear Pleats #### Bug Fixes * Let the `validates_start_with_lowercase` option in name configurations expect a severity (warning or error). Not setting it disables the check. Boolean values are now deprecated. A `true` value enables the check as an error for the time being to keep the previous behavior. [SimplyDanny](https://github.com/SimplyDanny) [#2180](https://github.com/realm/SwiftLint/issues/2180) * Fixed a false positive in `unhandled_throwing_task`. [kylebshr](https://github.com/kylebshr) [#4984](https://github.com/realm/SwiftLint/issues/4984) * Fix Bazel release tarball for compiling on macOS. [JP Simard](https://github.com/jpsim) [#4985](https://github.com/realm/SwiftLint/issues/4985) ## 0.52.0: Crisp Clear Pleats #### Breaking * The `attributes` rule now expects attributes with arguments to be placed on their own line above the declaration they are supposed to influence. This applies to attributes with any kinds of arguments including single key path arguments which were previously handled in a different way. This behavior can be turned off by setting `attributes_with_arguments_always_on_line_above` to `false. [SimplyDanny](https://github.com/SimplyDanny) [#4843](https://github.com/realm/SwiftLint/issues/4843) * The internal module structure for SwiftLint has changed to split the monolithic `SwiftLintFramework` into new `SwiftLintCore` for core linter infrastructure, `SwiftLintBuiltInRules` for built-in rules and `SwiftLintExtraRules` to add your own native rules to SwiftLint. [JP Simard](https://github.com/jpsim) #### Experimental * None. #### Enhancements * Add new `superfluous_else` rule that triggers on `if`-statements when an attached `else`-block can be removed, because all branches of the previous `if`-block(s) would certainly exit the current scope already. [SimplyDanny](https://github.com/SimplyDanny) * Add `sorted_enum_cases` rule which warns when enum cases are not sorted. [kimdv](https://github.com/kimdv) * Add new `redundant_self_in_closure` rule that triggers in closures on explicitly used `self` when it's actually not needed due to: * Strongly captured `self` (`{ [self] in ... }`) * Closure used in a struct declaration (`self` can always be omitted) * Anonymous closures that are directly called (`{ ... }()`) as they are definitly not escaping * Weakly captured `self` with explicit unwrapping [SimplyDanny](https://github.com/SimplyDanny) [#59](https://github.com/realm/SwiftLint/issues/59) * Extend `xct_specific_matcher` rule to check for boolean asserts on (un)equal comparisons. The rule can be configured with the matchers that should trigger rule violations. By default, all matchers trigger, but that can be limited to just `one-argument-asserts` or `two-argument-asserts`. [SimplyDanny](https://github.com/SimplyDanny) [JP Simard](https://github.com/jpsim) [#3726](https://github.com/realm/SwiftLint/issues/3726) * Trigger `prefer_self_in_static_references` rule on more type references. [SimplyDanny](https://github.com/SimplyDanny) * Adds a new `reporters` command, to improve discoverability of reporters. [Martin Redington](https://github.com/mildm8nnered) [#4819](https://github.com/realm/SwiftLint/issues/4819) * Adds `test_parent_classes` option to the `no_magic_numbers` rule. Violations within test classes will now be ignored by default. [Martin Redington](https://github.com/mildm8nnered) [#4896](https://github.com/realm/SwiftLint/issues/4896) * Stop enforcing calls to super from the override functions `setUp()`, `tearDown()`, `setUpWithError()`, and `tearDownWithError()` in `XCTestCase` subclasses. [AndrewDMontgomery](https://github.com/andrewdmontgomery) [#4875](https://github.com/realm/SwiftLint/pull/4875) * Prepend `warning: ` to error messages so that they show in Xcode. [whiteio](https://github.com/whiteio) [#4923](https://github.com/realm/SwiftLint/issues/4923) * The `attributes` rule received a new boolean option `attributes_with_arguments_always_on_line_above` which is `true` by default. Setting it to `false` ensures that attributes with arguments like `@Persisted(primaryKey: true)` don't violate the rule if they are on the same line with the variable declaration. [SimplyDanny](https://github.com/SimplyDanny) [#4843](https://github.com/realm/SwiftLint/issues/4843) * Add new `unhandled_throwing_task` rule that triggers when a Task with an implicit error type has unhandled trys or errors thrown inside its body. This results in errors being silently discarded, which may be unexpected. See this forum thread for more details: https://forums.swift.org/t/56066 [kylebshr](https://github.com/kylebshr) #### Bug Fixes * Fix `lower_acl_than_parent` rule rewriter by preserving leading whitespace. [SimplyDanny](https://github.com/SimplyDanny) [#4860](https://github.com/realm/SwiftLint/issues/4860) * Ignore block comments in `let_var_whitespace` rule. [SimplyDanny](https://github.com/SimplyDanny) [#4871](https://github.com/realm/SwiftLint/issues/4871) * Fix false positives in `indentation_width` rule. [Sven Münnich](https://github.com/svenmuennich) * Do not trigger `reduce_boolean` on `reduce` methods with a first named argument that is different from `into`. [SimplyDanny](https://github.com/SimplyDanny) [#4894](https://github.com/realm/SwiftLint/issues/4894) * Work around dyld warning about duplicate SwiftSyntax classes. [keith](https://github.com/keith) [#4782](https://github.com/realm/SwiftLint/issues/4782) * Improve lint times of SwiftLintPlugin by moving the `excludedPaths(fileManager:)` operation out of the linting iterations. [andyyhope](https://github.com/andyyhope) [#4844](https://github.com/realm/SwiftLint/issues/4844) --- ### Using Bazel With bzlmod: ``` bazel_dep(name = "swiftlint", version = "0.52.1", repo_name = "SwiftLint") ``` Without bzlmod, put this in your `WORKSPACE`: <details> <summary>WORKSPACE</summary> ```python 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 = "22973f004310a1e5611ae6d08077e907be4883929d10c049cc0b9846463b3d9a", url = "https://github.com/realm/SwiftLint/releases/download/0.52.1/bazel.tar.gz", ) load("@SwiftLint//bazel:repos.bzl", "swiftlint_repos") swiftlint_repos() load("@SwiftLint//bazel:deps.bzl", "swiftlint_deps") swiftlint_deps() ``` </details> Then you can run SwiftLint in the current directory with this command: ```console bazel run @SwiftLint//:swiftlint -- --help ```
0.52.0: Crisp Clear Pleats
51 weeks ago
#### Breaking * The `attributes` rule now expects attributes with arguments to be placed on their own line above the declaration they are supposed to influence. This applies to attributes with any kinds of arguments including single key path arguments which were previously handled in a different way. This behavior can be turned off by setting `attributes_with_arguments_always_on_line_above` to `false. [SimplyDanny](https://github.com/SimplyDanny) [#4843](https://github.com/realm/SwiftLint/issues/4843) * The internal module structure for SwiftLint has changed to split the monolithic `SwiftLintFramework` into new `SwiftLintCore` for core linter infrastructure, `SwiftLintBuiltInRules` for built-in rules and `SwiftLintExtraRules` to add your own native rules to SwiftLint. [JP Simard](https://github.com/jpsim) #### Experimental * None. #### Enhancements * Add new `superfluous_else` rule that triggers on `if`-statements when an attached `else`-block can be removed, because all branches of the previous `if`-block(s) would certainly exit the current scope already. [SimplyDanny](https://github.com/SimplyDanny) * Add `sorted_enum_cases` rule which warns when enum cases are not sorted. [kimdv](https://github.com/kimdv) * Add new `redundant_self_in_closure` rule that triggers in closures on explicitly used `self` when it's actually not needed due to: * Strongly captured `self` (`{ [self] in ... }`) * Closure used in a struct declaration (`self` can always be omitted) * Anonymous closures that are directly called (`{ ... }()`) as they are definitly not escaping * Weakly captured `self` with explicit unwrapping [SimplyDanny](https://github.com/SimplyDanny) [#59](https://github.com/realm/SwiftLint/issues/59) * Extend `xct_specific_matcher` rule to check for boolean asserts on (un)equal comparisons. The rule can be configured with the matchers that should trigger rule violations. By default, all matchers trigger, but that can be limited to just `one-argument-asserts` or `two-argument-asserts`. [SimplyDanny](https://github.com/SimplyDanny) [JP Simard](https://github.com/jpsim) [#3726](https://github.com/realm/SwiftLint/issues/3726) * Trigger `prefer_self_in_static_references` rule on more type references. [SimplyDanny](https://github.com/SimplyDanny) * Adds a new `reporters` command, to improve discoverability of reporters. [Martin Redington](https://github.com/mildm8nnered) [#4819](https://github.com/realm/SwiftLint/issues/4819) * Adds `test_parent_classes` option to the `no_magic_numbers` rule. Violations within test classes will now be ignored by default. [Martin Redington](https://github.com/mildm8nnered) [#4896](https://github.com/realm/SwiftLint/issues/4896) * Stop enforcing calls to super from the override functions `setUp()`, `tearDown()`, `setUpWithError()`, and `tearDownWithError()` in `XCTestCase` subclasses. [AndrewDMontgomery](https://github.com/andrewdmontgomery) [#4875](https://github.com/realm/SwiftLint/pull/4875) * Prepend `warning: ` to error messages so that they show in Xcode. [whiteio](https://github.com/whiteio) [#4923](https://github.com/realm/SwiftLint/issues/4923) * The `attributes` rule received a new boolean option `attributes_with_arguments_always_on_line_above` which is `true` by default. Setting it to `false` ensures that attributes with arguments like `@Persisted(primaryKey: true)` don't violate the rule if they are on the same line with the variable declaration. [SimplyDanny](https://github.com/SimplyDanny) [#4843](https://github.com/realm/SwiftLint/issues/4843) * Add new `unhandled_throwing_task` rule that triggers when a Task with an implicit error type has unhandled trys or errors thrown inside its body. This results in errors being silently discarded, which may be unexpected. See this forum thread for more details: https://forums.swift.org/t/56066 [kylebshr](https://github.com/kylebshr) #### Bug Fixes * Fix `lower_acl_than_parent` rule rewriter by preserving leading whitespace. [SimplyDanny](https://github.com/SimplyDanny) [#4860](https://github.com/realm/SwiftLint/issues/4860) * Ignore block comments in `let_var_whitespace` rule. [SimplyDanny](https://github.com/SimplyDanny) [#4871](https://github.com/realm/SwiftLint/issues/4871) * Fix false positives in `indentation_width` rule. [Sven Münnich](https://github.com/svenmuennich) * Do not trigger `reduce_boolean` on `reduce` methods with a first named argument that is different from `into`. [SimplyDanny](https://github.com/SimplyDanny) [#4894](https://github.com/realm/SwiftLint/issues/4894) * Work around dyld warning about duplicate SwiftSyntax classes. [keith](https://github.com/keith) [#4782](https://github.com/realm/SwiftLint/issues/4782) * Improve lint times of SwiftLintPlugin by moving the `excludedPaths(fileManager:)` operation out of the linting iterations. [andyyhope](https://github.com/andyyhope) [#4844](https://github.com/realm/SwiftLint/issues/4844) --- ### Using Bazel With bzlmod: ``` bazel_dep(name = "swiftlint", version = "0.52.0", repo_name = "SwiftLint") ``` Without bzlmod, put this in your `WORKSPACE`: <details> <summary>WORKSPACE</summary> ```python 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 = "c5021aff12fd0e0cbf17c232d8f0e28a27ccf886d5a871681cb78f7b30a20faa", url = "https://github.com/realm/SwiftLint/releases/download/0.52.0/bazel.tar.gz", ) load("@SwiftLint//bazel:repos.bzl", "swiftlint_repos") swiftlint_repos() load("@SwiftLint//bazel:deps.bzl", "swiftlint_deps") swiftlint_deps() ``` </details> Then you can run SwiftLint in the current directory with this command: ```console bazel run @SwiftLint//:swiftlint -- --help ```
0.51.0: bzllint
1 year ago
## 0.51.0: bzllint #### Breaking * Deprecate the `unused_capture_list` rule in favor of the Swift compiler warning. At the same time, make it an opt-in rule. [Cyberbeni](https://github.com/Cyberbeni) [#4656](https://github.com/realm/SwiftLint/issues/4656) * Deprecate the `inert_defer` rule in favor of the Swift compiler warning. At the same time, make it an opt-in rule. [SimplyDanny](https://github.com/SimplyDanny) [#4615](https://github.com/realm/SwiftLint/issues/4615) #### Experimental * None. #### Enhancements * Add `duplicate_conditions` rule which warns when a condition is duplicated in separate branches of the same branching statement (if-else, or switch). [1in1](https://github.com/1in1) [#4666](https://github.com/realm/SwiftLint/issues/4666) * Add local links to rule descriptions to every rule listed in `Rule Directory.md`. [kattouf](https://github.com/kattouf) * Make forceExclude work with directly specified files. [jimmya](https://github.com/jimmya) [#4609](https://github.com/realm/SwiftLint/issues/4609) * Adds `all` pseudo-rule for `opt_in_rules` - enables all opt in rules that are not listed in `disabled_rules` [Martin Redington](https://github.com/mildm8nnered) [#4540](https://github.com/realm/SwiftLint/issues/4540) * Separate analyzer rules as an independent section in the rule directory of the reference. [Ethan Wong](https://github.com/GetToSet) [#4664](https://github.com/realm/SwiftLint/pull/4664) * Add rule identifier to output of Emoji reporter. [SimplyDanny](https://github.com/SimplyDanny) [#4707](https://github.com/realm/SwiftLint/issues/4707) * Interpret strings in `excluded` option of `identifier_name`, `type_name` and `generic_type_name` rules as regex. [Moly](https://github.com/kyounh12) [#4655](https://github.com/realm/SwiftLint/pull/4655) * Add new `direct_return` rule that triggers on `return` statements returning variables that have been declared in the statement before only. [SimplyDanny](https://github.com/SimplyDanny) * Add `period_spacing` opt-in rule that checks periods are not followed by 2 or more spaces in comments. [Julioacarrettoni](https://github.com/Julioacarrettoni) [#4624](https://github.com/realm/SwiftLint/pull/4624) * Allow to pass a rule identifier to the `swiftlint docs` command to open its specific documentation website, e.g. `swiftlint docs for_where`. [SimplyDanny](https://github.com/SimplyDanny) [#4707](https://github.com/realm/SwiftLint/issues/4707) * Allow new Quick APIs `aroundEach` and `justBeforeEach` for `quick_discouraged_call`. [David Steinacher](https://github.com/stonko1994) [#4626](https://github.com/realm/SwiftLint/issues/4626) * Add `relative-path` reporter to generate reports with relative file paths. [Roya1v](https://github.com/roya1v) [#4660](https://github.com/realm/SwiftLint/issues/4660) * Let `number_separator` rule trigger on misplaced separators, e.g. `10_00`. [SimplyDanny](https://github.com/SimplyDanny) [#4637](https://github.com/realm/SwiftLint/issues/4637) * Rewrite `multiline_arguments` rule using SwiftSyntax, ignoring trailing closures. [Marcelo Fabri](https://github.com/marcelofabri) [#3399](https://github.com/realm/SwiftLint/issues/3399) [#3605](https://github.com/realm/SwiftLint/issues/3605) * Speed up linting by up to 6% updating to use a newer version of `SwiftSyntax`. [JP Simard](https://github.com/jpsim) * Catch more valid `legacy_multiple` violations. [JP Simard](https://github.com/jpsim) * Catch more valid `no_magic_numbers` violations. [JP Simard](https://github.com/jpsim) * Add `blanket_disable_command` rule that checks whether rules are re-enabled after being disabled. [Martin Redington](https://github.com/mildm8nnered) [#4731](https://github.com/realm/SwiftLint/pull/4731) * Add `invalid_swiftlint_command` rule that validates `// swiftlint:enable` and `disable` commands. [Martin Redington](https://github.com/mildm8nnered) [#4546](https://github.com/realm/SwiftLint/pull/4546) * Improve `identifier_name` documentation. [Martin Redington](https://github.com/mildm8nnered) [#4767](https://github.com/realm/SwiftLint/issues/4767) * Adds `include_multiline_strings` option to `indentation_width` rule. [Martin Redington](https://github.com/mildm8nnered) [#4248](https://github.com/realm/SwiftLint/issues/4248) * Adds a new `summary` reporter, that displays the number of violations of each rule in a text table. [Martin Redington](https://github.com/mildm8nnered) #### Bug Fixes * Report violations in all `<scope>_length` rules when the error threshold is smaller than the warning threshold. [SimplyDanny](https://github.com/SimplyDanny) [#4645](https://github.com/realm/SwiftLint/issues/4645) * Consider custom attributes in `attributes` rule. [SimplyDanny](https://github.com/SimplyDanny) [#4599](https://github.com/realm/SwiftLint/issues/4599) * Fix whitespaces issue in auto-fix of `redundant_optional_initialization` rule when multiple variable declaration are involved. [SimplyDanny](https://github.com/SimplyDanny) [#4794](https://github.com/realm/SwiftLint/issues/4794) * Stop triggering `strict_fileprivate` rule on symbols implementing a protocol in the same file. [SimplyDanny](https://github.com/SimplyDanny) [#4692](https://github.com/realm/SwiftLint/issues/4692) * Fix false positives on `private_subject` rule when using subjects inside functions. [Marcelo Fabri](https://github.com/marcelofabri) [#4643](https://github.com/realm/SwiftLint/issues/4643) * Fix for compiler directives masking subsequent `opening_brace` violations. [Martin Redington](https://github.com/mildm8nnered) [#3712](https://github.com/realm/SwiftLint/issues/3712) * Rewrite `explicit_type_interface` rule with SwiftSyntax fixing a false-positive in if-case-let statements. [SimplyDanny](https://github.com/SimplyDanny) [#4548](https://github.com/realm/SwiftLint/issues/4548) * Stop triggering `unused_capture_list` on captured variable that is only referenced by a shorthand optional binding (`if let capturedVar { ... }`). [SimplyDanny](https://github.com/SimplyDanny) [#4804](https://github.com/realm/SwiftLint/issues/4804) * Ensure that negative literals in initializers do not trigger `no_magic_numbers` rule. [SimplyDanny](https://github.com/SimplyDanny) [#4677](https://github.com/realm/SwiftLint/issues/4677) * Fix caching of `indentation_width` rule. [SimplyDanny](https://github.com/SimplyDanny) [#4121](https://github.com/realm/SwiftLint/issues/4121) * Updated JUnit reporter to output error count and warning count. [patricks](https://github.com/patricks) [#4725](https://github.com/realm/SwiftLint/pull/4725) * Fix correction on `lower_acl_than_parent` rule for `open` declarations. [Marcelo Fabri](https://github.com/marcelofabri) [#4753](https://github.com/realm/SwiftLint/issues/4753) * Fix `void_return` rule to support async and async throws functions. [Mathias Schreck](https://github.com/lo1tuma) [#4772](https://github.com/realm/SwiftLint/issues/4772) * Fix false positives in `attributes` rule when using property wrappers with keypath arguments. [JP Simard](https://github.com/jpsim) * Fix for `superfluous_disable_command` not being completely disabled by `disable` commands. [Martin Redington](https://github.com/mildm8nnered) [#4788](https://github.com/realm/SwiftLint/issues/4788) * Fixed correction for `trailing_comma` rule wrongly removing trailing comments. [Martin Redington](https://github.com/mildm8nnered) [#4814](https://github.com/realm/SwiftLint/issues/4814) --- ### Using Bazel With bzlmod: ``` bazel_dep(name = "swiftlint", version = "0.51.0", repo_name = "SwiftLint") ``` Without bzlmod, put this in your `WORKSPACE`: <details> <summary>WORKSPACE</summary> ```python 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 = "8369ca218c4c898b7af202e2ec6180062396f659debca49a1d6c66902a3a37c3", url = "https://github.com/realm/SwiftLint/releases/download/0.51.0/bazel.tar.gz", ) load("@SwiftLint//bazel:repos.bzl", "swiftlint_repos") swiftlint_repos() load("@SwiftLint//bazel:deps.bzl", "swiftlint_deps") swiftlint_deps() ``` </details> Then you can run SwiftLint in the current directory with this command: ```console bazel run @SwiftLint//:swiftlint -- --help ```
0.51.0-rc.2: bzllint
1 year ago
This is a prerelease version. It won't be published to Homebrew, CocoaPods or bzlmod. 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 from `portable_swiftlint/swiftlint` to `/usr/local/bin` or elsewhere in your `PATH` * Using [Mint](https://github.com/yonaskolb/Mint): `mint install realm/[email protected]` * Cloning and building from source: `git clone https://github.com/realm/SwiftLint.git && cd SwiftLint && git checkout 0.51.0-rc.2 && make install` * Docker: ```docker run -it -v `pwd`:`pwd` -w `pwd` ghcr.io/realm/swiftlint:0.51.0-rc.2``` * Bazel: See instructions at the bottom Changes from 0.50.3: https://github.com/realm/SwiftLint/compare/0.50.3...0.51.0-rc.2 Changes from 0.51.0-rc.1: https://github.com/realm/SwiftLint/compare/0.51.0-rc.1...0.51.0-rc.2 --- #### Breaking * Deprecate the `unused_capture_list` rule in favor of the Swift compiler warning. At the same time, make it an opt-in rule. [Cyberbeni](https://github.com/Cyberbeni) [#4656](https://github.com/realm/SwiftLint/issues/4656) * Deprecate the `inert_defer` rule in favor of the Swift compiler warning. At the same time, make it an opt-in rule. [SimplyDanny](https://github.com/SimplyDanny) [#4615](https://github.com/realm/SwiftLint/issues/4615) #### Experimental * None. #### Enhancements * Add local links to rule descriptions to every rule listed in `Rule Directory.md`. [kattouf](https://github.com/kattouf) * Make forceExclude work with directly specified files. [jimmya](https://github.com/jimmya) [#issue_number](https://github.com/realm/SwiftLint/issues/4609) * Separate analyzer rules as an independent section in the rule directory of the reference. [Ethan Wong](https://github.com/GetToSet) [#4664](https://github.com/realm/SwiftLint/pull/4664) * Add rule identifier to output of Emoji reporter. [SimplyDanny](https://github.com/SimplyDanny) [#4707](https://github.com/realm/SwiftLint/issues/4707) * Interpret strings in `excluded` option of `identifier_name`, `type_name` and `generic_type_name` rules as regex. [Moly](https://github.com/kyounh12) [#4655](https://github.com/realm/SwiftLint/pull/4655) * Add new `direct_return` rule that triggers on `return` statements returning variables that have been declared in the statement before only. [SimplyDanny](https://github.com/SimplyDanny) * Add `period_spacing` opt-in rule that checks periods are not followed by 2 or more spaces in comments. [Julioacarrettoni](https://github.com/Julioacarrettoni) [#4624](https://github.com/realm/SwiftLint/pull/4624) * Allow to pass a rule identifier to the `swiftlint docs` command to open its specific documentation website, e.g. `swiftlint docs for_where`. [SimplyDanny](https://github.com/SimplyDanny) [#4707](https://github.com/realm/SwiftLint/issues/4707) * Allow new Quick APIs `aroundEach` and `justBeforeEach` for `quick_discouraged_call`. [David Steinacher](https://github.com/stonko1994) [#4626](https://github.com/realm/SwiftLint/issues/4626) * Add `relative-path` reporter to generate reports with relative file paths. [Roya1v](https://github.com/roya1v) [#4660](https://github.com/realm/SwiftLint/issues/4660) * Let `number_separator` rule trigger on misplaced separators, e.g. `10_00`. [SimplyDanny](https://github.com/SimplyDanny) [#4637](https://github.com/realm/SwiftLint/issues/4637) * Rewrite `multiline_arguments` rule using SwiftSyntax, ignoring trailing closures. [Marcelo Fabri](https://github.com/marcelofabri) [#3399](https://github.com/realm/SwiftLint/issues/3399) [#3605](https://github.com/realm/SwiftLint/issues/3605) * Speed up linting by up to 6% updating to use a newer version of `SwiftSyntax`. [JP Simard](https://github.com/jpsim) * Catch more valid `legacy_multiple` violations. [JP Simard](https://github.com/jpsim) * Catch more valid `no_magic_numbers` violations. [JP Simard](https://github.com/jpsim) #### Bug Fixes * Report violations in all `<scope>_length` rules when the error threshold is smaller than the warning threshold. [SimplyDanny](https://github.com/SimplyDanny) [#4645](https://github.com/realm/SwiftLint/issues/4645) * Consider custom attributes in `attributes` rule. [SimplyDanny](https://github.com/SimplyDanny) [#4599](https://github.com/realm/SwiftLint/issues/4599) * Stop triggering `strict_fileprivate` rule on symbols implementing a protocol in the same file. [SimplyDanny](https://github.com/SimplyDanny) [#4692](https://github.com/realm/SwiftLint/issues/4692) * Fix false positives on `private_subject` rule when using subjects inside functions. [Marcelo Fabri](https://github.com/marcelofabri) [#4643](https://github.com/realm/SwiftLint/issues/4643) * Fix for compiler directives masking subsequent `opening_brace` violations. [Martin Redington](https://github.com/mildm8nnered) [#3712](https://github.com/realm/SwiftLint/issues/3712) * Rewrite `explicit_type_interface` rule with SwiftSyntax fixing a false-positive in if-case-let statements. [SimplyDanny](https://github.com/SimplyDanny) [#4548](https://github.com/realm/SwiftLint/issues/4548) * Ensure that negative literals in initializers do not trigger `no_magic_numbers` rule. [SimplyDanny](https://github.com/SimplyDanny) [#4677](https://github.com/realm/SwiftLint/issues/4677) * Fix caching of `indentation_width` rule. [SimplyDanny](https://github.com/SimplyDanny) [#4121](https://github.com/realm/SwiftLint/issues/4121) * Updated JUnit reporter to output error count and warning count. [patricks](https://github.com/patricks) [#4725](https://github.com/realm/SwiftLint/pull/4725) * Fix correction on `lower_acl_than_parent` rule for `open` declarations. [Marcelo Fabri](https://github.com/marcelofabri) [#4753](https://github.com/realm/SwiftLint/issues/4753) * Fix `void_return` rule to support async and async throws functions. [Mathias Schreck](https://github.com/lo1tuma) [#4772](https://github.com/realm/SwiftLint/issues/4772) * Fix false positives in `attributes` rule when using property wrappers with keypath arguments. [JP Simard](https://github.com/jpsim) --- ### Using Bazel Put this in your `WORKSPACE`: <details> <summary>WORKSPACE</summary> ```python load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "build_bazel_rules_apple", sha256 = "43737f28a578d8d8d7ab7df2fb80225a6b23b9af9655fcdc66ae38eb2abcf2ed", url = "https://github.com/bazelbuild/rules_apple/releases/download/2.0.0/rules_apple.2.0.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 = "f0e37c2ca277ef8c50d865cbdb75326592bcba11b786caf1fccc3111e9925e01", url = "https://github.com/realm/SwiftLint/releases/download/0.51.0-rc.2/bazel.tar.gz", ) load("@SwiftLint//bazel:repos.bzl", "swiftlint_repos") swiftlint_repos() load("@SwiftLint//bazel:deps.bzl", "swiftlint_deps") swiftlint_deps() ``` </details> Then you can run SwiftLint in the current directory with this command: ```console bazel run @SwiftLint//:swiftlint -- --help ```
0.51.0-rc.1: bzllint
1 year ago
This is a prerelease version. It won't be published to Homebrew, CocoaPods or bzlmod. 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 from `portable_swiftlint/swiftlint` to `/usr/local/bin` or elsewhere in your `PATH` * Using [Mint](https://github.com/yonaskolb/Mint): `mint install realm/[email protected]` * Cloning and building from source: `git clone https://github.com/realm/SwiftLint.git && cd SwiftLint && git checkout 0.51.0-rc.1 && make install` * Docker: ```docker run -it -v `pwd`:`pwd` -w `pwd` ghcr.io/realm/swiftlint:0.51.0-rc.1``` * Bazel: See instructions at the bottom Changes from 0.50.3: https://github.com/realm/SwiftLint/compare/0.50.3...0.51.0-rc.1 --- #### Breaking * Deprecate the `unused_capture_list` rule in favor of the Swift compiler warning. At the same time, make it an opt-in rule. [Cyberbeni](https://github.com/Cyberbeni) [#4656](https://github.com/realm/SwiftLint/issues/4656) * Deprecate the `inert_defer` rule in favor of the Swift compiler warning. At the same time, make it an opt-in rule. [SimplyDanny](https://github.com/SimplyDanny) [#4615](https://github.com/realm/SwiftLint/issues/4615) #### Experimental * None. #### Enhancements * Add local links to rule descriptions to every rule listed in `Rule Directory.md`. [kattouf](https://github.com/kattouf) * Make forceExclude work with directly specified files. [jimmya](https://github.com/jimmya) [#issue_number](https://github.com/realm/SwiftLint/issues/4609) * Separate analyzer rules as an independent section in the rule directory of the reference. [Ethan Wong](https://github.com/GetToSet) [#4664](https://github.com/realm/SwiftLint/pull/4664) * Add rule identifier to output of Emoji reporter. [SimplyDanny](https://github.com/SimplyDanny) [#4707](https://github.com/realm/SwiftLint/issues/4707) * Interpret strings in `excluded` option of `identifier_name`, `type_name` and `generic_type_name` rules as regex. [Moly](https://github.com/kyounh12) [#4655](https://github.com/realm/SwiftLint/pull/4655) * Add new `direct_return` rule that triggers on `return` statements returning variables that have been declared in the statement before only. [SimplyDanny](https://github.com/SimplyDanny) * Add `period_spacing` opt-in rule that checks periods are not followed by 2 or more spaces in comments. [Julioacarrettoni](https://github.com/Julioacarrettoni) [#4624](https://github.com/realm/SwiftLint/pull/4624) * Allow to pass a rule identifier to the `swiftlint docs` command to open its specific documentation website, e.g. `swiftlint docs for_where`. [SimplyDanny](https://github.com/SimplyDanny) [#4707](https://github.com/realm/SwiftLint/issues/4707) * Allow new Quick APIs `aroundEach` and `justBeforeEach` for `quick_discouraged_call`. [David Steinacher](https://github.com/stonko1994) [#4626](https://github.com/realm/SwiftLint/issues/4626) * Add `relative-path` reporter to generate reports with relative file paths. [Roya1v](https://github.com/roya1v) [#4660](https://github.com/realm/SwiftLint/issues/4660) * Let `number_separator` rule trigger on misplaced separators, e.g. `10_00`. [SimplyDanny](https://github.com/SimplyDanny) [#4637](https://github.com/realm/SwiftLint/issues/4637) * Rewrite `multiline_arguments` rule using SwiftSyntax, ignoring trailing closures. [Marcelo Fabri](https://github.com/marcelofabri) [#3399](https://github.com/realm/SwiftLint/issues/3399) [#3605](https://github.com/realm/SwiftLint/issues/3605) * Speed up linting by up to 6% updating to use a newer version of `SwiftSyntax`. [JP Simard](https://github.com/jpsim) * Catch more valid `legacy_multiple` violations. [JP Simard](https://github.com/jpsim) * Catch more valid `no_magic_numbers` violations. [JP Simard](https://github.com/jpsim) #### Bug Fixes * Report violations in all `<scope>_length` rules when the error threshold is smaller than the warning threshold. [SimplyDanny](https://github.com/SimplyDanny) [#4645](https://github.com/realm/SwiftLint/issues/4645) * Consider custom attributes in `attributes` rule. [SimplyDanny](https://github.com/SimplyDanny) [#4599](https://github.com/realm/SwiftLint/issues/4599) * Stop triggering `strict_fileprivate` rule on symbols implementing a protocol in the same file. [SimplyDanny](https://github.com/SimplyDanny) [#4692](https://github.com/realm/SwiftLint/issues/4692) * Fix false positives on `private_subject` rule when using subjects inside functions. [Marcelo Fabri](https://github.com/marcelofabri) [#4643](https://github.com/realm/SwiftLint/issues/4643) * Fix for compiler directives masking subsequent `opening_brace` violations. [Martin Redington](https://github.com/mildm8nnered) [#3712](https://github.com/realm/SwiftLint/issues/3712) * Rewrite `explicit_type_interface` rule with SwiftSyntax fixing a false-positive in if-case-let statements. [SimplyDanny](https://github.com/SimplyDanny) [#4548](https://github.com/realm/SwiftLint/issues/4548) * Ensure that negative literals in initializers do not trigger `no_magic_numbers` rule. [SimplyDanny](https://github.com/SimplyDanny) [#4677](https://github.com/realm/SwiftLint/issues/4677) * Fix caching of `indentation_width` rule. [SimplyDanny](https://github.com/SimplyDanny) [#4121](https://github.com/realm/SwiftLint/issues/4121) * Updated JUnit reporter to output error count and warning count. [patricks](https://github.com/patricks) [#4725](https://github.com/realm/SwiftLint/pull/4725) * Fix correction on `lower_acl_than_parent` rule for `open` declarations. [Marcelo Fabri](https://github.com/marcelofabri) [#4753](https://github.com/realm/SwiftLint/issues/4753) * Fix `void_return` rule to support async and async throws functions. [Mathias Schreck](https://github.com/lo1tuma) [#4772](https://github.com/realm/SwiftLint/issues/4772) * Fix false positives in `attributes` rule when using property wrappers with keypath arguments. [JP Simard](https://github.com/jpsim) --- ### Using Bazel Put this in your `WORKSPACE`: <details> <summary>WORKSPACE</summary> ```python load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "build_bazel_rules_apple", sha256 = "43737f28a578d8d8d7ab7df2fb80225a6b23b9af9655fcdc66ae38eb2abcf2ed", url = "https://github.com/bazelbuild/rules_apple/releases/download/2.0.0/rules_apple.2.0.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 = "f44b1e1c9aac0b4febbfae8479fc4e60df099066076fb10dfc0f42fd83731170", url = "https://github.com/realm/SwiftLint/releases/download/0.51.0-rc.1/bazel.tar.gz", ) load("@SwiftLint//bazel:repos.bzl", "swiftlint_repos") swiftlint_repos() load("@SwiftLint//bazel:deps.bzl", "swiftlint_deps") swiftlint_deps() ``` </details> Then you can run SwiftLint in the current directory with this command: ```console bazel run @SwiftLint//:swiftlint -- --help ```
macOS linux
realm/realm-swift vv5.0.0-beta.1
Realm is a mobile database: a replacement for Core Data & SQLite
⭐️ 16,134
🕓 1 year ago
🔖 Release Notes

Releases

The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
v10.49.3
Yesterday
### Enhancements * Enable building RealmSwift as a dynamic framework when installing via SPM, which lets us supply a privacy manifest. When RealmSwift is built as a static library you must supply your own manifest, as Xcode does not build static libraries in a way compatible with xcprivacy embedding. Due to some bugs in Xcode, this may require manual changes to your project: - Targets must now depend on only Realm or RealmSwift. If you use both the obj-c and swift API, depending on RealmSwift will let you import Realm. Trying to directly depend on both will give the error "Swift package target 'Realm' is linked as a static library by 'App' and 'Realm', but cannot be built dynamically because there is a package product with the same name." - To actually build RealmSwift as a dynamic framework, change "Do Not Embed" to "Embed & Sign" in the "Frameworks, Libraries, and Embedded Content" section on the General tab of your target's settings. ([#8561](https://github.com/realm/realm-swift/pull/8561)). ### Compatibility * Realm Studio: 14.0.1 or later. * APIs are backwards compatible with all previous releases in the 10.x.y series. * Carthage release for Swift is built with Xcode 15.3.0. * CocoaPods: 1.10 or later. * Xcode: 14.2-15.3.0.
v10.49.2
2 weeks ago
### Enhancements * The default base url in `AppConfiguration` has been updated to point to `services.cloud.mongodb.com`. See https://www.mongodb.com/docs/atlas/app-services/domain-migration/ for more information. ([#8512](https://github.com/realm/realm-swift/issues/8512)) ### Fixed * Fixed a crash that would occur when an http error 401 or 403 is returned upon opening a watch stream for a MongoDB collection. ([#8519](https://github.com/realm/realm-swift/issues/8519)) * Fix an assertion failure "m_lock_info && m_lock_info->m_file.get_path() == m_filename" that appears to be related to opening a Realm while the file is in the process of being closed on another thread. ([#8507](https://github.com/realm/realm-swift/issues/8507)) * Fixed diverging history due to a bug in the replication code when setting default null values (embedded objects included). ([Core #7536](https://github.com/realm/realm-core/issues/7536)) * Null pointer exception may be triggered when logging out and async commits callbacks not executed. ([Core #7434](https://github.com/realm/realm-core/issues/7434)) * `AppConfiguration.baseUrl` will now return the default value of the url when not set rather than `nil`. ([#8512](https://github.com/realm/realm-swift/issues/8512)) * Added privacy manifest to Core's Swift package ([Swift #8535](https://github.com/realm/realm-swift/issues/8535)) * Fixed crash when integrating removal of already removed dictionary key ([Core #7488](https://github.com/realm/realm-core/issues/7488), since v10.0.0) ### Compatibility * Realm Studio: 15.0.0 or later. * APIs are backwards compatible with all previous releases in the 10.x.y series. * Carthage release for Swift is built with Xcode 15.3.0. * CocoaPods: 1.10 or later. * Xcode: 14.2-15.3.0. ### Internal * Upgraded realm-core from 14.4.1 to 14.5.2
v10.49.1
5 weeks ago
### Enhancements * Improve file compaction performance on arm64 platforms for encrypted files between 16kB and 4MB in size. ([PR #7492](https://github.com/realm/realm-core/pull/7492)). ### Fixed * Opening a Realm with a cached user while offline would fail to retry some steps of the connection process and instead report a fatal error. ([#7349](https://github.com/realm/realm-core/issues/7349), since v10.46.0) ### Compatibility * Realm Studio: 14.0.1 or later. * APIs are backwards compatible with all previous releases in the 10.x.y series. * Carthage release for Swift is built with Xcode 15.3.0. * CocoaPods: 1.10 or later. * Xcode: 14.2-15.3.0. ### Internal * Upgraded realm-core from v14.3.0 to 14.4.1
v10.49.0
5 weeks ago
This version introduces a new Realm file format version (v24). Opening existing Realm files will automatically upgrade the files, making them unable to be opened by older versions. This upgrade process should typically be very fast unless you have large Sets of AnyRealmValue, String, or Data, which have to be rewritten. A backup will automatically be created next to the Realm before performing the upgrade. Downgrading to older versions of Realm will attempt to automatically restore the backup, or it will be deleted after three months. ### Enhancements * Storage of Decimal128 properties has been optimised similarly to Int properties so that the individual values will take up 0 bits (if all nulls), 32 bits, 64 bits or 128 bits depending on what is needed. ([Core #6111](https://github.com/realm/realm-core/pull/6111)) * Improve file compaction performance on arm64 platforms for encrypted files between 16kB and 4MB in size. ([PR #7492](https://github.com/realm/realm-core/pull/7492)). ### Fixed * Sorting on binary Data was done by comparing bytes as signed char rather than unsigned char, resulting in very strange orders (since sorting on Data was enabled in v6.0.4) * Sorting on AnyRealmValue did not use a valid total ordering, and certain combinations of values could result in values not being sorted or potentially even crashes. The resolution for this will result in some previously-valid combinations of values of different types being sorted in different orders than previously (since the introduction of AnyRealmValue in 10.8.0). * RLMSet/MutableSet was inconsistent about if it considered a String and a Data containing the utf-8 encoded bytes of that String to be equivalent. They are now always considered distinct. (since the introduction of sets in v10.8.0). * Equality queries on a Mixed property with an index could sometimes return incorrect results if values of different types happened to have the same hash code. ([Core 6407](https://github.com/realm/realm-core/issues/6407) since v10.8.0). * Creating more than 8388606 links pointing to a single object would crash. ([Core #6577](https://github.com/realm/realm-core/issues/6577), since v5.0.0) * A Realm generated on a non-apple ARM 64 device and copied to another platform (and vice-versa) were non-portable due to a sorting order difference. This impacts strings or binaries that have their first difference at a non-ascii character. These items may not be found in a set, or in an indexed column if the strings had a long common prefix (> 200 characters). ([Core #6670](https://github.com/realm/realm-core/pull/6670), since 2.0.0 for indexes, and since since the introduction of sets in v10.8.0) * Fix a spurious crash related to opening a Realm on background thread while the process was in the middle of exiting ([Core #7420](https://github.com/realm/realm-core/pull/7420)). * Opening a Realm with a cached user while offline would fail to retry some steps of the connection process and instead report a fatal error. ([#7349](https://github.com/realm/realm-core/issues/7349), since v10.46.0) ### Breaking Changes * Drop support for opening pre-v5.0.0 Realm files. ### Compatibility * Realm Studio: 14.0.1 or later. * APIs are backwards compatible with all previous releases in the 10.x.y series. * Carthage release for Swift is built with Xcode 15.3.0. * CocoaPods: 1.10 or later. * Xcode: 14.2-15.3.0. Note that we will be dropping support for Xcode 14 when Apple begins requiring Xcode 15 for app store submissions on April 29. ### Internal * Upgraded realm-core from 13.26.0 to 14.3.0
v10.48.1
6 weeks ago
### Fixed * The Realm.framework privacy manifest was missing NSPrivacyAccessedAPICategoryDiskSpace, but we check free disk space before attempting to automatically back up Realm files (since 10.46.0). ### Compatibility * Realm Studio: 14.0.1 or later. * APIs are backwards compatible with all previous releases in the 10.x.y series. * Carthage release for Swift is built with Xcode 15.3.0. * CocoaPods: 1.10 or later. * Xcode: 14.2-15.3.0.
v10.48.0
7 weeks ago
### Enhancements * Lifted a limitation that would prevent declaring a model with only computed properties. ([#8414](https://github.com/realm/realm-swift/issues/8414)) * Add Xcode 15.3 to the release package ([PR #8502](https://github.com/realm/realm-swift/pull/8502)). ### Fixed * Fix multiple arguments support via the `REALM_EXTRA_BUILD_ARGUMENTS` environment variable in `build.sh`. ([PR #8413](https://github.com/realm/realm-swift/pulls/8413)). Thanks, [@hisaac](https://github.com/hisaac)! * Fix some of the new sendability warnings introduced in Xcode 15.3 ([PR #8502](https://github.com/realm/realm-swift/pull/8502)). ### Compatibility * Realm Studio: 14.0.1 or later. * APIs are backwards compatible with all previous releases in the 10.x.y series. * Carthage release for Swift is built with Xcode 15.3.0. * CocoaPods: 1.10 or later. * Xcode: 14.2-15.3.0.
v10.47.0
11 weeks ago
### Enhancements * Added initial support for geospatial queries on points. There is no new dedicated type to store Geospatial points, instead points should be stored as ([GeoJson-shaped](https://www.mongodb.com/docs/manual/reference/geojson/)) embedded object, as the example below: ```swift public class Location: EmbeddedObject { @Persisted private var coordinates: List<Double> @Persisted private var type: String = "Point" public var latitude: Double { return coordinates[1] } public var longitude: Double { return coordinates[0] } convenience init(_ latitude: Double, _ longitude: Double) { self.init() // Longitude comes first in the coordinates array of a GeoJson document coordinates.append(objectsIn: [longitude, latitude]) } } ``` Geospatial queries (`geoWithin`) can only be executed on such a type of objects and will throw otherwise. The queries can be used to filter objects whose points lie within a certain area, using the following pre-established shapes (`GeoBox`, `GeoPolygon`, `GeoCircle`). ```swift class Person: Object { @Persisted var name: String @Persisted var location: Location? // GeoJson embedded object } let realm = realmWithTestPath() try realm.write { realm.add(PersonLocation(name: "Maria", location: Location(latitude: 55.6761, longitude: 12.5683))) } let shape = GeoBox(bottomLeft: (55.6281, 12.0826), topRight: (55.6762, 12.5684))! let locations = realm.objects(PersonLocation.self).where { $0.location.geoWithin(shape) }) ``` A `filter` or `NSPredicate` can be used as well to perform a Geospatial query. ```swift let shape = GeoPolygon(outerRing: [(-2, -2), (-2, 2), (2, 2), (2, -2), (-2, -2)], holes: [[(0, 0), (1, 1), (-1, 1), (0, 0)]])! let locations = realm.objects(PersonLocation.self).filter("location IN %@", shape) let locations = realm.objects(PersonLocation.self).filter(NSPredicate(format: "location IN %@", shape)) ``` ### Compatibility * Realm Studio: 14.0.1 or later. * APIs are backwards compatible with all previous releases in the 10.x.y series. * Carthage release for Swift is built with Xcode 15.2.0. * CocoaPods: 1.10 or later. * Xcode: 14.2-15.2.0. ### Internal * Migrated Release pipelines to Github Actions.
v10.46.0
14 weeks ago
### Enhancements * Add a privacy manifest to both frameworks. * Internal C++ symbols are no longer exported from Realm.framework when installing via CocoaPods, which reduces the size of the binary by ~5%, improves app startup time a little, and eliminates some warnings when linking the framework. This was already the case when using Carthage or a prebuilt framework ([PR #8464](https://github.com/realm/realm-swift/pull/8464)). * The `baseURL` field of `AppConfiguration` can now be updated, rather than the value being persisted between runs of the application in the metadata storage. ([Core #7201](https://github.com/realm/realm-core/issues/7201)) * Allow in-memory synced Realms. This will allow setting an in-memory identifier on a flexible sync realm. ### Fixed * `@Persisted`'s Encodable implementation did not allow the encoder to customize the encoding of values, which broke things like JSONEncoder's `dateEncodingStrategy` ([#8425](https://github.com/realm/realm-swift/issues/8425)). * Fix running Package.swift on Linux to support tools like Dependabot which need to build the package description but not the package itself ([#8458](https://github.com/realm/realm-swift/issues/8458), since v10.40.1). ### Breaking Changes * The `schemaVersion` field of `Realm.Configuration` must now always be zero for synchronized Realms. Schema versions are currently not applicable to synchronized Realms and the field was previously not read. ### Compatibility * Realm Studio: 14.0.1 or later. * APIs are backwards compatible with all previous releases in the 10.x.y series. * Carthage release for Swift is built with Xcode 15.2.0. * CocoaPods: 1.10 or later. * Xcode: 14.2-15.2.0. ### Internal * Upgraded realm-core from 13.25.1 to 13.26.0
v10.45.3
16 weeks ago
### Enhancements * Update release packaging for Xcode 15.2. Prebuilt binaries for 14.1 and 15.0 have now been dropped from the release package. ### Compatibility * Realm Studio: 14.0.1 or later. * APIs are backwards compatible with all previous releases in the 10.x.y series. * Carthage release for Swift is built with Xcode 15.2.0. * CocoaPods: 1.10 or later. * Xcode: 14.2-15.2.0.
v10.45.2
18 weeks ago
### Enhancements * Greatly improve the performance of creating objects with a very large number of pre-existing incoming links. This is primarily relevant to initial sync bootstrapping when linking objects happen to be synchronized before the target objects they link to ([Core #7217](https://github.com/realm/realm-core/issues/7217), since v10.0.0). ### Fixed * Registering new notifications inside write transactions before actually making any changes is now actually allowed. This was supposed to be allowed in 10.39.1, but it did not actually work due to some redundant validation. * `SyncSession.ProgressDirection` and `SyncSession.ProgressMode` were missing `Sendable` annotations ([PR #8435](https://github.com/realm/realm-swift/pull/8435)). * `Realm.Error.subscriptionFailed` was reported with the incorrect error domain, making it impossible to catch (since v10.42.2, [PR #8435](https://github.com/realm/realm-swift/pull/8435)). ### Compatibility * Realm Studio: 14.0.1 or later. * APIs are backwards compatible with all previous releases in the 10.x.y series. * Carthage release for Swift is built with Xcode 15.1.0. * CocoaPods: 1.10 or later. * Xcode: 14.1-15.1.0. ### Internal * Upgraded realm-core from 13.25.0 to 13.25.1
iOS macOS watchOS tvOS
realm/realm-core worked-for-java
Core database component for the Realm Mobile Database SDKs
⭐️ 991
🕓 4 hours ago
🔖 Release Notes

Releases

The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
RealmCore v14.6.2
21 hours ago
### Enhancements * None. ### Fixed * Fixed a bug when running a IN query on a String/Int/UUID/ObjectId property that was indexed. ([7642](https://github.com/realm/realm-core/issues/7642) since v14.6.0) * Fixed a bug when running a IN query on a integer property where double/float parameters were ignored. ([7642](https://github.com/realm/realm-core/issues/7642) since v14.6.0) ### Breaking changes * None. ### Compatibility * Fileformat: Generates files with format v24. Reads and automatically upgrade from fileformat v10. If you want to upgrade from an earlier file format version you will have to use RealmCore v13.x.y or earlier.
RealmCore v14.6.1
Yesterday
### Enhancements * None. ### Fixed * Fix assertion failure or wrong results when evaluating a RQL query with multiple IN conditions on the same property. Applies to non-indexed int/string/ObjectId/UUID properties, or if they were indexed and had > 100 conditions. ((RCORE-2098) [PR #7628](https://github.com/realm/realm-core/pull/7628) since v14.6.0). * Fixed a bug when running a IN query (or a query of the pattern `x == 1 OR x == 2 OR x == 3`) when evaluating on a string property with an empty string in the search condition. Matches with an empty string would have been evaluated as if searching for a null string instead. ([PR #7628](https://github.com/realm/realm-core/pull/7628) since v10.0.0-beta.9) * Fixed a bug when running a IN query on a String/Int/UUID/ObjectId property that was indexed. ([7642](https://github.com/realm/realm-core/issues/7642) since v14.6.0) * Fixed a bug when running a IN query on a integer property where double/float parameters were ignored. ([7642](https://github.com/realm/realm-core/issues/7642) since v14.6.0) ### Breaking changes * None. ### Compatibility * Fileformat: Generates files with format v24. Reads and automatically upgrade from fileformat v10. If you want to upgrade from an earlier file format version you will have to use RealmCore v13.x.y or earlier. ----------- ### Internals * Follow on to ([PR #7300](https://github.com/realm/realm-core/pull/7300)) to allow SDKs to construct a fake user for testing SyncManager::get_user -> App::create_fake_user_for_testing ([PR #7632](https://github.com/realm/realm-core/pull/7632)) * Fix build-apple-device.sh, broken in [#7603](https://github.com/realm/realm-core/pull/7603) ([PR #7640](https://github.com/realm/realm-core/pull/7640)). * Added a CAPI interface for SDKs to bring their own managed users with core's app services turned off. ([PR #7615](https://github.com/realm/realm-core/pull/7615)). * Bump the minimum deployment targets on Apple platforms to the minimums supported by Xcode 15 and clean up now unused availability checks. ([PR #7648](https://github.com/realm/realm-core/pull/7648)). * Build with -Werror on CI to ensure that new warnings don't slip in. ([PR #7646](https://github.com/realm/realm-core/pull/7646))
RealmCore v14.6.0
5 days ago
### Enhancements * Add `SyncClientConfig::security_access_group` which allows specifying the access group to use for the sync metadata Realm's encryption key. Setting this is required when sharing the metadata Realm between apps on Apple platforms ([PR #7552](https://github.com/realm/realm-core/pull/7552)). * When connecting to multiple server apps, a unique encryption key is used for each of the metadata Realms rather than sharing one between them ([#7552](https://github.com/realm/realm-core/pull/7552)). * Introduce the new `SyncUser` interface which can be implemented by SDKs to use sync without the core App Services implementation (or just for greater control over user behavior in tests). ([PR #7300](https://github.com/realm/realm-core/pull/7300)). * Improve perfomance of "chained OR equality" queries for UUID/ObjectId types and RQL parsed "IN" queries on string/int/uuid/objectid types. ([.Net #3566](https://github.com/realm/realm-dotnet/issues/3566), since the introduction of these types) * Introducing `Query::in()` which allows SDKs to take advantage of improved performance when building equality conditions against many constants. ([PR #7582](https://github.com/realm/realm-core/pull/7582)) ### Fixed * SyncUser::all_sessions() included sessions in every state *except* for waiting for access token, which was weirdly inconsistent. It now includes all sessions. ([PR #7300](https://github.com/realm/realm-core/pull/7300)). * App::all_users() included logged out users only if they were logged out while the App instance existed. It now always includes all logged out users. ([PR #7300](https://github.com/realm/realm-core/pull/7300)). * Deleting the active user left the active user unset rather than selecting another logged-in user as the active user like logging out and removing users did. ([PR #7300](https://github.com/realm/realm-core/pull/7300)). * Fixed several issues around encrypted file portability (copying a "bundled" encrypted Realm from one device to another): * Fixed `Assertion failed: new_size % (1ULL << m_page_shift) == 0` when opening an encrypted Realm less than 64Mb that was generated on a platform with a different page size than the current platform. ([#7322](https://github.com/realm/realm-core/issues/7322), since v13.17.1) * Fixed a `DecryptionFailed` exception thrown when opening a small (<4k of data) Realm generated on a device with a page size of 4k if it was bundled and opened on a device with a larger page size (since the beginning). * Fixed an issue during a subsequent open of an encrypted Realm for some rare allocation patterns when the top ref was within ~50 bytes of the end of a page. This could manifest as a DecryptionFailed exception or as an assertion: `encrypted_file_mapping.hpp:183: Assertion failed: local_ndx < m_page_state.size()`. ([#7319](https://github.com/realm/realm-core/issues/7319)) * Non-streaming download sync progress notification is fixed for flexible sync Realms where before it was sometimes stopping to emit values right after the registration of the callback ([#7561](https://github.com/realm/realm-core/issues/7561)). * Schema initialization could hit an assertion failure if the sync client applied a downloaded changeset while the Realm file was in the process of being opened ([#7041](https://github.com/realm/realm-core/issues/7041), since v11.4.0). * Queries using query paths on Mixed values returns inconsistent results ([#7587](https://github.com/realm/realm-core/issues/7587), since v14.0.0) * Enabling 'cancel_waits_on_nonfatal_error' does not cancel waits during location update while offline ([#7527](https://github.com/realm/realm-core/issues/7527), since v13.26.0) ### Breaking changes * The following things have been renamed or moved as part of moving all of the App Services functionality to the app namespace: - SyncUser -> app::User. Note that there is a new, different type named SyncUser. - SyncUser::identity -> app::User::user_id. The "identity" word was overloaded to mean two unrelated things, and one has been changed to user_id everywhere. - SyncUserSubscriptionToken -> app::UserSubscriptionToken - SyncUserProfile -> app::UserProfile - App::Config -> AppConfig - SyncConfig::MetadataMode -> AppConfig::MetadataMode - MetadataMode::NoMetadata -> MetadataMode::InMemory - SyncUser::session_for_on_disk_path() -> SyncManager::get_existing_session() - SyncUser::all_sessions() -> SyncManager::get_all_sessions_for(User&) - SyncManager::immediately_run_file_actions() -> App::immediately_run_file_actions() - realm_sync_user_subscription_token -> realm_app_user_subscription_token ([PR #7300](https://github.com/realm/realm-core/pull/7300)). * The `ClientAppDeallocated` error code no longer exists as this error code can no longer occur. ([PR #7300](https://github.com/realm/realm-core/pull/7300)). * Some fields have moved from SyncClientConfig to AppConfig. AppConfig now has a SyncClientConfig field rather than it being passed separately to App::get_app(). ([PR #7300](https://github.com/realm/realm-core/pull/7300)). * Sync user management has been removed from SyncManager. This functionality was already additionally available on App. ([PR #7300](https://github.com/realm/realm-core/pull/7300)). * AuditConfig now has a base_file_path field which must be set by the SDK rather than inheriting it from the SyncManager. ([PR #7300](https://github.com/realm/realm-core/pull/7300)). * App::switch_user() no longer returns a user. The return value was always exactly the passed-in user and any code which needs it can just use that. ([PR #7300](https://github.com/realm/realm-core/pull/7300)). * Non-streaming download progress callback no longer stops reporting values immediately after the registration (if the progress update has happened earlier), but waits for the next batch of data to start syncing to report its progress, since the previous behaviour was not useful (PR [#7561](https://github.com/realm/realm-core/issues/7561)). ### Compatibility * Fileformat: Generates files with format v24. Reads and automatically upgrade from fileformat v10. If you want to upgrade from an earlier file format version you will have to use RealmCore v13.x.y or earlier. ----------- ### Internals * App metadata storage has been entirely rewritten in preparation for supporting sharing metadata realms between processes. ([PR #7300](https://github.com/realm/realm-core/pull/7300)). * The metadata disabled mode has been replaced with an in-memory metadata mode which performs similarly and doesn't work weirdly differently from the normal mode. The new mode is intended for testing purposes, but should be suitable for production usage if there is a scenario where metadata persistence is not needed. ([PR #7300](https://github.com/realm/realm-core/pull/7300)). * The ownership relationship between App and User has changed. User now strongly retains App and App has a weak cache of Users. This means that creating a SyncConfig or opening a Realm will keep the parent App alive, rather than things being in a broken state if the App is deallocated. ([PR #7300](https://github.com/realm/realm-core/pull/7300). * A new CMake define `REALM_APP_SERVICES` can be used to compile out core's default implmentation of the application services. ([#7268](https://github.com/realm/realm-core/issues/7268)) * Fix a race condition in Promise which could result in an assertion failure if it was destroyed immediately after a `get()` on the Future returned. The problematic scenario only occurred in test code and not in library code ([PR #7602](https://github.com/realm/realm-core/pull/7602)). * Catch2 is no longer required as a submodule if the `REALM_NO_TESTS` flag is set. * Sha-2 is no longer required as a submodule on Windows if linking with OpenSSL. * The Catch2 submodule has moved to `test/external/catch`. * Fix possible file corruption if using Transaction::copy_to if nested collections are present. * Evergreen config was udpated so most linux CI testing is done on ubuntu 22.04 on aarch64 with clang 18, upgrading from clang 11 on ubuntu 20.04 mostly on x86_64 ([PR #7475](https://github.com/realm/realm-core/pull/7475)). * Evergreen config was updated to move most MacOS testing to MacOS 14 on arm64 with Xcode 15.2, updating from Macos 11 on x86_64 with Xcode 13.1 ([PR #7618](https://github.com/realm/realm-core/pull/7618)).
RealmCore v14.5.2
2 weeks ago
### Fixed * Fix compilation errors when using command-line `swift build` ([#7587](https://github.com/realm/realm-core/pull/7587), since v14.5.1). * Fixed crash when integrating removal of already removed dictionary key ([#7488](https://github.com/realm/realm-core/issues/7488), since v10.0.0). ### Compatibility * Fileformat: Generates files with format v24. Reads and automatically upgrade from fileformat v10. If you want to upgrade from an earlier file format version you will have to use RealmCore v13.x.y or earlier. ----------- ### Internals * `prior_size` field in Clear instruction is being repurposed as `collection_type` (no protocol changes required)
RealmCore v14.5.1
2 weeks ago
# 14.5.1 Release notes ### Fixed * Clearing a nested collection may end with a crash ([#7556](https://github.com/realm/realm-core/issues/7556), since v14.0.0) * Removing nested collections in Mixed for synced realms throws realm::StaleAccessor ([#7573](https://github.com/realm/realm-core/issues/7573), since v14.0.0) * Add a privacy manifest to the Swift package ([Swift #8535](https://github.com/realm/realm-swift/issues/8535)). ### Compatibility * Fileformat: Generates files with format v24. Reads and automatically upgrade from fileformat v10. If you want to upgrade from an earlier file format version you will have to use RealmCore v13.x.y or earlier.
14.5.0
3 weeks ago
### Enhancements * Introduce sync 'progress_estimate' parameter (value from 0.0 to 1.0) for existing sync 'ProgressNotifierCallback' api to report sync progress on current batch of upload/download until completion ([#7450](https://github.com/realm/realm-core/issues/7450)) ### Fixed * Fix an assertion failure "m_lock_info && m_lock_info->m_file.get_path() == m_filename" that appears to be related to opening a Realm while the file is in the process of being closed on another thread ([Swift #8507](https://github.com/realm/realm-swift/issues/8507)). * Fixed diverging history due to a bug in the replication code when setting default null values (embedded objects included) ([#7536](https://github.com/realm/realm-core/issues/7536)). * Version 19.39.33523 of MSVC would crash when compiling for arm64 in release mode ([PR #7533](https://github.com/realm/realm-core/pull/7533)). * Null pointer exception may be triggered when logging out and async commits callbacks not executed ([#7434](https://github.com/realm/realm-core/issues/7434), since v13.26.0) * Fixed building for iPhone simulators targeting deployment target 11 ([#7554](https://github.com/realm/realm-core/pull/7554)). ### Breaking changes * Updated default base URL to be `https://services.cloud.mongodb.com` to support the new domains (was `https://realm.mongodb.com`). ([PR #7534](https://github.com/realm/realm-core/pull/7534)) ### Compatibility * Fileformat: Generates files with format v24. Reads and automatically upgrade from fileformat v10. If you want to upgrade from an earlier file format version you will have to use RealmCore v13.x.y or earlier. ----------- ### Internals * Update libuv used in object store tests from v1.35.0 to v1.48.0 ([PR #7508](https://github.com/realm/realm-core/pull/7508)). * Made `set_default_logger` nullable in the bindgen spec.yml (PR [#7515](https://github.com/realm/realm-core/pull/7515)). * Recreating the sync metadata Realm when the encryption key changes is now done in a multi-process safe manner ([PR #7526](https://github.com/realm/realm-core/pull/7526)). * Added `App::default_base_url()` static accessor for SDKs to retrieve the default base URL from Core. ([PR #7534](https://github.com/realm/realm-core/pull/7534)) * Realm2JSON tool will now correctly upgrade file to current fileformat. * (bindgen) Remove dependency on the `clang-format` package and rely on a binary provided by the system instead.
5 weeks ago
# 14.4.1 Release notes ### Fixed * Fix pass a thread safe reference to init subscription callback. ([#7497](https://github.com/realm/realm-core/issues/7497), since v13.16.0) ### Compatibility * Fileformat: Generates files with format v24. Reads and automatically upgrade from fileformat v10. If you want to upgrade from an earlier file format version you will have to use RealmCore v13.x.y or earlier. ----------- ### Internals * Update Catch2 from v3.3.2 to v3.5.3 ([PR #7297](https://github.com/realm/realm-core/pull/7509)).
Realm Core v14.4.0
6 weeks ago
# 14.4.0 Release notes ### Enhancements * Nested path included in 'OutOfBoundsø error message ([#7438](https://github.com/realm/realm-core/issues/7438)) * Improve file compaction performance on platforms with page sizes greater than 4k (for example arm64 Apple platforms) for files less than 256 pages in size ([PR #7492](https://github.com/realm/realm-core/pull/7492)). ### Fixed * Modifying nested collections left the accessor used to make the modification in a stale state, resulting in some unneccesary work being done when making multiple modifications via one accessor ([PR #7470](https://github.com/realm/realm-core/pull/7470), since v14.0.0). * Fix depth level for nested collection in debug mode, set it to the same level as release ([#7484](https://github.com/realm/realm-core/issues/7484), since v14.0.0). * Fix opening realm with cached user while offline results in fatal error and session does not retry connection. ([#7349](https://github.com/realm/realm-core/issues/7349), since v13.26.0) * Fix disallow Sets in ArrayMixed. ([#7502](https://github.com/realm/realm-core/pull/7502), since v14.0.0) ### Breaking changes * Update C-API log callback signature to include the log category, and `realm_set_log_callback` to not take a `realm_log_level_e`. ([PR #7494](https://github.com/realm/realm-core/pull/7494) ### Compatibility * Fileformat: Generates files with format v24. Reads and automatically upgrade from fileformat v10. If you want to upgrade from an earlier file format version you will have to use RealmCore v13.x.y or earlier.
Realm Core v14.3.0
6 weeks ago
# 14.3.0 Release notes ### Enhancements * Add support to synchronize collections embedded in Mixed properties and other collections (except sets) ([PR #7353](https://github.com/realm/realm-core/pull/7353)). * Improve performance of change notifications on nested collections somewhat ([PR #7402](https://github.com/realm/realm-core/pull/7402)). * Improve performance of aggregate operations on Dictionaries of objects, particularly when the dictionaries are empty ([PR #7418](https://github.com/realm/realm-core/pull/7418)) * Added Resumption delay configuration to SyncClientTimeouts. ([PR #7441](https://github.com/realm/realm-core/pull/7441)) ### Fixed * Fixed conflict resolution bug which may result in an crash when the AddInteger instruction on Mixed properties is merged against updates to a non-integer type ([PR #7353](https://github.com/realm/realm-core/pull/7353)). * Fix a spurious crash related to opening a Realm on background thread while the process was in the middle of exiting ([#7420](https://github.com/realm/realm-core/issues/7420jj)) * Fix a data race in change notification delivery when running at debug log level ([PR #7402](https://github.com/realm/realm-core/pull/7402), since v14.0.0). * Fix a 10-15% performance regression when reading data from the Realm resulting from Obj being made a non-trivial type ([PR #7402](https://github.com/realm/realm-core/pull/7402), since v14.0.0). ### Breaking changes * Remove `realm_scheduler_set_default_factory()` and `realm_scheduler_has_default_factory()`, and change the `Scheduler` factory function to a bare function pointer rather than a `UniqueFunction` so that it does not have a non-trivial destructor. ### Compatibility * Fileformat: Generates files with format v24. Reads and automatically upgrade from fileformat v10. If you want to upgrade from an earlier file format version you will have to use RealmCore v13.x.y or earlier. ----------- ### Internals * The CMake option `REALM_MONGODB_ENDPOINT` for running the object-store-tests against baas has been deprecated in favor of an environment variable of the same name ([PR #7423](https://github.com/realm/realm-core/pull/7423)). * The object-store-tests test suite can now launch baas containers on its own by specifying a `BAASAAS_API_KEY` in the environment ([PR #7423](https://github.com/realm/realm-core/pull/7423)).
Realm Core v14.2.0
7 weeks ago
# 14.2.0 Release notes ### Enhancements * Added ability to get current log level via C API (PR [#7419](https://github.com/realm/realm-core/pull/7419)) * Improve performance of object notifiers with complex schemas and very simple changes to process by as much as 20% ([PR #7424](https://github.com/realm/realm-core/pull/7424)). * Improve performance with very large number of notifiers as much as 75% ([PR #7424](https://github.com/realm/realm-core/pull/7424)). ### Fixed * Fixed an issue when removing items from a LnkLst that could result in invalidated links becoming visable which could cause crashes or exceptions when accessing those list items later on. This affects sync Realms where another client had previously removed a link in a linklist that has over 1000 links in it, and then further local removals from the same list caused the list to have fewer than 1000 items. ([#7414](https://github.com/realm/realm-core/pull/7414), since v10.0.0) * Query lists vs lists if the property to check is a path with wildcards would not give correct result. This has for a long time also been a problem for queries with linklist properties in the path ([#7393](https://github.com/realm/realm-core/issues/7393), since v14.0.0) ### Breaking changes * The fix of querying involving multiple lists may cause tests that depended on the broken beharior to fail. ### Compatibility * Fileformat: Generates files with format v24. Reads and automatically upgrade from fileformat v10. If you want to upgrade from an earlier file format version you will have to use RealmCore v13.x.y or earlier. ----------- ### Internals * Fix several crashes when running the object store benchmarks ([#7403](https://github.com/realm/realm-core/pull/7403)). * The `dependencies.list` file that defines the realm core library version and the versions of its dependencies is now a YAML file called `dependencies.yml` ([PR #7394](https://github.com/realm/realm-core/pull/7394)). * Remove SetElementEquals and SetElementLessThan, as Mixed now uses the same comparisons as Set did.
iOS macOS watchOS tvOS

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics