Commit Graph
65 Commits
Author SHA1 Message Date
JP SimardandGitHub 4bd7da32ea Reduce visibility of rules to be internal (#4533)
There's no reason to expose these publicly and this will make it nicer
to move to a new module outside of the core SwiftLint functionality.
2022-11-09 11:01:26 -05:00
Danny MöschandGitHub 7e8a3ae2ac Introduce onlyElement property on Collection (#4518) 2022-11-06 07:37:44 -05:00
Marcelo FabriandGitHub 35fcf55198 Rewrite reduce_into rule with SwiftSyntax (#4447) 2022-10-23 07:58:48 -04:00
Marcelo FabriandGitHub 9c8708bc01 Extract common SwiftSyntax extensions (#4445) 2022-10-23 00:54:18 -07:00
Marcelo FabriandGitHub f509998ec1 Rewrite empty_count with SwiftSyntax (#4426) 2022-10-20 16:52:30 -07:00
Danny MöschandGitHub a8bc9e9b42 Let more rules rely on SwiftSyntaxRule's defaults (#4401) 2022-10-18 02:23:39 -04:00
Danny MöschandGitHub 0fbd03cf2b Require visitors to exist (#4383) 2022-10-16 18:40:12 +02:00
Danny MöschandGitHub f8e5339c69 Introduce ReasonedRuleViolation type to associate a reason with a violation position (#4379) 2022-10-16 12:53:38 +02:00
9959f971f9 Add way to preprocess syntaxTree in SwiftSyntaxRule (#4381)
* Add way to preprocess syntaxTree in SwiftSyntaxRule

* Update Source/SwiftLintFramework/Protocols/SwiftSyntaxRule.swift

Co-authored-by: Danny Mösch <danny.moesch@icloud.com>

* Update Source/SwiftLintFramework/Protocols/SwiftSyntaxRule.swift

Co-authored-by: Danny Mösch <danny.moesch@icloud.com>

Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2022-10-16 01:40:02 -07:00
Danny MöschandGitHub bd8c9e5bcb Provide syntax visitor base class allowing for convenient skipping of declaration nodes (#4310) 2022-10-15 19:03:49 +02:00
JP SimardandGitHub 7585aef910 Rewrite reduce_boolean with SwiftSyntax (#4375) 2022-10-14 07:03:30 -04:00
JP SimardandGitHub 48fde2321f Rewrite contains_over_first_not_nil & last_where with SwiftSyntax (#4366)
Replace `MemberAccessExprSyntax.functionCallBase` with
`ExprSyntax.asFunctionCall` so we can use it in more places.

Move `TokenKind.isEqualityComparison` into `SwiftSyntax+SwiftLint.swift`
2022-10-13 15:59:30 +00:00
JP SimardandGitHub 8d29b21ecb Rewrite sorted_first_last & first_where with SwiftSyntax (#4365)
Add a `functionCallBase` helper.
2022-10-13 15:30:22 +00:00
JP SimardandGitHub 3bae16bee5 Rewrite contains_over_filter_is_empty with SwiftSyntax (#4364) 2022-10-13 10:45:40 -04:00
JP SimardandGitHub 0282bf1923 Remove optionality in getting syntax tree and source location converter (#4353)
Parsing does not throw errors.
See https://github.com/apple/swift-syntax/pull/912.
2022-10-12 12:50:17 -04:00
Marcelo FabriandGitHub 6998d8af23 Migrate shorthand_operator rule to SwiftSyntax (#4336)
* Migrate `shorthand_operator` rule to SwiftSyntax

* Remove unneeded imports
2022-10-10 21:28:55 -07:00
JP SimardandGitHub d6fd754679 Rewrite contains_over_range_nil_comparison with SwiftSyntax (#4225)
Use SwiftOperators.
2022-10-06 01:18:31 -04:00
JP SimardandGitHub 18ab68859c Rewrite contains_over_filter_count with SwiftSyntax (#4226) 2022-10-04 09:14:27 -04:00
JP SimardandGitHub 2388e49190 Use SwiftSyntax's new SwiftParser (#4216) 2022-10-01 15:05:36 -04:00
JP SimardandGitHub 8d500d1a63 Rewrite empty_collection_literal with SwiftSyntax (#4220) 2022-09-19 12:39:35 +02:00
JP SimardandGitHub bc7792ecd6 Rewrite empty_string with SwiftSyntax (#4177) 2022-09-07 13:59:15 -04:00
JP SimardandGitHub 117ef7f0e2 Rewrite flatmap_over_map_reduce with SwiftSyntax (#4178) 2022-09-07 13:23:51 -04:00
Kotaro SutoandGitHub 3aa249b8a1 Fix first_where false negative (#4105) 2022-08-17 00:06:32 +00:00
Danny MöschandGitHub d730e0b3fa Let all example verification tests be generated by Sourcery (#4076) 2022-08-10 22:49:28 +02:00
Danny MöschandGitHub 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
Marcelo FabriandGitHub f880b66cbf Rewrite operator_usage_whitespace with SwiftSyntax (#3962) 2022-05-06 16:48:57 -07:00
Marcelo FabriandGitHub 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 FabriandGitHub 678c3483ed Fix regression in last_where rule with Swift 5.6 (#3874)
Fixes #3847
2022-03-08 07:53:56 -05:00
Paul TaykaloandGitHub 693ee2cae9 Add Isnot Empty extension in the Swift Framework (#3387) 2020-11-07 18:42:55 -05:00
Marcelo Fabri f8ef7d649c Enable legacy_multiple and prefer_self_type_over_type_of_self in our codebase 2020-08-05 01:11:17 -07:00
Marcelo FabriandGitHub 6adf529e7e Fix false positive in empty_string rule with multiline literals (#3101)
Fixes #3100
2020-02-10 08:27:44 -08:00
Zsolt KovácsandGitHub ab8cd43e67 Empty count configuration (#3052)
* Add `only_after_dot` configuration option to `empty_count` rule

* Update CHANGELOG.md

* Adopt Example wrapper

* Change severity level to error
2020-02-09 15:12:54 -08:00
Zev EisenbergandGitHub fcf848608e Add Inline test failure messages (#3040)
* Add Example wrapper in order to display test failures inline when running in Xcode.
* Stop using Swift 5.1-only features so we can compile on Xcode 10.2.
* Wrap strings in Example.
* Add Changelog entry.
* Wrap all examples in Example struct.
* Better and more complete capturing of line numbers.
* Fix broken test.
* Better test traceability.
* Address or disable linting warnings.
* Add documentation comments.
* Disable linter for a few cases.
* Limit mutability and add copy-and-mutate utility functions.
* Limit scope of mutability.
2020-02-02 10:35:37 +02:00
JP Simard 0b1140d874 Fix typo in examples for isEmpty 2020-01-16 16:29:11 -08:00
JP SimardandGitHub fe5baca7cd Migrate to use SourceKitten's new ByteCount/ByteRange types (#3037)
New APIs were introduced in SourceKitten to allow for a more typesafe distinction between integers meaning NSString-based distances and byte-based distances.

* https://github.com/jpsim/SourceKitten/pull/639
* https://github.com/jpsim/SourceKitten/pull/642

This PR migrates SwiftLint's use of those APIs.
2020-01-16 15:18:37 -08:00
JP SimardandGitHub 40ade98710 Update SourceKitten to 0.28.0 (#3011) 2020-01-03 16:47:18 -08:00
Paul TaykaloandPaul Taykalo ac40778cb3 Use SwiftLintFile wrapper over the File 2019-11-07 15:19:17 +02:00
Paul TaykaloandPaul Taykalo b1cdc119ec Use swift enums instead of raw values 2019-11-07 11:05:19 +02:00
Paul TaykaloandPaul Taykalo 8c963d2c15 Working solution with SouceKittenDictionary wrapper 2019-11-07 08:50:50 +02:00
Marcelo Fabri d4ef1f0ad0 Add flatmap_over_map_reduce opt-in rule
Fixes #2883
2019-09-26 10:07:12 -07:00
Colton SchlosserandJP Simard 2c076151f4 Add contains_over_range_not_nil rule, make contains_over_first_not_nil also match == nil (#2811) 2019-09-03 12:03:00 -04:00
Colton Schlosser 130371b8cc Add empty_collection_literal rule 2019-08-28 21:57:02 -04:00
Marcelo FabriandGitHub 3e115835b1 Merge pull request #2846 from realm/mf-contains_over_filter_is_empty
Add `contains_over_filter_is_empty` opt-in rule
2019-08-25 20:55:11 -07:00
Marcelo Fabri 67526344ef Add contains_over_filter_is_empty opt-in rule 2019-08-25 20:22:41 -07:00
Marcelo Fabri 759ccd8a1e Avoid false positives in contains_over_filter_count 2019-08-25 20:11:23 -07:00
Marcelo Fabri 00d2b5d772 Add contains_over_filter_count opt-in rule
Fixes #2803
2019-08-25 20:00:50 -07:00
JP Simard 230bedcd05 Bump ReduceIntoRule's minimum Swift version to Swift 4 2019-04-19 17:38:04 -04:00
Marcelo FabriandGitHub ad2733391a Merge pull request #2666 from daltonclaybrook/dc-reduce-into-rule
Add reduce_into opt-in rule
2019-04-15 14:52:04 -07:00
Marcelo Fabri 51d47d492c contains_over_first_not_nil rule now also checks for firstIndex(where:)
Fixes #2678
2019-04-09 10:53:42 -07:00
r-plus 72dc428b2f Add some non-triggering examples to SortedFirstLastRule 2019-04-02 10:40:43 +09:00