Commit Graph

214 Commits

Author SHA1 Message Date
chrisjf 1ef15f3bb7 Update documentation for multiline_arguments_brackets and multiline_literal_brackets (#4098)
- added two triggering examples that are a common style, to make it immediately obvious that they trigger the rules
- also fixed a spelling mistake throughout the examples for the multiline_literal_brackets rule ("Gryffindor" is now correctly spelt)
2022-08-18 09:53:52 +02:00
JP Simard ac23f2e89a Log time spent in each custom rule (#4100) 2022-08-15 22:03:06 -04:00
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
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 828f36958f Introduce option to ignore indentation of compiler directives in indentation_width rule (#4066) 2022-08-10 21:52:32 +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 0ded5859a1 Rewrite ColonRule with SwiftSyntax (#4063)
Making it about 7x faster, finding some previously missed cases.
2022-08-04 17:23:52 -04:00
Danny Mösch cdb87e3869 Verify all examples provided in rule descriptions (#4061) 2022-08-04 23:06:37 +02:00
JP Simard c50b42c183 Rewrite CommaRule with SwiftSyntax (#4062)
Making it about 10x faster, finding some previously missed cases and
fixing some previously wrong corrections.

This pulls in the `Collection.windows(ofCount:)` function from Swift
Algorithms.
2022-08-04 04:29:38 +00:00
Steve Madsen 4d8abec16e Make comma_inheritance rule opt-in (#4047) 2022-07-27 17:01:11 +02:00
JP Simard f81972e98c Apply minor stylistic edits to OperatorUsageWhitespaceRule 2022-07-26 03:23:35 -04:00
Danny Mösch 4aa38957c3 Enable auto-test for rule (#4033) 2022-07-24 08:24:11 -04:00
Marcelo Fabri a19ffddf66 Support arrays for included & excluded in custom rules (#4006)
* Support arrays for `included` & `excluded` in custom rules

* Extract shouldValidate(filePath:) and add tests
2022-06-27 00:29:26 -07:00
Danny Mösch 04972a39da Look for call expressions which are not wrapped into an argument (#3977)
This makes the added test cases work in Xcode 13.2 where the wrapping does not happen.
The call expression is the first substructure in the dictionary, while in Xcode 13.3
it's an argument containing the call expression.
2022-06-19 13:39:07 -04:00
Marcelo Fabri 4382ef49b9 Use URL(fileURLWithPath:isDirectory) to avoid file system call (#3976) 2022-05-26 21:54:23 +02:00
Marcelo Fabri f880b66cbf Rewrite operator_usage_whitespace with SwiftSyntax (#3962) 2022-05-06 16:48:57 -07:00
Marcelo Fabri ebc77391bc Add workaround to avoid stack overflow in debug (#3963) 2022-05-01 14:57:28 -07:00
Danny Mösch a27c7da7e2 Allow custom attributes on lines directly before let/var declarations (#3943) 2022-04-26 22:00:44 +02:00
Marcelo Fabri 5f44d3f306 Add comma_inheritance_rule rule (#3954)
Fixes #3950
2022-04-17 04:47:02 -07:00
Danny Moesch fa2a0bab6c Move StringView.byteOffset into generally accessible extension (#3917) 2022-03-25 07:27:50 +01: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
JP Simard 3273cef42b Prevent empty files from triggering rule violations (#3885)
There are many valid cases to have an empty Swift source files, and these
shouldn't trigger violations.
2022-03-09 16:09:11 -05: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
Danny Moesch 6fa8ff6070 Exclude examples with complex language constructs from the rule documentation (#3880) 2022-03-08 16:04:51 -05:00
Marcelo Fabri f9b9c35c1f Fix regression in trailing_closure rule with Swift 5.6 (#3879)
Fixes #3848
2022-03-08 12:52:07 -08:00
Marcelo Fabri 3f24998be5 Fix closure_parameter_position rule with Swift 5.6 (#3871)
Fixes #3845
2022-03-07 13:23:31 -08:00
Marcelo Fabri f19555f707 Fix empty_parentheses_with_trailing_closure with Swift 5.6 (#3870)
Fixes #3846
2022-03-07 13:39:57 -05:00
Marcelo Fabri ff4249856e Fix false positive in EmptyEnumArgumentsRule with Swift 5.6 (#3868)
Fixes #3850
2022-03-07 11:10:15 -05:00
Danny Moesch 0e7b588d50 Ignore meta class types in prefer_self_in_static_references rule (#3832) 2022-03-02 10:52:12 -05:00
Greg c09b6fe3ad fix typo (#3837) 2022-02-02 15:31:06 -05:00
JP Simard 2f2a4ad680 [ClosureEndIndentationRule] Fix crash with Swift 5.6 (#3831)
Fixes https://github.com/realm/SwiftLint/issues/3830
2022-01-27 17:36:31 -05:00
Danny Moesch a94d120839 Ignore prefer_self_in_static_references rule in extensions generally (#3813) 2022-01-24 09:57:57 -08:00
Danny Moesch d99be668c5 Ignore more locations of static references not using 'Self' in classes (#3771)
Static references with `Self` are not allowed to define

* default values of properties,
* annotation parameter values and
* default method parameter values

in classes.
2022-01-21 12:43:12 -08:00
Ethan Wong 5fd8ef38c1 Fix malformed doc for rule "InclusiveLanguage". 2022-01-21 10:45:15 -05:00
JP Simard 027bdcdc95 Fix crash when parsing multi-line attributes with the attributes rule (#3776)
Fixes #3761
2021-12-06 16:08:53 +00:00
Danny Mösch 050473a0e1 Add optional prefer_self_in_static_references rule (#3732) 2021-11-29 18:42:53 +00:00
Paul Taykalo a87aee1771 Colon rule should ignore cases when comment is in function argument (#3740) 2021-10-14 16:05:11 +03:00
Marcelo Fabri 383e5b5bc2 Handle get async and get throws in implicit_getter (#3743)
Fixes #3684
2021-10-12 10:32:34 -07:00
Artem Garmash 67114bb729 Exclude id from identifier_name by default (#3730) 2021-10-04 21:13:40 +00:00
Paul Taykalo 6b8c4442b0 Speed up "computed accessors order" rule (#3727) 2021-10-01 03:07:57 +03:00
Marcelo Fabri cc79edd4af Fix issues in ImplicitReturnRule 2021-08-16 02:23:28 -07:00
Marcelo Fabri 9e3f0a8ff8 Fix some rules when using Swift 5.4 2021-08-16 02:23:28 -07:00
Ikko Ashimine 81eb0d9b1f Fix typo in ClosureSpacingRule.swift (#3669)
occurences -> occurrences
2021-07-06 10:41:59 -07:00
p-x9 050a10bbd9 Add Test 2021-05-21 14:33:16 -07:00
p-x9 80ca9a7e37 Fix Space appending process when multi byte offsets. 2021-05-21 14:33:16 -07:00
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