JP Simard
13703c4466
Update SourceKitFreeRules ( #4097 )
...
None of these rules use SourceKit
2022-08-16 00:56:03 +00:00
JP Simard
3037946bbc
Migrate ClosureSpacingRule to SwiftSyntax ( #4092 )
...
Fixes #4090 . Continued from #4091 .
2022-08-15 18:27:43 +00:00
Timofey Solonin
557c5b5948
Make duplicate_imports rule correctable ( #4014 )
...
Also fix reporting of redundant violations when more than one duplicate is present.
2022-08-11 18:19:26 +02: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
05ac3c9d75
Require macOS 12 & Swift 5.6 ( #4037 )
...
This will unblock using Swift Concurrency features and updating to the
latest versions of Swift Argument Parser.
This won't drop support for linting projects with an older toolchain /
Xcode selected, as long as SwiftLint was _built_ with 5.6+ and is
_running_ on macOS 12+. So the main breaking change for end users here
is requiring macOS 12 to run.
However, the upside to using Swift Concurrency features is worth the
breaking change in my opinion. Also being able to stay on recent Swift
Argument Parser releases.
2022-07-26 03:55:36 -04:00
Craig Siemens
c5aa8065d1
Update nimble_operator to suggest the (in)equal operator instead of beNil() ( #4025 )
2022-07-14 13:44:29 -04:00
Koki Hirokawa
25ed3d2d26
Support UIEdgeInsets type in prefer_zero_over_explicit_init rule ( #4008 )
2022-06-29 21:28:47 +02:00
Marcelo Fabri
45a03dec20
Add back void_function_in_ternary rule ( #3956 )
2022-06-27 09:41:52 -07:00
Danny Mösch
1faea36a22
Do not trigger unavailable_condition rule if other #(un)available checks are involved ( #4002 )
2022-06-24 22:58:02 +02:00
Danny Mösch
634406a30a
Fix violation message in untyped_error_in_catch rule ( #4001 )
...
It was just "warning". Now it is the description of the rule (default).
2022-06-19 13:09:33 -04:00
Danny Mösch
323a249f70
Make for_where independent of order in structure dictionary ( #3979 )
2022-06-14 13:55:12 -04:00
Jaehong Kang
809dcc6bdc
Prevent crash for private types named _ in type_name rule ( #3972 )
2022-05-10 19:15:44 +02:00
Danny Mösch
ca9217d5e1
Ignore array types if their associated Index is accessed ( #3970 )
2022-05-07 19:11:53 -04:00
Marcelo Fabri
ebc77391bc
Add workaround to avoid stack overflow in debug ( #3963 )
2022-05-01 14:57:28 -07:00
Marcelo Fabri
1752587b7b
Add unavailable_condition rule ( #3953 )
...
Fixes #3897
2022-04-17 03:30:53 -07:00
Marcelo Fabri
a786e310a3
Add back return_value_from_void_function rule ( #3882 )
2022-04-16 16:53:11 -07:00
JP Simard
a773c3ec21
Apply minor changes to the syntactic sugar rewrite ( #3915 )
...
* Improve docstrings for `StringView+SwiftSyntax.swift`
* Move changelog entry to correct section & reword
* Change parameter type from `Int` to `ByteCount`
* Move AbsolutePosition / ByteCount conversion to internal API
* Only warn once if syntax tree cannot be parsed
* Move Syntactic Sugar examples to a dedicated file
* Change SyntacticSugarRuleVisitor from SyntaxAnyVisitor to SyntaxVisitor
* Add `SugaredType` enum to help with the implement `SyntacticSugarRule`
2022-03-24 10:27:05 -04:00
Paul Taykalo
d756541204
Rewrite SyntacticSugarRule using SwiftSyntax ( #3866 )
...
Rewrite SyntacticSugarRule with SwiftSyntax
2022-03-23 18:30:43 +02: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
Marcelo Fabri
b619154905
Automatically enforce min Swift version for all rules ( #3881 )
...
* Automatically enforce min Swift version for all rules
* Fix violations
2022-03-09 11:44:56 -08:00
JP Simard
28dd673c48
Use SwiftSyntax visitor to parse commands ( #3872 )
...
* Cache SwiftSyntax syntax trees
* Use SwiftSyntax visitor to parse commands
* Update changelog entry
* Cache commands
2022-03-08 12:33:06 -05:00
JP Simard
a43e52aa91
Integrate Swift Syntax in the force_cast rule ( #3867 )
...
We've tried adding Swift Syntax support to SwiftLint in the past but had to turn it off in https://github.com/realm/SwiftLint/pull/3107 due to distribution and portability issues.
With https://github.com/keith/StaticInternalSwiftSyntaxParser it should be possible to avoid those issues by statically linking the internal Swift syntax parser so it's available no matter where users have Xcode installed on their computer.
By removing all calls to SourceKit (collecting comment commands + checking the current Swift version), there's a really significant performance improvement.
| Framework | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| SourceKit | 517.8 ± 8.3 | 505.5 | 531.1 | 6.59 ± 0.43 |
| SwiftSyntax | 78.6 ± 5.0 | 72.6 | 92.1 | 1.00 |
In practice, the SourceKit overhead will continue being there for as long as any rule being run is still looking up the SwiftLint syntax map though.
2022-03-07 12:51:24 -05:00
Danny Moesch
0f55447956
Use pre-defined set of extension kinds ( #3814 )
2022-01-24 09:55:01 -08:00
JP Simard
e3f232ec28
Fix convenience_type false positives when using actors ( #3812 )
...
Fixes https://github.com/realm/SwiftLint/issues/3761 .
2022-01-21 19:54:59 +00:00
Ikko Ashimine
640efba68d
Fix typo: implict -> implicit
2022-01-21 11:05:21 -05:00
iressler
3da6502bac
Fix false positive in legacy_objc_type when a non-legacy Objective-C type name begins with a legacy Objective-C type name. ( #3752 )
2021-11-29 12:36:27 -08:00
Danny Mösch
050473a0e1
Add optional prefer_self_in_static_references rule ( #3732 )
2021-11-29 18:42:53 +00:00
Ikko Ashimine
d97bf0951e
Fix typo in StrictFilePrivateRule.swift ( #3737 )
...
occurences -> occurrences
2021-11-29 09:47:17 -08:00
Paul Taykalo
945efde5f5
Prevent multiple recalculations of capture groups ranges ( #3745 )
2021-10-15 02:38:18 +03:00
Naruki Chigira
e4ff164f64
Fix redundant_optional_initialization autocorrect ( #3717 )
...
* Fix autocorrect for redundant_optional_initialization in case observer's brace exists.
2021-09-30 23:15:53 +00:00
Marcelo Fabri
b63a60df14
Fix false positive in unneeded_break_in_switch ( #3725 )
...
Fixes #3724
2021-09-29 12:00:08 -07:00
Atsuto Yamashita
db229aa221
fix typo in ExplicitTopLevelACLRule.swift ( #3716 )
2021-09-12 19:45:32 -04:00
Kane Cheshire
55b62cccb3
Updated file name to match type
2021-08-24 00:19:35 -07:00
Kane Cheshire
4a293632c2
Named rule correctly for Sourcery to work properly
2021-08-24 00:19:35 -07:00
Marcelo Fabri
50b6992852
Fix issues with explicit_type_interface on Swift 5.4
...
Fixes #3615
2021-08-16 02:23:28 -07:00
iressler
9aff1e0a8e
This change addresses a false negative case in the RedundantOptionalInitializationRule. ( #3671 )
2021-08-16 02:01:17 -07:00
Marcelo Fabri
9939c536d5
Add anonymous_argument_in_multiline_closure opt-in rule ( #3659 )
...
* Add anonymous_argument_in_multiline_closure opt-in rule
* Restrict match to the closure
* Fixes
2021-06-17 17:03:19 -07:00
Kane Cheshire
6367ff20c8
Updated triggering examples to indicate where the violation should occur
2021-05-24 12:05:29 -07:00
Kane Cheshire
50169fb556
Removed unused import causing CI to fail
2021-05-24 12:05:29 -07:00
Kane Cheshire
9c5d3b3c6f
Tidy up
2021-05-24 12:05:29 -07:00
Kane Cheshire
3536a86ba1
Added more non-triggering examples
2021-05-24 12:05:29 -07:00
Kane Cheshire
91b125b001
Ran sourcery + tidied up
2021-05-24 12:05:29 -07:00
Kane Cheshire
d6223893ed
Moved description back
2021-05-24 12:05:29 -07:00
Kane Cheshire
d7aeea39d9
Adding examples/tests
2021-05-24 12:05:29 -07:00
Kane Cheshire
0dd96d249e
Uses correct enumcase instead of enum
2021-05-24 12:05:29 -07:00
Kane Cheshire
538764278b
Adding new DisallowNoneCase rule
2021-05-24 12:05:29 -07: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
JP Simard
eca9ea4bb8
Adding Legacy ObjC Type Rule #2758 ( #3531 )
2021-02-23 12:08:01 -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