Marcelo Fabri
8638d23aec
Merge pull request #3281 from realm/marcelo/bugfix-3225
...
Trigger closure_parameter_position in free closures and capture lists
2020-08-05 01:12:22 -07:00
Marcelo Fabri
a05a87e7f2
Merge pull request #3258 from SimplyDanny/bugfix-3034
...
Fix #3034 : Allow opening brace directly after another opening brace
2020-08-05 01:02:00 -07:00
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
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
28bec96b3e
Remove a usage of “blacklist”
2020-08-04 04:00:36 -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
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
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
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
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
39ee6fe34e
Fix false positives on implicit_getter with Swift 5.2+ ( #3151 )
...
Fixes #3149
2020-03-26 18:53:36 -07: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
14da706ae9
Remove unused variable in AttributesRule ( #3090 )
2020-02-09 16:06:27 -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
bdede7b9c1
Remove extra space in optional_enum_case_matching description ( #3087 )
2020-02-08 13:49:21 -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
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
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
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
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
3d0b568e2c
Fix bug with no-syntax-kind lines (e. g. "[")
2020-01-06 10:24:13 +01:00
Frederick Pietschmann
d283904b0a
Fix rebase issues
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
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
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
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
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
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