Commit Graph

237 Commits

Author SHA1 Message Date
JP Simard 13703c4466 Update SourceKitFreeRules (#4097)
None of these rules use SourceKit
2022-08-16 00:56:03 +00:00
Danny Mösch ef515ac45e Fix false positive in yoda_condition rule basing it on SwiftSyntax (#4089) 2022-08-14 16:30:09 -04:00
Danny Mösch d730e0b3fa Let all example verification tests be generated by Sourcery (#4076) 2022-08-10 22:49:28 +02:00
Danny Mösch 449190d324 Verify examples in rules by default and enforce explicit exclusion (#4065)
A rule must conform to ManuallyTestedExamplesRule to skip generation of a test for its examples.
2022-08-09 22:32:09 +02:00
JP Simard 1ac0419eb6 Fix failing Swift 5.7 test (#4075)
Seems like `CGPoint` moved from the `CoreGraphics` module to the
`CoreFoundation` module.
2022-08-09 16:44:05 +00:00
Danny Mösch cdb87e3869 Verify all examples provided in rule descriptions (#4061) 2022-08-04 23:06:37 +02:00
Or Eliyahu 19eda14df1 Fix false positives in duplicated_key_in_dictionary_literal rule (#4057) 2022-07-31 21:07:15 +02:00
Marcelo Fabri 3a64518119 Fix false positive in self_in_property_initialization (#4044)
* Fix false positive in self_in_property_initialization

Fixes #4041

* Update CHANGELOG.md

Co-authored-by: JP Simard <jp@jpsim.com>

Co-authored-by: JP Simard <jp@jpsim.com>
2022-07-26 11:41:09 -07:00
Danny Mösch a51be7bcce Refactor deployment target configuration to avoid duplications (#4017) 2022-07-06 17:07:15 -04:00
Taha Bebek e34f49695b Support extension targets in deployment_target rule (#4011) 2022-07-05 22:41:56 +02:00
Danny Mösch 0d070a8c8c Update result builder methods in unused_declaration rule fixing some false-positives (#4000) 2022-06-19 11:59:23 +02:00
Ryan Cole 43c84146db Add accessibility_label_for_image rule (#3862)
Warns if a SwiftUI Image does not have an accessibility label and is not hidden from accessibility. When this is the case, the image's accessibility label defaults to the name of the image file causing a poor UX.
2022-04-18 10:40:51 +02:00
Chris Hale 9beef23175 Throw error on bad expiring todo date format (#3626) 2022-04-11 21:20:05 +02:00
Danny Moesch fa2a0bab6c Move StringView.byteOffset into generally accessible extension (#3917) 2022-03-25 07:27:50 +01:00
Danny Moesch a801bbc83b Add new type-safe ArrayInitRule (#3914)
The idea of this new Analyzer rule is to filter the calls of `map` before they are passed on to the classic ArrayInitRule which does the detailed checking of the lambda function block. The rule makes sure that only the `map` function is considered that is defined by the `Sequence` protocol.
2022-03-23 22:29:50 +01:00
JP Simard 83a86870bb Fix false positives in unused_closure_parameter (#3916)
When using parameters with backticks.
2022-03-23 16:57:23 -04:00
Marcelo Fabri 0e5d838765 Support #unavailable in deployment_target rule (#3898)
Fixes #3896
2022-03-16 10:41:04 -04:00
Marcelo Fabri db2721f78e Require Swift 5.0 in runtime (#3886)
* Require Swift 5.0 in runtime

* Fix violation

* Enable legacy_rule by default

* Update changelog

* Fix changelog after rebase

* More cleanup
2022-03-11 14:01:27 -08:00
tobias 811ca32c6d class_delegate_protocol: Add line break separator for protocol inheritance
clause to match format style with curly brackets on new line
2022-03-09 14:37:47 -05:00
JP Simard 2ae6a55ba4 Fix regression in unused_import rule when using Swift 5.6 (#3878)
Fixes https://github.com/realm/SwiftLint/issues/3849
2022-03-08 13:15:39 -05:00
Goran Blažič 7b7754ad3b Ignore MARK in multiline comment (#3844)
Fixes #1749 and #3841
2022-03-04 11:33:12 -05:00
Steven 09f6f1bc83 Fix class_delegate_protocol false positives when using where clause (#3829) 2022-01-27 06:03:53 -08:00
Danny Moesch 0f55447956 Use pre-defined set of extension kinds (#3814) 2022-01-24 09:55:01 -08:00
JP Simard 31872aaa3f Re-add 'weak_delegate' rule as opt-in
After feedback from users: https://github.com/realm/SwiftLint/pull/3809#issuecomment-1018859093
2022-01-21 16:57:13 -05:00
JP Simard 341ec2a907 Remove 'weak_delegate' rule (#3809)
This was very prone to false positives and not worth keeping.

The identifier will stick around for a release to ease the migration.
2022-01-21 17:56:59 +00:00
Sergei aff3536bb8 Fix the regex for expiring-todos. (#3803)
- Make "middle part" `.*` not so greedy with `?`.
- Use `(?!` negative look-ahead to improve matching.
- Added corresponding unit tests.

Co-authored-by: Sergei Shirokov <sshirokov@malwarebytes.com>
2022-01-21 17:42:17 +00:00
Ikko Ashimine 3d7775de11 Fix typo in CommentSpacingRule.swift (#3795)
charcter -> character
2022-01-21 07:47:14 -08:00
Paul Williamson 9e37d0fa44 Prevent false triggering of unused_closure_parameter when using list bindings (#3799) 2022-01-21 07:35:12 -08:00
grosem c90c329f12 Allow unused_setter_value for overrides (#3653)
Fixes #2585
2022-01-20 22:53:18 +00:00
Danny Mösch 050473a0e1 Add optional prefer_self_in_static_references rule (#3732) 2021-11-29 18:42:53 +00:00
JP Simard 2544d7b945 [unused_import] Fix SwiftShims being considered a used import (#3766) 2021-11-29 17:07:38 +00:00
Marcelo Fabri 4052c43f16 Make rule more generic and rename it 2021-09-29 10:28:39 -07:00
Marcelo Fabri 2674d367f9 Fix violation 2021-09-29 10:28:39 -07:00
Marcelo Fabri eb3a405930 Remove unused function 2021-09-29 10:28:39 -07:00
Marcelo Fabri 68bfc13941 Add add_target_in_variable_declaration_closure rule 2021-09-29 10:28:39 -07:00
Ben Fox 00799cc782 Fixes MissingDocRuleConfiguration (#3713)
* add configuration for missing_docs

* fix MissingDocsRuleConfiguration

* add to changelog

* fix up Config default values and update tests

* use XCTAssertTrue and XCTAssertFalse

* fix line length violation

* finish up unit tests

* rever Package.resolved
2021-09-13 15:23:55 -04:00
JP Simard 888619912f Run CI with Xcode 12.5.1 & Swift 5.4 (#3710)
And require Swift 5.4 or Xcode 12.5 or later to build SwiftLint.
2021-09-10 08:32:02 -07:00
JP Simard 986d98c475 Fix tests on Swift 5.5 / Xcode 13 (#3709) 2021-09-09 21:11:22 +00:00
Ben Fox 1f44d56357 add configuration for missing_docs (#3701)
* `excludes_extensions` defaults to `true` to skip reporting violations
  for extensions with missing documentation comments.
* `excludes_inherited_types` defaults to `true` to skip reporting
  violations for inherited declarations, like subclass overrides.
2021-09-01 21:42:47 +00:00
Marcelo Fabri 9e3f0a8ff8 Fix some rules when using Swift 5.4 2021-08-16 02:23:28 -07:00
Dan Loman dd672b4b0c [bug fix] expiring todo regex (#3597)
* Add failing tests

* Fix regex to allow non-zero-padded dates

* Update changelog

* Update CHANGELOG.md
2021-05-02 17:12:52 -04:00
Marcelo Fabri a10158c475 Add duplicated_key_in_dictionary_literal rule (#3613) 2021-04-28 17:25:08 -07:00
Keith Smiley 7976b74615 Add test functions with parameters to TestCaseAccessibilityRule (#3612)
If a function starts with `test` but takes some parameters, it is not
actually a test.
2021-04-26 20:04:04 +00:00
László Kustra 87d4accb39 Add "Capture non-constant variable" rule 2021-03-02 16:11:33 -05:00
JP Simard 0a0fb1e71b File false negatives in unused_declaration
When a declaration refers to an Objective-C type but doesn't have an
explicit `@objc` attribute.

It would have the string `@objc` embedded in its USR. So add a space so
we only trigger this condition when there's an explicit `@objc`
attribute in the declaration source code.

The triggering example added here didn't trigger before this change.
2021-03-02 11:36:06 -05:00
Otavio Cordeiro 24122e1325 Rename Rule to BalancedXCTestLifecycleRule 2021-03-01 01:29:16 +01:00
Otavio Cordeiro a6a5e633d0 Add support to unbalanced teardown methods 2021-03-01 01:18:30 +01:00
Otavio Cordeiro 3fbc482a2e Add MARKs
to trigger a new build.
2021-02-28 23:48:06 +01:00
Otavio Cordeiro cdd877c289 Add examples for static setUp and tearDown 2021-02-28 23:48:06 +01:00
Otavio Cordeiro bd4dcd5b23 Add required_xctest_tearddown opt-in rule 2021-02-28 23:48:05 +01:00