Commit Graph

75 Commits

Author SHA1 Message Date
JP Simard b6c0c7e374 Revert "Temporarily remove all SwiftSyntax rules and support (#3107)"
This reverts commit b744cf08f1.
2020-02-11 13:40:26 -08:00
JP Simard b744cf08f1
Temporarily remove all SwiftSyntax rules and support (#3107)
The new rules introduced in 0.39.0 that depend on SwiftSyntax have been temporarily removed as we work out release packaging issues.

* `prohibited_nan_comparison`
* `return_value_from_void_function`
* `tuple_pattern`
* `void_function_in_ternary`

See https://github.com/realm/SwiftLint/issues/3105 for details.
2020-02-11 13:40:04 -08:00
Marcelo Fabri fdd16a6853
Add `prohibited_nan_comparison` opt-in rule (#3089)
Fixes #2086
2020-02-09 15:13:25 -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
Marcelo Fabri f95768d2e6 Add `tuple_pattern` opt-in rule (#3086)
* Add `tuple_pattern` opt-in rule

Fixes #2203

* Remove unused import
2020-02-08 13:57:17 -08:00
Marcelo Fabri 1d39071dfd
Add `void_function_in_ternary` opt-in rule (#3085)
* Add `void_function_in_ternary` opt-in rule

Fixes #2358

* Remove unused import and improve description
2020-02-08 13:23:02 -08:00
Marcelo Fabri 8d9c501cb8
Add optional return_value_from_void_function rule using SwiftSyntax (#3054)
* Add optional return_value_from_void_function rule using SwiftSyntax

* Use Script/bootstrap in CI

* Make SwiftSyntax optional

* Make SwiftSyntax optional in SPM

* Fix Package.swift

* Try again

* Add minSwiftVersion

* Fix thread sanitizer issue

* Take 2

* Fix false positive on nested computed variables

* Remove support for Xcode 10.x

* Fix rule description

* Enable opt-in rule in configuration file

* Extract code into `SyntaxRule` protocol

* nit: make property private

* Missing docs

* Fix MasterRuleList.swift

* Update CHANGELOG

* Remove unused imports

* Use Example type

* Change rule kind to .idiomatic

* Update CHANGELOG

* Bump deployment target to macOS 10.12

* Simplify SyntaxRule.validate(file:visitor)

* Make TSan happy

* Use script/bootstrap in the README
2020-02-08 02:43:40 -08:00
Sven Münnich 72e2063531
Include functions and getters in rule `implicit_return` 2020-01-05 15:04:35 -08:00
Marcelo Fabri 093370c2b3
Add opt-in `prefer_self_type_over_type_of_self` rule (#3006)
Fixes #3003
2020-01-03 12:33:04 -08:00
Marcelo Fabri 2c3411dc88
Add optional_enum_case_matching rule (#3002) 2020-01-03 00:50:47 -08:00
Marcelo Fabri fbbd3fc08e
Add AutomaticTestableRule conformance to EnumCaseAssociatedValuesLengthRule (#3005) 2020-01-03 00:34:29 -08:00
ldindu 2ccb33b111 Add `enum_case_associated_values_count` opt-in rule 2020-01-02 23:24:06 -08:00
MarkoPejovic 109899c56c Implement #2888 2019-10-20 19:19:54 -07:00
Marcelo Fabri d4ef1f0ad0 Add `flatmap_over_map_reduce` opt-in rule
Fixes #2883
2019-09-26 10:07:12 -07:00
Nathan Van Fleet 406a8f20f8 Add Mark rule for triple slash Mark comments (#2868)
* Add Mark rule for triple slash Mark comments

* Move changelog entry to appropriate section

* Re-add Package.resolved

* Fix trailing comma

* Rebuild Rules.md using Xcode 10.3

* Combine two regexes into one
2019-09-18 17:21:13 -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
Marcelo Fabri 40bc8de5c7 Add no_space_in_method_call rule (#2855)
* Add no_space_in_method_call rule

* Avoid false positive with typecasting
2019-09-03 10:03:21 -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 e63e8cad0f
Add UnusedDeclarationRule (#2814)
This PR adds a new `unused_declaration` analyzer rule to lint for unused declarations.
By default, detects unused `fileprivate`, `private` and `internal` declarations.
Configure the rule with `include_public_and_open: true` to also detect unused `public` and `open` declarations.

Completely remove the `unused_private_declaration` rule.

This is built on the work enabling collecting rule infrastructure in https://github.com/realm/SwiftLint/pull/2714.
2019-07-18 18:23:43 -07:00
Marcelo Fabri 6be5bf74c3
Add legacy_multiple opt-in rule (#2771)
Fixes #2612.
2019-06-01 22:49:23 -07:00
Marcelo Fabri 90cb1349c0
Add `duplicate_enum_cases` rule (#2777)
Fixes #2676
2019-06-01 20:32:55 -07:00
JP Simard c216ccc1e5
Remove WeakComputedProperyRule (#2761)
* Remove WeakComputedProperyRule

Addresses https://github.com/realm/SwiftLint/issues/2712

* fixup! Remove WeakComputedProperyRule
2019-05-16 02:19:01 -07:00
Marcelo Fabri a3aa36757b Add `unowned_variable_capture` opt-in rule
Fixes #2097
2019-04-30 10:12:20 -07: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
Dalton Claybrook d8f671c315 WIP - create unused capture list rule 2019-04-13 23:12:25 -04:00
Frederick Pietschmann 43e18458de Update file headers for new sourcery version 2019-04-12 17:13:27 +02: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
Matthew Healy eecf27ede8 [nslocalizedstring_require_bundle] Run make sourcery 2019-03-30 00:10:14 +01:00
Dalton Claybrook 87dbf8e3d7 Fix Changelog issue, Sourcery version mismatch, and package.resolved issue 2019-03-24 16:22:19 -04:00
Dalton Claybrook 7c2e4dfd19 Add ReduceIntoRule 2019-03-24 16:22:19 -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
Matthew Healy a75198f9d0 [nsobject_prefer_isequal] Add autogenerated documentation 2019-03-01 21:15:03 +01:00
Matthew Healy 057c72c2a6 [nsobject_prefer_isequal] Run make sourcery 2019-03-01 21:15:03 +01:00
Ben Staveley-Taylor e29d38cde2 Incorporate review comments
- Rename from Deinit_Required to Required_Deinit
- Adopt ASTRule protocol
2019-02-03 15:02:19 +00:00
Ben Staveley-Taylor bff405d34e Add deinit_required rule
Classes are required to have a deinit method.

This is a style to help debugging memory issues, when it is common to want to set a breakpoint at the point of deallocation. Most classes don't have a deinit, so the developer ends up having to quit, add a deinit and rebuild to proceed. If all classes have a deinit, debugging is much smoother.

Ref: https://github.com/realm/SwiftLint/issues/2620
2019-02-02 14:52:48 +00:00
Marcelo Fabri 757b5fb94d Add `weak_computed_property` rule
Fixes #2596
2019-01-26 02:11:35 -08:00
Marcelo Fabri ea4e13b9a8 Add `nslocalizedstring_key` opt-in rule 2019-01-22 23:54:04 -08:00
Marcelo Fabri f8dda65637 Add `only_single_muted_parameter` configuration on `trailing_closure 2019-01-17 22:02:47 -08:00
Marcelo Fabri 26e531f771 Rename rule to UnusedSetterValueRule 2019-01-17 20:37:31 -08:00
Marcelo Fabri 105f8a8710 Add unused_setter_argument rule 2019-01-17 18:51:47 -08:00
Samuel Susla 90232d542e Add `DuplicateImportsRule` (#2004) 2019-01-17 15:42:29 -08:00
Marcelo Fabri f8e42d81e0 Add strong_iboutlet opt-in rule
Fixes #2433
2019-01-13 20:53:12 -08:00
Marcelo Fabri d863fc9fb7 Add unused_control_flow_label rule
Fixes #2227
2019-01-05 18:59:32 -08:00
Marcelo Fabri c17e269cee Add last_where opt-in rule 2018-12-25 01:34:42 -08:00
Marcelo Fabri 4fa417e06f Add configuration to discouraged_object_literal
Fixes #2439
2018-12-23 23:00:08 -08:00
Kim de Vos d62e187b5c Add Legacy Hashing rule (#2496) 2018-12-05 15:43:39 -08:00