Commit Graph

2095 Commits

Author SHA1 Message Date
p-x9 7ea514b77a Fixed error in character limit per line. 2021-05-21 14:33:16 -07:00
p-x9 f0c707f477 Fix indents 2021-05-21 14:33:16 -07:00
p-x9 04a41bdb2f Fix Autocorrect on no space between the tuple and "in" in unneeded_parentheses_in_closure_argument 2021-05-21 14:33:16 -07:00
raduciobanu002 07c8e52fc8 "Colon Spacing" rule name update (#3583)
* * Changed rule name from "Colon" to "Colon Spacing"
* Updated tests

* Update CHANGELOG.md

Co-authored-by: Seth Friedman <sethfri@gmail.com>
2021-05-20 23:46:54 -04:00
Steven 625cd180ae Fix type_contents_order initializer detection (#3622) 2021-05-10 09:56:21 -04: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 4e3c87e2f3 Fix false positive in empty_enum_arguments (#3616)
Fixes #3562
2021-04-28 20:25:05 -07:00
Marcelo Fabri a10158c475 Add duplicated_key_in_dictionary_literal rule (#3613) 2021-04-28 17:25:08 -07:00
Dylan Maryk 5a3844401b Fix missing comma in description (#3588) 2021-04-27 22:51:37 -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
Stephen Williams c1b77f8e0a Rename the “File Line Length” rule to just “File Length” 2021-03-08 09:29:51 -05:00
JP Simard 92061e84b5 Merge pull request #3550 from realm/fix-oss-check-noise
Fix OSSCheck noise
2021-03-03 15:10:40 -05:00
JP Simard 027f130e8c fixup! Fix OSSCheck noise 2021-03-03 11:36:09 -05:00
JP Simard 7f7fc03a8f Fix OSSCheck noise
Try a few things:

1. Sort InclusiveLanguageRule terms since they're a Set and don't have
  deteministic ordering (will definitely help)
2. Fetch remote at the beginning of the script (likely to help)
3. Only fetch remote once (likely to help)
4. Sort branch & master output before diffing (unlikely to help)
5. Change diff filter from `d` to `AMRCU` (no idea if it will help)
2021-03-03 11:19:41 -05: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
JP Simard 721b077608 Add SWIFTLINT_LOG_MODULE_USAGE environment variable for UnusedImportRule
That's because it can currently be difficult to know why a module is
referenced in a file.

To use, run SwiftLint with the environment variable set to the module
whose references you want to log to `stderr`:

    SWIFTLINT_LOG_MODULE_USAGE=MyModule swiftlint analyze ...
2021-02-25 14:53:07 -05:00
JP Simard 8326624491 Make discarded_notification_center_observer opt-in (#3537)
It's very common for this rule to produce false positives, and there's
no easy way to address them.

See these issues:
  * https://github.com/realm/SwiftLint/issues/1398
  * https://github.com/realm/SwiftLint/issues/3498
2021-02-25 09:06:00 -08:00
Artem Garmash 4266ea9d60 Add Bool violation reporting in redundant_type_annotation (#3438)
* Add Bool violation detection

* Update Changelog

* Fix issues found by the rule
2021-02-24 14:29:08 -08:00
Thomas Goyne 8f216b8398 Support Swift Playground control comments in the comment spacing rule
Swift Playgrounds use `//:` to mark prose sections and `//:#` for embedded
content like images and localized prose, so those shouldn't violate the
space-after-comment rule.
2021-02-23 17:33:20 -05:00
JP Simard eca9ea4bb8 Adding Legacy ObjC Type Rule #2758 (#3531) 2021-02-23 12:08:01 -08:00
JP Simard cfd67b9534 Make strong-iboutlet rule correctable (#3530)
* Make strong-iboutlet rule correctable

* fixup! Make strong-iboutlet rule correctable

Co-authored-by: Max Haertwig <dev@maxhaertwig.com>
2021-02-23 11:37:23 -08:00
JP Simard 6b51c3ebc5 [UnusedDeclarationRule] Fix false positives with result builders (#3528) 2021-02-23 07:59:37 -08:00
JP Simard 60242fd599 [UnusedDeclarationRule] Allow configuration related USRs to skip (#3525)
For example you might have custom source tooling that does something
with types conforming to a procotol even if that type is never
explicitly referenced by other code.
2021-02-17 12:25:23 -08:00
Otavio Cordeiro 46777539ad Add opt-in rule private_passthrough_subject (#3504) 2021-02-08 10:43:27 -08:00
Otavio Cordeiro 7ea9b733ff Allow multi-line parameters rule to always break lines (#3494) 2021-02-02 13:27:29 -08:00
JP Simard bbf1ad4a18 [ExplicitSelfRule] Fix violation location and misplaced corrections (#3507) 2021-01-29 10:59:28 -08:00
Otavio Cordeiro 59eb887cfa Add opt-in rule discouraged_assert (#3506)
Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>
2021-01-29 09:30:57 -08:00
Yurii Kotov 6dba929b4f Fix typos in configuration options for file_name rule 2020-12-16 19:56:50 +02:00
JP Simard ebca5238a7 Fix false positives on unused_declaration for outlets with accessors 2020-12-11 10:07:22 -05:00
Keith Smiley 800030ad11 Remove NonPrivateXCTestMembersRule (#3459)
* Remove NonPrivateXCTestMembersRule

I accidentally implemented this rule twice. So TestCaseAccessibilityRule
did the same thing but with a bit more behavior. This change deletes
NonPrivateXCTestMembersRule but also ports over the autocorrection from
it to TestCaseAccessibilityRule.
2020-12-09 13:16:40 -08:00
Keith Smiley 22ee449971 Fix @IBInspectable unused declarations with get/set (#3458) 2020-12-07 11:07:16 -08:00
richard.turton 103cf7504a Fixed whitespace violations 2020-12-04 17:01:47 +00:00
richard.turton 62298de662 Add exception for UIApplicationDelegateAdaptor 2020-12-04 16:45:51 +00:00
Keith Smiley 03f13e5bb7 Remove @IBOutlet and @IBInspectable from UnusedDeclarationRule (#3432)
The original implementation wasn't tested so it regressed.

https://github.com/realm/SwiftLint/pull/3184
2020-12-03 11:00:53 -08:00
Dalton Claybrook ba5e6d2e1c Fix false positives in inclusive_language rule (#3439)
* Add support for allowed terms in inclusive language rule

* Update changelog

* Move changelog entry to Enhancements section

Co-authored-by: JP Simard <jp@jpsim.com>
2020-11-20 14:12:24 -05:00
JP Simard 42373a94b6 Remove example failing test
This is hard to fix, and already covered by the corrections.
2020-11-20 11:18:07 -05:00
Keith Smiley e50e34a60a Add another 2020-11-16 15:54:23 -08:00
Keith Smiley b7ec75b68b Add support for testing Examples with configuration
This was extracting from another change that no longer needed it. It
should be helpful for anyone testing custom configuration with their
non-analyzer rules.

I added a random example of something that wasn't previously tested as
an example.
2020-11-16 15:37:15 -08:00
Keith Smiley 866102c3fc Add XCTestCase examples to unused declaration rule (#3192) 2020-11-16 15:32:51 -08:00
Keith Smiley 3151e6c45f Add NonPrivateXCTestMembersRule (#3248)
Co-authored-by: JP Simard <jp@jpsim.com>
2020-11-16 09:50:56 -08:00
Bryan Ricker 999bfbdefa Fix consoleDescription for OverriddenSuperCallConfiguration 2020-11-10 20:40:41 -08:00
Bryan Ricker 8a0eb67561 chore: rename OverridenSuperCallConfiguration to OverriddenSuperCallConfiguration
BREAKING CHANGE: As `OverridenSuperCallConfiguration` is a
publicly-exposed struct, this rename should be considered breaking.
2020-11-10 20:40:41 -08:00
JP Simard bf2790df54 Enable CommentSpacingRule by default
And fix violations in SwiftLint
2020-11-10 12:50:39 -05:00
JP Simard 869fe868b3 Apply minor refactorings
1. Add some comments
2. Name variables when used in multiline closures
3. Change violation range length from 1 to 0, which simplifies the
   substitution
4. Tweak indentation
2020-11-10 12:42:40 -05:00