Commit Graph

95 Commits

Author SHA1 Message Date
JP Simard d269bde1fa allow trailing semicolons in comments 2015-11-17 11:41:02 -08:00
JP Simard 0a2b9e8a54 add trailing semicolon rule 2015-11-17 10:46:26 -08:00
JP Simard a45043bbaf use verifyRule to test Trailing Newline rule 2015-11-17 10:44:30 -08:00
JP Simard 66a8b4441d minor improvements to the variable name family of rules 2015-11-17 10:30:53 -08:00
JP Simard 989127cbe0 [StyleViolation] use RuleDescription's description when reason is nil
Many cases just used a static string that was nearly identical to the rule
description as the `reason` parameter when initializing a StyleViolation.
2015-11-17 10:25:57 -08:00
JP Simard 76b30ee19b make all rule descriptions follow a consistent format 2015-11-17 10:18:29 -08:00
JP Simard 4a5ac44897 add SyntaxKind.commentAndStringKinds() 2015-11-17 10:11:04 -08:00
JP Simard 2300904500 update dependencies & make minor improvements to some rules 2015-11-15 14:53:41 -08:00
Mickael Morier 528af41764 fix colon rule issue #135 2015-11-15 16:11:56 +01:00
Keith Smiley 631bd965b4 Fix brace spelling error 2015-11-11 15:47:02 -08:00
Mickael Morier 8f1788ad5f some refactor after code review 2015-11-11 21:20:51 +01:00
Mickael Morier b18463154c improve ControlStatementRule especially when several parentheses exists in condition and several bad cases appears 2015-11-11 16:36:47 +01:00
JP Simard 2131613166 no longer trigger a nesting violation for enums one level deep. fixes #190 2015-11-10 08:58:53 -08:00
Mickael Morier 91aa913c62 add 2 new parameter rules to check min and max length of variable names and remove length check in VariableNameRule 2015-11-07 03:03:08 +01:00
Will Fleming a70e4bd759 change VariableNameRule to allow capital static let
There is at least one semi-common case where capitalized names should
probably be allowed: in OptionSetType classes, the standard pattern is
to use `static let = Foo` to declare each option for the type.

Apple docs demostrating this:
https://developer.apple.com/library/prerelease/ios/documentation/Swift/Reference/Swift_OptionSetType_Protocol/index.html

