Commit Graph

2085 Commits

Author SHA1 Message Date
Marcelo Fabri 6ec5806a93 Trigger closure_parameter_position in free closures and capture lists 2020-08-05 00:42:27 -07:00
Marcelo Fabri d36743b58a Fix false positive in no_space_in_method_call with multiple trailing closures
Fixes #3259
2020-08-04 21:20:54 -07:00
Marcelo Fabri 5ad5bf2dae
Merge pull request #3276 from realm/marcelo/bugfix-3186
Fix false negative in `explicit_acl` rule with Swift 5.2+
2020-08-04 20:53:42 -07:00
Marcelo Fabri b541d253c6 Ignore .varParameter 2020-08-04 20:25:16 -07:00
Marcelo Fabri 1279523798 Ignore varLocal 2020-08-04 16:22:11 -07:00
Marcelo Fabri 0a592a34c9 Fix rule 2020-08-04 15:53:11 -07:00
Keith Smiley cf94d5d8ea
Add IBInspectableInExtensionRule (#3174) 2020-08-04 14:15:40 -07:00
Marcelo Fabri 9e5557fbc5
Merge pull request #3160 from realm/mf-computed_accessors_order
Add computed_accessors_order rule
2020-08-04 05:04:45 -07:00
Marcelo Fabri 2d7702fc25 Fix false positive in `explicit_acl` rule with Swift 5.2+
Fixes #3186
2020-08-04 04:24:52 -07:00
Marcelo Fabri 28bec96b3e Remove a usage of “blacklist” 2020-08-04 04:00:36 -07:00
Tieme van Veen 5f8f9a5a3d Fix false positive UPPERCASE raw_value_for_camel_cased_codable_enum 2020-08-04 03:34:28 -07:00
Marcelo Fabri 240e25232f Add computed_accessors_order rule
Fixes #3158
2020-08-04 03:23:36 -07:00
Marcelo Fabri 063cd3e56c Fix false positive on switch_case_on_newline with Swift 5.3
Fixes #3253
2020-08-04 03:17:23 -07:00
Marcelo Fabri d09a1411c9
Merge branch 'master' into duplicate_imports_configuration 2020-08-04 03:00:38 -07:00
Danny Moesch d08ea47920 Fix #3034: Allow opening brace directly after another opening brace or `in`
This special case occurs in functions implicitly returning closures.
2020-07-26 12:38:46 +02:00
Keith Smiley 46b99892d2 fix lint 2020-06-30 14:03:12 -07:00
Keith Smiley 660920a5f8 Add 'always_keep_imports' to UnusedImportRule
Sometimes we hit issues with SourceKit that cause this rule to produce
false positives of some imports. While we would prefer to fix all of
these cases whenever possible, this gives us a temporary escape hatch to
tell the rule never to remove imports of specific modules until the
fixes land in SwiftLint or Swift itself.

Currently this is for us to opt out of https://bugs.swift.org/browse/SR-13120
2020-06-30 10:00:33 -07:00
Noah Gilmore bda1cd56e0
#3167: Fixes false positives for multiline_parameters_brackets and multiline_arguments_brackets (#3171)
* Issue #3167: Fixes false positives for multiline_parameters_brackets and multiline_arguments_brackets

* Add changelog entry

* Fix trailing comma in MultilineParametersBracketsRule nontriggering examples

* Remove header comments from ExtendedStringTests.swift

Co-authored-by: Paul Taykalo <ptaykalo@macpaw.com>
2020-05-29 11:59:02 +03:00
Mateusz Matrejek 8ed7c31161
Fix false positive in with Swift 5.2 (#3112) (#3206) 2020-05-27 22:13:46 +03:00
Yusuke Goto 7da113e932 Fix severity level configuration for duplicate_imports 2020-05-12 17:27:33 +09:00
Keith Smiley e3ba417303
Fix UnusedImportRule breaking transitive imports (#3198) 2020-05-06 15:39:32 -07:00
Cihat Gündüz 5a22b94ec6
Add new file_content_type for PreviewProvider subclasses (#3063)
Fixes #2860.

Co-authored-by: Paul Taykalo <tt.kilew@gmail.com>
2020-04-24 13:21:24 +03:00
JP Simard da3e1a793b
Fix false positives in valid_ibinspectable rule when using Swift 5.2 (#3155)
* Fix false positives in valid_ibinspectable rule when using Swift 5.2

when defining inspectable properties in class extensions with computed
properties.

The following was triggering:

```swift
extension Foo {
  @IBInspectable var color: UIColor {
    set {
      self.bar.textColor = newValue
    }

    get {
      return self.bar.textColor
    }
  }
}
```

Fix by checking to see if an instance property has `set` keywords in its
body when running with Swift 5.2 or later.

* fixup! Fix false positives in valid_ibinspectable rule when using Swift 5.2
2020-03-27 10:04:04 -07:00
JP Simard 85d3425210
Fix attributes rule false positive with Swift 5.2 (#3154)
The following was triggering:

```swift
func printBoolOrTrue(_ expression: @autoclosure () throws -> Bool?) rethrows {
  try print(expression() ?? true)
}
```

Fix by adding the `rethrows` attribute kind to the rule's blacklist.
2020-03-27 09:33:12 -07:00
Marcelo Fabri 0bbbcb0a56
Fix false positives in redundant_objc_attribute with Swift 5.2 (#3152) 2020-03-26 19:23:48 -07:00
Marcelo Fabri 39ee6fe34e
Fix false positives on implicit_getter with Swift 5.2+ (#3151)
Fixes #3149
2020-03-26 18:53:36 -07:00
JP Simard c201ae43e6
Simplify regex (#3145)
* Simplify regex

`\w` already includes `_`

* Fix test
2020-03-18 16:23:52 -07:00
JP Simard d10ccacb45
Add unused_import config options to require imports for each module used (#3123)
For example, if `CGFloat` is used in a file where only `UIKit` is imported but not `CoreGraphics`, this will be a violation even if the file previously compiled.

This is because Swift allows referencing some declarations that are only transitively imported.

Enabling the `require_explicit_imports` configuration option will require that the module of every declaration referenced in a source file be explicitly imported.

This will add significant noise to the imports list, but has a few advantages:

1. It will be easier to understand all the dependencies explicitly referenced in a source file.
2. Correcting the `unused_import` rule will no longer introduce compilation errors in files that compiled prior to the correction.

If missing imports are added to a file when correcting it, the `sorted_imports` rule will be automatically run on that file.

If you with to allow some imports to be implicitly importable transitively, you may specify the `allowed_transitive_imports` configuration:

```yaml
unused_import:
  require_explicit_imports: true
  allowed_transitive_imports:
    - module: Foundation
      allowed_transitive_imports:
        - CoreFoundation
        - Darwin
        - ObjectiveC
```
2020-02-22 14:39:07 -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
JP Simard 05a8a854f5
Fix unused_import rule reported locations and corrections (#3106)
When multiple `@testable` imports are involved.

Because we use the `.dotMatchesLineSeparators` regular expression option, the dot was matching across lines when the intention was for it to just match `\w_` characters.
2020-02-11 11:23:27 -08:00
Marcelo Fabri 6adf529e7e
Fix false positive in `empty_string` rule with multiline literals (#3101)
Fixes #3100
2020-02-10 08:27:44 -08:00
Marcelo Fabri c5e7bb3d31 Fix PrivateActionRule in Swift 5.2 (#3092) 2020-02-09 22:16:00 -08:00
Marcelo Fabri 4e84992a4a Fix false positive in implicit_getter with Swift 5.2 (#3099)
Fixes #3074
2020-02-09 20:00:53 -08:00
Marcelo Fabri a2fe35d620 Fix false positive in `attributes` with Swift 5.2 (#3097)
Fixes #3079
2020-02-09 18:17:45 -08:00
Marcelo Fabri 085e8ea0c9 Fix NSObjectPreferIsEqualRuleTests with Swift 5.2 (#3096)
This is not valid Swift code and Swift 5.2 changes the SourceKit response: https://bugs.swift.org/browse/SR-12167
2020-02-09 17:09:57 -08:00
Marcelo Fabri 66848e0186 Enable some opt-in rules in SwiftLint itself (#3095) 2020-02-09 17:07:24 -08:00
Marcelo Fabri b303cd64ea
Make SyntaxRules Opt-In (#3094) 2020-02-09 16:20:14 -08:00
Marcelo Fabri 14da706ae9 Remove unused variable in AttributesRule (#3090) 2020-02-09 16:06:27 -08:00
Marcelo Fabri b70b7778df
Fix UnownedVariableCaptureRuleTests in Swift 5.2 (#3091)
https://bugs.swift.org/browse/SR-12168
2020-02-09 16:06:11 -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 62e273c46c
Do not trigger optional_enum_case_matching on `_?` (#3088)
Fixes #3057
2020-02-08 14:42:55 -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 bdede7b9c1 Remove extra space in `optional_enum_case_matching` description (#3087) 2020-02-08 13:49:21 -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
John Buckley efe8816315
ImplicitReturnConfiguration description now reports current config (#3083)
* ImplicitReturnConfiguration description now reports current config.

Previously only the default config was reported.

* Updating CHANGELOG.md
2020-02-08 01:55:58 -08:00
Paul Taykalo 057bcb8921
Fixes #3066 Crash on missing (#3067) 2020-02-02 23:30:40 +02: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
Paul Taykalo 25f07af7bc
Merge pull request #3031 from PetteriHuusko/dev
Fix discarded_notification_center_observer false positive on arrays
2020-01-30 09:19:26 +02:00
Petteri Huusko 3bd269fdd2 Fix discarded_notification_center_observer false positive when capturing observers into an array 2020-01-29 08:32:40 +02:00
Paul Taykalo 8ac124a494 A bit faster Explicit Self rule (#3048) 2020-01-17 13:57:54 -08:00
Steven 325af44c36 Add deinitializer to type_contents_order (#3042)
Add `deinitializer` type content to `type_contents_order` rule instead of grouping it with initializers. This allows the common use case of putting the deinitializer at the end of the class.
2020-01-16 16:49:37 -08: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
iliaskarim 4a56bf56c5 Update RedundantVoidReturnRule.swift (#3039)
Single argument function types require parentheses
2020-01-14 12:58:32 -08:00
JP Simard 399f5b7df6
Fix docstring formatting issues using DrString (#3032)
Using command:
$ drstring check -i 'Source/**/*.swift' --first-letter lowercase --vertical-align
2020-01-12 11:19:33 -08:00
JP Simard 37167a8a35
Add documentation comments to all public declarations (#3027) 2020-01-08 09:47:10 -08:00
JP Simard d2643db495
[Docs] Build docs using jazzy (#3016)
* Add `.jazzy.yaml` configuration file
* Update `swiftlint generate-docs` to write docs to a directory rather than a single file
* Add jazzy to the Gemfile
* Run `bundle update`
* Add CI job to run jazzy automatically and publish to GitHub Pages

![swiftlint-jazzy](https://user-images.githubusercontent.com/474794/71799038-fcf4e180-3008-11ea-81fa-3eb9cf296506.gif)
2020-01-07 20:31:29 -08:00
JP Simard 4388c9f899
Fix regressions in UnusedImportRule (#3025) 2020-01-07 12:43:47 -08:00
JP Simard 760383508e
Improve tuple handling in optional_enum_case_matching rule (#3024)
Catch previously missed violations in the `optional_enum_case_matching` rule when case expressions involved tuples. For example:

```swift
switch foo {
  case (.bar↓?, .baz↓?): break
  case (.bar↓?, _): break
  case (_, .bar↓?): break
  default: break
}
```
2020-01-07 09:36:08 -08:00
Frederick Pietschmann 601ea392c2
Merge pull request #2765 from fredpi/feature/indentation_width
Add new indentation_width rule
2020-01-06 10:47:09 +01:00
Frederick Pietschmann 3d0b568e2c Fix bug with no-syntax-kind lines (e. g. "[") 2020-01-06 10:24:13 +01:00
Marcelo Fabri 4fd593ff39
Add more tests for OrphanedDocCommentRule (#3017) 2020-01-05 23:34:03 -08:00
Frederick Pietschmann d283904b0a Fix rebase issues 2020-01-06 08:30:49 +01:00
Frederick Pietschmann 98e870e726 Fix modifier order 2020-01-06 08:30:49 +01:00
Frederick Pietschmann eb92e0b3a1 Fix wrong spacesEquivalent implementation; simplify validate method 2020-01-06 08:30:49 +01:00
Frederick Pietschmann bc6396d516 Keep linting even when seeing mixed indentation 2020-01-06 08:30:49 +01:00
Frederick Pietschmann 0bed014cba Add extensive tests for indentation_rule; fix duplicate warning avoidance mechanism 2020-01-06 08:30:49 +01:00
Frederick Pietschmann 35cd789ba1 Restructure indentation_width tests 2020-01-06 08:30:49 +01:00
Frederick Pietschmann 1fbb39dd50 Introduce mechanism to avoid duplicate indentation_width warnings for one single issue 2020-01-06 08:30:49 +01:00
Frederick Pietschmann 3a8ad943c3 Add configuration option whether to consider comment lines for indentation_width rule 2020-01-06 08:30:49 +01:00
Frederick Pietschmann 8c245c7581 Add new indentation_width rule 2020-01-06 08:30:49 +01:00
Marcelo Fabri c2bdb589df
Add orphaned_doc_comment rule (#3014)
* Add orphaned_doc_comment rule

Fixes #2989

* Don’t trigger on lines with only “/“
2020-01-05 20:45:06 -08:00
Pyry Jahkola 805b9ab3ba
Add capture_group option to custom_rules
This option allows for more fine-grained placement of the location
marker for code violating a custom rule, e.g.:

```swift
print("Hello world.")
             ^~~~~
```

for this `.swiftlint.yml`:

```yaml
custom_rules:
  world_preceded_by_hello:
    name: "World Preceded by Hello"
    included: ".+\\.swift"
    message: "The word World predeced by the word hello should be capitalised."
    severity: warning
    regex: "(?i:hello)\\s+(world)"
    match_kinds: [string]
    capture_group: 1
```
2020-01-05 15:24:11 -08:00
Sven Münnich 72e2063531
Include functions and getters in rule `implicit_return` 2020-01-05 15:04:35 -08:00
JP Simard 40ade98710
Update SourceKitten to 0.28.0 (#3011) 2020-01-03 16:47:18 -08:00
timcmiller 4112816077 Added 'file_name_no_space' rule (#3008)
* Added 'file_name_no_space' rule

* Removed unused var, and added to changelog

* Remove custom suffix from 'file-name-no-space' rule

* Fixed LinuxMain

* Switched to use a CharacterSet over Regex
2020-01-03 15:45:30 -08:00
timcmiller 29bff89a29 File name console description (#3010)
* Added parameters to FileNameConfiguration.consoleDescription

* Added bugfix to CHANGELOG

* Fix indentation

Co-authored-by: JP Simard <jp@jpsim.com>
2020-01-03 14:00:17 -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
JP Simard 20ba18c820
Indent 2020-01-03 10:17:01 -08:00
Max Härtwig 292d89f18b Make weak_delegate rule correctable (#2959) 2020-01-03 10:16:30 -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
Max Härtwig 44b04f377d Allow SubstitutionCorrectableRule to return nil instead of a correction to indicate that a suitable correction couldn't be found for a specific case (#2958) 2020-01-02 23:15:40 -08:00
JP Simard 99dd894c80
Fix false positives in unused_declaration for protocol extensions (#3000) 2019-12-30 09:44:25 -08:00
JP Simard 9ecefbd969
[UnusedImportRule] Handle comments after the import statement (#2993)
* [UnusedImportRule] Handle comments after the import statement

* fixup! [UnusedImportRule] Handle comments after the import statement

* Use \s+ to capture whitespace in regex

Co-Authored-By: Dave Lee <davelee.com@gmail.com>

* Fix testDetectSwiftVersion() with Swift 5.1.3

* fixup! Fix testDetectSwiftVersion() with Swift 5.1.3

* Handle @_exported imports

* Work around SR-11099

* Unescape newline
2019-12-18 11:30:41 -08:00
a-25 e11fcd9820 Fixed false positive in opening_brace rule on anonymous closure (#2927)
* Fixed false positive in opening_brace rule on anonymous closure

* added one more triggering rule, fixed docs

* fixed anonymous closure match

* fixed anonymous closure match, more accurate
2019-12-03 10:37:47 -08:00
Dan Loman cc57ed3d69 Add ExpiringTodoRule (#2911)
* Add expiring todos rule

* Fix default dateFormat

* Fix date regex to handle 2-4 at beginning/end of string

* Clean up/improve clarity

* Add tests for ExpiringTodoRule

* Add output from make sourcery

* Add output from make sourcery

* Update documentation

* Enable updating of all configuration properties

* Add back Foundation import

* Add changelog entry

* Add 2 spaces after changelog entry

* Add return for legacy swift compatibility

* Add unwrapping to switch statement

* Use disable:next

* Add default values to severity config init; Add public delimiter init

* Add tests for various custom configurations

* Remove unused funcs

* Add extra tests to LinuxMain file

* Update File type -> SwiftLintFile

* Move Changelog entry

* Shorten changelog entry line length

* Fix changelog
2019-11-20 16:50:29 -08:00
JP Simard 5f66704a1a
Improve compilation time (#2965)
* Improve compilation time

Before this change, `trailingClosure` took 8.6s to type check.
After this change, it takes 31ms.

* Speed up type checking `isDecimal(number:)`

Before: 377ms
After: 2ms

* Speed up type checking testViolationMessageForExpressibleByIntegerLiteral()

Before: 285ms
After: 175ms

* Fix OSSCheck

More than just rules are in `Source/SwiftLintFramework/Rules/`

* Shim XCTUnwrap for Swift 5.0
2019-11-15 11:36:25 -08:00
Paul Taykalo 66a4193aa3
Merge pull request #2956 from realm/improvement/let-var-whitespace-rule
Speedup LetVarWhitespaceRule
2019-11-12 21:09:57 +02:00
Paul Taykalo e00a8bf11a That day when regex can be faster than code 2019-11-12 20:36:47 +02:00
Paul Taykalo 3f0db8ff13
Merge pull request #2955 from realm/improvement/own-wrappers-over-syntax-tokens
Add own wrappers for SyntaxTokens and Syntax Map
2019-11-12 20:33:12 +02:00
Max Härtwig 8c7b21dcb2 Fix trailing_comma rule violation 2019-11-12 10:47:13 +01:00
Paul Taykalo d181cb0fd2 Speedup let var whitespace rule a bit 2019-11-12 03:03:22 +02:00
Max Härtwig 76d6f6745a Import Foundation to fix error 2019-11-11 15:01:36 +01:00
Max Härtwig dcc8d6e34c Make control_statement rule substitution correctable 2019-11-11 15:01:36 +01:00
Paul Taykalo 61a6a278a5 add byterange to the dictionary and breadthfirst algorithm 2019-11-10 23:53:59 +02:00
Paul Taykalo 73802c285d Add own wrappers over syntax tokens and syntax map 2019-11-10 22:55:54 +02:00
Paul Taykalo 3a36b6998b Fix false-positive identical operands rule 2019-11-10 21:54:34 +02:00
Paul Taykalo f569e3d973
Rename Traverse to Traverse with Parent 2019-11-09 13:29:43 -08:00
Paul Taykalo c85d3099a1
Update documentation 2019-11-09 13:29:43 -08:00
Paul Taykalo a52a94c987
Use Generic Dictionary Traversing for multiple cases 2019-11-09 13:29:43 -08:00
Paul Taykalo 848370a522 Simpler check for FileTypesOrderRule 2019-11-08 01:35:01 +02:00
Paul Taykalo d771d223e3 Remove unused imports 2019-11-07 16:20:18 +02:00
Paul Taykalo ac40778cb3 Use SwiftLintFile wrapper over the File 2019-11-07 15:19:17 +02:00
Paul Taykalo 2a308c1698 Fix DiscardedNotificationCenterObserverRule 2019-11-07 12:07:56 +02:00
Paul Taykalo ec6d82af56 Cache Access Control Level property 2019-11-07 11:52:50 +02:00
Paul Taykalo b1cdc119ec Use swift enums instead of raw values 2019-11-07 11:05:19 +02:00
Paul Taykalo 4fff698c09 Update UnusedDeclarationRule to use SourceKittenDictionary 2019-11-07 10:28:30 +02:00
Paul Taykalo 18a3896f97 Update swift structure dictionary 2019-11-07 08:51:16 +02:00
Paul Taykalo f0ad230e81 fix linting issues 2019-11-07 08:50:50 +02:00
Paul Taykalo b901c670d4 Cache file structure dictionary 2019-11-07 08:50:50 +02:00
Paul Taykalo 8c963d2c15 Working solution with SouceKittenDictionary wrapper 2019-11-07 08:50:50 +02:00
Paul Taykalo 1db3eb7890 Change zip.allSatisfy to map == 2019-10-25 19:53:45 +03:00
Paul Taykalo b996e0c890 Allow force casts when chainng operators 2019-10-25 19:40:37 +03:00
Paul Taykalo 94c3f9a14b Update rules and fix syntax violations 2019-10-25 19:20:34 +03:00
Paul Taykalo 1833a44031 Include optional chaining operator when joiing operands 2019-10-25 16:03:03 +03:00
Paul Taykalo a361848866 Identical operands rule using syntaxmap 2019-10-25 04:04:38 +03:00
Marcelo Fabri 355a219b8a PR feedback 2019-10-23 12:31:07 -07:00
Marcelo Fabri cff53944c4 Optimize `redundant_void_return` 2019-10-20 20:40:11 -07:00
Marcelo Fabri a9ae253bd4
Merge pull request #2889 from 00FA9A/mp/2888
Add `raw_value_for_camel_cased_codable_enum` (#2888)
2019-10-20 20:37:20 -07:00
Marcelo Fabri 029f1a9916
Merge pull request #2892 from vani2/syntactic-sugar-autocorrect
Add autocorrection to the syntactic sugar rule
2019-10-20 20:36:41 -07:00
Marcelo Fabri 3b5458a248 Use String.isLowercase() 2019-10-20 19:19:54 -07:00
MarkoPejovic 109899c56c Implement #2888 2019-10-20 19:19:54 -07:00
Ivan Vavilov 8af5825ca1 Add some test cases 2019-10-20 19:08:54 -07:00
Ivan Vavilov ffa955dc7d Add autocorrection to the syntactic sugar rule 2019-10-20 19:08:54 -07:00
Paul Taykalo d891b1ec60 Use binary search when searching for lines indexes in LetVarWhiteSpacesRule (#2901)
* Use binary search when searching for lines indexes

* Update Changelog

* Remove unused old method of searching line by offset

* Update line by offset call with already implemented function
2019-10-20 11:30:32 -07:00
Marcelo Fabri 2dcaf3ee78
Merge pull request #2894 from realm/mf-update-sourcekitten
Update SourceKitten to 0.26.0
2019-10-08 09:36:57 -07:00
Marcelo Fabri f5174b3168 Update SourceKitten to 0.26.0 2019-10-08 00:51:18 -07:00
Max Härtwig 1a5aa05c34 Add missing Foundation import 2019-10-07 09:42:19 +02:00
Max Härtwig b9368cbca6 Fix reference to 2019-10-07 09:27:31 +02:00
Max Härtwig a157957df4 Make `toggle_bool` rule substitution correctable 2019-10-07 01:16:15 +02: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
JP Simard ffb2f4f76d
Require Swift 5.0 to build (#2857)
* Require Swift 5.0 to build

* Update CI

* Stop testing with Swift 4.x & Xcode 10.0/10.1
* Use official Swift docker image instead of norionomura's
* Use Xcode 10.3 as latest stable version

* Update READMEs

* Fixup xcodeproj

* Fixup CI Swift container image tag

* Fixup changelog
2019-09-03 11:42:57 -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
Marcelo Fabri dae7a7b193 Don't trigger `missing_docs` on extensions
Fixes #2851
2019-08-30 14:29:32 -07:00
Colton Schlosser 130371b8cc Add `empty_collection_literal` rule 2019-08-28 21:57:02 -04:00
JP Simard 0d18758241
Use reduce(into:) for unused imports rule (#2850) 2019-08-28 16:20:47 -07:00
Marcelo Fabri 3879151abf Enable some opt-in rules (#2801) 2019-08-28 14:49:23 -07:00
Marcelo Fabri b24fd6cdd4 Enable `contains_over_filter_is_empty` in SwiftLint itself 2019-08-25 20:58:11 -07: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
Marcelo Fabri 7c6d5d0994
Merge pull request #2815 from atfelix/issue-2791-swiftui-previews
Removes `type_name` violation for SwiftUI template code
2019-08-25 19:32:05 -07:00
Adam Felix 6f67cfa5aa Issue-2791: `type_name` violation for with SwiftUI template code
* Ignore SwiftUI Previews underscore character
2019-08-25 20:01:28 -04:00