Reimar Twelker
d8733e8830
Uses the new TrailingWhitespaceConfiguration type.
...
If the `ignoresEmptyLines` flag of the configuration is `true`, validation does not report and correction does not correct whitespace-indented empty lines.
2016-06-07 14:15:00 -07:00
Reimar Twelker
940b0c194e
Added a RuleConfiguration subclass specifically for the trailing whitespace rule.
...
Its `ignoresEmptyLines` flag controls whether the rule should ignore whitespace-indented empty lines when detecting violations and correcting files. By default, the flag is false.
2016-06-07 14:14:29 -07:00
JP Simard
c66c5c8df0
formatting fixes
...
found running `swiftlint autocorrect --format`
2016-05-29 14:58:28 -07:00
Andrew Rahn
e5047c459d
Disable the cascade warning when case is involved
...
This is a workaround that prevents invalid warning when the use of a case statement requires multiple let keywords for syntax
2016-05-24 23:48:47 -05:00
Jorge Bernal
548c21a187
Allow lowercase enum values
...
The Swift API Design Guidelines states that:
> Names of types and protocols are UpperCamelCase. Everything else is
> lowerCamelCase.
https://swift.org/documentation/api-design-guidelines/#follow-case-conventions
This PR changes `type_name` so it doesn't force enum values to UpperCamelCase.
2016-05-10 18:12:07 +02:00
Brian Hardy
5c1d40ca87
Updates whitespace to avoid line length violation.
...
The shame, oh the shame.
2016-05-02 00:23:49 -04:00
Brian Hardy
88c0c8ba8e
Improves error messaging for Configuration, particularly with YAML parsing.
2016-05-02 00:05:57 -04:00
Norio Nomura
6afc7222d9
Better handling let/var mix in ConditionalBindingCascadeRule
...
Fix #642
2016-04-29 08:54:21 +09:00
Norio Nomura
ad4ce54ccc
Add failing example to ConditionalBindingCascadeRule
2016-04-29 08:14:52 +09:00
JP Simard
fbd2bcd0ed
release 0.10.0
2016-04-27 21:07:50 +02:00
Nadohs
ba9d7fcda7
Added UIEdgeInsetsMake Legacy Rule
...
add check for `UIEdgeInsetsMake` in `LegacyConstructorRule`. `UIEdgeInsets` should be used instead.
2016-04-25 21:10:24 -07:00
Craig Siemens
7930c096a0
Changed guard to be based on the largest replacement index. Added entry to the changelog.
2016-04-24 10:38:04 -06:00
Craig Siemens
c3a5e33a59
Add autocorrect for ReturnArrowWhitespaceRule
2016-04-23 23:56:40 -06:00
Sarr Blaise
587e3886cf
import Foundation (spm_test)
2016-04-17 21:27:43 +02:00
Sarr Blaise
4f5f3a60cd
Fix correctFile: function
2016-04-17 20:59:49 +02:00
Sarr Blaise
666a5b4899
Add failing example to LegacyCGGeometryFunctionsRule
2016-04-17 20:42:06 +02:00
Blaise Sarr
94e5226a4a
Implements correctFile: method
2016-04-17 14:56:03 +02:00
Blaise Sarr
20ef756c40
Add RegexHelpers file
...
- This will be used to centralize common used regex and avoid duplicate them
2016-04-17 14:56:03 +02:00
Blaise Sarr
3e91e27843
Enable rule
2016-04-17 14:56:03 +02:00
Blaise Sarr
4a2174de13
Implements validateFile: method
2016-04-17 14:56:03 +02:00
Blaise Sarr
9a6378520a
Add LegacyCGGeometryFunctionsRul rule
2016-04-17 14:56:03 +02:00
JP Simard
429e738806
Merge pull request #624 from realm/nn-fix-623
...
`LegacyConstantRule` and `LegacyConstructorRule` failed to `autocorrect`
2016-04-17 09:43:12 +02:00
Norio Nomura
1cb68b8706
[SPM] Add import Foundation
2016-04-17 13:20:57 +09:00
Norio Nomura
cf91026c88
Fix LegacyConstructorRule
...
#623
2016-04-17 13:01:54 +09:00
Norio Nomura
becb6913fe
Add failing example to LegacyConstructorRule
2016-04-17 13:01:54 +09:00
Norio Nomura
f36557d5e7
Fix LegacyConstantRule
...
#623
2016-04-17 13:01:54 +09:00
Norio Nomura
0c683cd4f7
Add failing example to LegacyConstantRule
2016-04-17 13:01:54 +09:00
Norio Nomura
9c0a2492e8
Refactor ASTRule and add SourceKitFreeRule
...
- Make `ASTRule` to generic and remove `ASTBaseRule`
- Add `SourceKitFreeRule` and remove `RuleDescription.needsSourceKit`
2016-04-16 22:32:53 +09:00
Norio Nomura
39282654f4
Fix conditional_binding_cascade violations
2016-04-16 08:30:00 +09:00
Norio Nomura
0d7cbc1835
Rewrite ConditionalBindingCascadeRule
...
Fix #617
2016-04-16 08:30:00 +09:00
Norio Nomura
ad50e35c4e
Add ASTBaseRule
...
`ASTBaseRule` takes kind as `String` for supporting other than `SwiftDeclarationKind`.
`ASTRule` inherits `ASTBaseRule`.
2016-04-16 08:30:00 +09:00
Norio Nomura
8055cb84a8
Add false negative example to ConditionalBindingCascadeRule
...
from #617
2016-04-16 08:30:00 +09:00
Norio Nomura
2c19f759b2
Add File.assertHandler for testing
...
Because XCTest does not have functions that expecting assert happens.
That will be used only when sourcekitd failed, so performance regression by this is ignorable.
2016-04-13 18:40:25 +09:00
Norio Nomura
e4a161132e
Change File.sourcekitdFailed to settable and internal
...
settable is for testing.
2016-04-13 18:40:25 +09:00
Norio Nomura
43f75642f8
Change Cache<T> to working for file without path
2016-04-13 18:40:25 +09:00
Norio Nomura
350a85a3cb
Request.sendMayThrow() has been changed to Request.failableSend()
2016-04-13 18:40:25 +09:00
Norio Nomura
5cc6d3243a
On SourceKitd failed, continue linting the file by limited rules that does not use SourceKitd
...
Add `RuleDescription.needsSourceKit` indicating the rule needs SourceKit.
If `ASTRule` or `needsSourceKit` is true, skip linting if SourceKitd fails.
2016-04-13 18:40:25 +09:00
Norio Nomura
3ae3bfef71
Add early returns by checking File.sourcekitdFailed
2016-04-13 18:40:25 +09:00
Norio Nomura
b0cda17c4c
Move calling queueForRebuild.append(structure) to structureCache's factory closure
...
Because Swift does not allow `as? Structure?`.
2016-04-13 18:40:25 +09:00
Norio Nomura
d92b2d6037
Use Request.sendMayThrow() in SourceKittenFramework
...
For gaining advantage of using `sourcekitd_set_notification_handler()`,
we need to vacate main thread to `dispatch_main()`.
2016-04-13 18:40:25 +09:00
Norio Nomura
e1e4923867
Use for Xcode 7.3
2016-04-07 23:17:11 +09:00
Josh Friend
a4d32cfa67
Don't trigger ClosingBraceRule across line breaks
...
Closes #592
2016-04-05 14:11:10 -04:00
JP Simard
6cafa08e70
release 0.9.2: Multiple Exhaust Codes
2016-03-15 15:29:14 -07:00
Erik Aigner
2c5b7a61d6
Accept variable names starting with more than one capital letter
...
The rule was modified to allow for names that start with multiple uppercase letters like XMLString or MIMEType.
Closes #566
2016-03-13 12:08:32 +01:00
JP Simard
0979aa3b64
Merge pull request #552 from realm/nn-rewrite-force-unwrapping-rule
...
Rewrite `ForceUnwrappingRule`
2016-03-09 19:53:44 -08:00
JP Simard
1166b697c2
fix docs typos
2016-03-09 19:43:52 -08:00
Neil Gall
1b4cf0c574
Do not overwrite files whose contents have not changed
2016-03-02 14:23:33 +00:00
Norio Nomura
f62fe10372
Rewrite ForceUnwrappingRule
...
Add capture previous of "!" for:
- checking whether SyntaxKinds is comment, string, keyword or type identifier
- checking whether character is ")"
- checking whether SyntaxKinds is identifier or not
- SwiftDeclarationKind is one of some "Var*" and declaration containing "="
Add capture next of "!" for:
- checking SyntaxKinds is identifier
By applying this, the duration of linting Carthage 0.14 increase from 300ms to 380ms.
2016-02-21 22:35:56 +09:00
Norio Nomura
c042258ac3
Add Structure.kindsFor(_:)
...
That returns array of tupple containing "key.kind" and "byteRange" from Structure that containing the byte offset.
2016-02-21 22:35:56 +09:00
Norio Nomura
f80373f43d
Add failing false positive examples to ForceUnwrappingRule's description
...
#546 , #547
2016-02-21 22:35:56 +09:00