One downside of this implementation is that it would *also* pass a
capitalized "static var Foo", which is probably not desirable. It's not
clear to me how feasible addressing this is: it seems like SourceKitten
might need to be updated to support this better? Using `static var` at
all is code smell, though, so hopefully this isn't a huge deal. Perhaps
there should even be a rule identifying `static var` and considering it
a violation?
2015-11-05 11:35:07 -05:00
JP Simard 8e12dbd81d move ASTRule function implementations into a protocol extension 2015-11-04 15:39:29 -08:00
JP Simard 0335f155ab Perform major refactor of rule description, identifiers and examples
Fixes #183.
2015-11-04 12:24:33 -08:00
JP Simard 5cb80cfd22 All rules now print their identifiers in reports. Fixes #180. 2015-11-04 10:30:36 -08:00
JP Simard 3e53537882 Merge pull request #172 from S2dentik/statementPosition
Add Statement Position rule
2015-11-03 12:58:00 -08:00
JP Simard 233429365e Merge pull request #179 from realm/jp-update-dependencies
update dependencies & lint parameter variables
2015-11-03 12:52:50 -08:00
JP Simard c6800e1ace update dependencies & lint parameter variables 2015-11-03 12:31:37 -08:00
Alex Culeva aa1fc70c9c Add StatementPosition rule 2015-11-03 22:27:26 +02:00
Alex Culeva 5af582ca53 Add Comma rule 2015-11-03 22:05:31 +02:00
JP Simard 5b34dabe30 Merge pull request #176 from zippy1978/master
Added rule reference on command output to enable batch processing
2015-11-03 11:25:23 -08:00
Gilles Grousset 7feb26ebe2 Refactored Rule reference in StyleViolation
Now uses a String with the rule identifier
2015-11-03 13:31:29 +01:00
Alex Culeva 023466e843 Add OpeningBrace Rule 2015-11-03 11:06:16 +02:00
JP Simard 12f3c345a7 [CHANGELOG] add entry for #167 2015-11-02 15:05:05 -08:00
Gilles Grousset 7328b41da8 Added rule reference to StyleViolation
- Added rule reference to StyleViolation
- Added rule_id field on JSONReporter and CSVReporter
2015-11-01 02:00:04 +01:00
David Potter 8748a4f3a2 Add guard statements to nonTriggeringExamples and triggeringExamples and fix tests. 2015-10-23 19:11:44 -07:00
David Potter 94b7ebdf36 Add support for the guard statement to ControlStatementRule. 2015-10-23 18:40:56 -07:00
JP Simard 57177e018d update RulesCommand to print identifiers but not examples 2015-10-19 12:53:48 -07:00
Daniel Beard 4339a281df PR comments 2015-10-07 11:16:20 -07:00
Daniel Beard 64cd034503 Change TrailingNewLine violation line to have an index within the file 2015-10-07 11:06:19 -07:00
Keith Smiley fa97ce073a Update rule descriptions to not include specifics
Now that configuration of rules has been added, having these hard coded
lengths is no longer valid.
2015-09-30 13:22:37 -07:00
JP Simard 25017c4ea4 [Configuration] allow configuring parameterized rules from the configuration file 2015-09-21 11:08:29 -07:00
JP Simard 75f4122f63 generalize TodoRule 2015-09-04 13:57:16 -07:00
JP Simard 3f3c6e550f further generalized TodoRule 2015-09-04 13:46:57 -07:00
JP Simard e947f58669 Generalize TodoRule
as prompted by my own recommendations... doh! https://github.com/realm/SwiftLint/pull/126#issuecomment-137846688
2015-09-04 13:46:57 -07:00
JP Simard f3a7eff1a0 don't use \h in regex 2015-09-03 16:29:23 -07:00
JP Simard 7dd5ee1b15 Allow newlines in function return arrow. This prevented SwiftLint from linting 2015-09-03 15:23:21 -07:00
Keith Smiley 7a6028f1dd Optimize trailing whitespace rule
This updates the rule to no longer reverse each line in each file.
Instead the last character in each line is individually checked for
whitespace.
2015-09-03 13:41:58 -07:00
Keith Smiley d12f9cc271 Move to SourceKitten's File lines
The new lines property on File is a cached version of the same lines.
This means we don't have to compute these multiple times during linting.
2015-09-03 11:50:50 -07:00
JP Simard fe5f1affc9 ViolationSeverity is now only .Warning and .Error 2015-08-30 22:21:59 -07:00
JP Simard 26627fa1b2 [TypeNameRule][VariableNameRule] allow private names to start with an underscore 2015-08-28 14:22:32 -07:00
JP Simard 19cc87a404 Configure SwiftLint via a YAML file. Fixes #1 and #3. 2015-08-27 14:21:17 -07:00
JP Simard 29536759d1 update for Xcode 7 Beta 6 2015-08-27 14:20:51 -07:00
JP Simard e95625ee79 update for swift 2 2015-08-27 14:20:51 -07:00
Keith Smiley 3f9786a22d Lint parentheses around switch statements 2015-08-24 11:24:51 -07:00
Keith Smiley 65f6715915 Improve trailing newline performance
This sidesteps the previous method of reversing the entire string from
every file by only checking the minimum number of trailing characters
for each file.
2015-08-14 20:30:40 -07:00
JP Simard 90dfe362a2 [OperatorFunctionWhitespaceRule] refactored rule. Fixes #60. 2015-06-17 10:37:52 -07:00