Commit Graph

2587 Commits

Author SHA1 Message Date
Marcelo Fabri 07824e7106 Dynamically load lib_InternalSwiftSyntaxParser.dylib 2020-02-12 00:10:26 -08:00
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
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 5a4c3f143d release 0.39.0 2020-02-10 22:19:59 -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
David Harris 8c789bb3e2 feature: add config setting to exist successfully in case of no lintable (#2732)
files
2020-02-08 13:33:50 -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
John Mueller be44017675
Fix false positives when line ends with carriage return + line feed (#3061)
Fixes: #3060
2020-02-02 15:37:49 -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 5b5314ee70
Fix documentation in Version.swift 2020-01-08 12:14:42 -08:00
JP Simard 76d44cff39
release 0.38.2 2020-01-08 10:35:08 -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