Commit Graph

35 Commits

Author SHA1 Message Date
Marcelo Fabri 6adf529e7e Fix false positive in empty_string rule with multiline literals (#3101)
Fixes #3100
2020-02-10 08:27:44 -08:00
Zsolt Kovács 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 Eisenberg 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 Simard 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 Simard 40ade98710 Update SourceKitten to 0.28.0 (#3011) 2020-01-03 16:47:18 -08:00
Paul Taykalo ac40778cb3 Use SwiftLintFile wrapper over the File 2019-11-07 15:19:17 +02:00
Paul Taykalo b1cdc119ec Use swift enums instead of raw values 2019-11-07 11:05:19 +02:00
Paul 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 Schlosser 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 Fabri 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 Fabri 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
r-plus c7a1cc1d54 fix: false positive on sorted_first_last with firstIndex(of:) and lastIndex(of:) method
Fixes #2700
2019-04-01 15:03:46 +09:00
Dalton Claybrook 0aa6c429fb Fix build error on linux 2019-03-24 16:36:10 -04:00
Dalton Claybrook 1e69dd950a Now the reduce_into rule is only triggered for COW types 2019-03-24 16:22:20 -04:00
Dalton Claybrook 92de850471 ReduceIntoRule is now an ASTRule 2019-03-24 16:22:20 -04:00
Xaver Lohmüller 57af7f0e30 Add ReduceBooleanRule (#2675)
* [reduce_boolean] Implement rule

* [reduce_boolean] Improve reason text

* [reduce_boolean] Fix new violations

* [reduce_boolean] Add CHANGELOG.md entry

* [reduce_boolean] Shorten rule name

* [reduce_boolean] Use regular map instead of compactMap

* [reduce_boolean] Match only possible syntax kinds
2019-03-10 10:54:14 -07:00
Cihat Gündüz 3c607f1f4a [first_where] Make triggering example valid Swift code 2019-02-14 21:29:49 +01:00
Cihat Gündüz 5e1b491eea [first_where] Fix code smells like suggested by @marcelofabri 2019-02-14 21:29:49 +01:00
Cihat Gündüz 09fb947887 [first_where] Prevent false positives by excluding some substructures 2019-02-14 21:29:49 +01:00
Cihat Gündüz 2d67f611b8 [first_where] Add false positives from #1930 as non-triggering examples 2019-02-14 21:29:49 +01:00
Marcelo Fabri eafd98971d Fix false positives on sorted_first_last with Realm
Fixes #2533
2018-12-25 19:25:53 -08:00
Marcelo Fabri 4b12e08731 Fix false positives on Realm collections 2018-12-25 18:41:53 -08:00
Marcelo Fabri c17e269cee Add last_where opt-in rule 2018-12-25 01:34:42 -08:00
JP Simard 0e862ca9c4 Enable vertical whitespace rules in SwiftLint
and fix violations
2018-12-02 14:01:23 -08:00
Timofey Solonin e9d2552888 #2423 - Fix EmptyCountRule for binary, octal and hexadecimal integer literals 2018-10-02 19:47:52 +03:00
JP Simard 3961d6482b Organize rules by kind in Xcode project (#2341) 2018-08-05 18:54:05 -07:00