Commit Graph

48 Commits

Author SHA1 Message Date
Norio Nomura 8d46e22729 Generate assertion on every (non)triggering examples in `verifyRule()`
It makes failed triggering/non-triggering example locatable on Xcode's Issue Navigator.
2016-01-26 12:05:10 +09:00
Scott Hoyt 75f2068299 Switch to if/early return for VariableNameRule. 2016-01-23 17:53:27 -08:00
Scott Hoyt 44ff8effc9 Reset VariableNameRule to if check on return as opposed to guard. 2016-01-23 17:42:13 -08:00
Scott Hoyt b145bf1212 Reset VariableNameRule to instantiating Location at the call site. 2016-01-23 17:42:13 -08:00
Scott Hoyt 123d06e585 Switch VariableNameRule to use a guard for early exit if name is excluded. 2016-01-23 17:42:13 -08:00
Scott Hoyt 885b47d8e7 Extract severity function to ConfigProviderRule extension for better encapsulation. 2016-01-23 17:42:13 -08:00
Scott Hoyt 60546e4c0d Renamed violationSeverity to severity for brevity. 2016-01-23 17:42:13 -08:00
Scott Hoyt 3230c6413e Replaced things in rule configurations named configuration for config to save space. 2016-01-23 17:42:13 -08:00
Scott Hoyt 53e30574e1 Extracted violationSeverity to NameConfig. 2016-01-23 17:42:13 -08:00
Scott Hoyt 20e8038a91 Changed min/max names to reflect that they belong to name length. 2016-01-23 17:42:13 -08:00
Scott Hoyt bf5a569104 Renamed MinMaxLengthConfig to NameConfig to reflect combined responsibilities. 2016-01-23 17:42:13 -08:00
Scott Hoyt d137dcdbf2 Remove VariableNameRuleConfig in leu of adding excluded to MinMaxLengthConfig. Reduced length of length violation message. 2016-01-23 17:42:13 -08:00
Scott Hoyt 810f813d70 Add min/max thresholds to MinMaxLengthConfig for convenience. 2016-01-23 17:42:13 -08:00
Scott Hoyt 0691b79a08 Rename Rule Configurations. 2016-01-23 17:42:13 -08:00
Scott Hoyt 84aa4793bc Fixed description for VariableNameRule to reflect new responsibility. 2016-01-23 17:42:13 -08:00
Scott Hoyt ddcde17f04 Add min and max length checking responsibilities to VariableNameRule. 2016-01-23 17:42:13 -08:00
JP Simard d5598d4eae add missing imports needed by SPM 2016-01-22 21:09:28 -08:00
JP Simard ace0999154 update SourceKitten to 0.8.0 2016-01-22 19:19:15 -08:00
Norio Nomura 7c4b7f34ac Reduce creation of `Location`
Performance improvement is small on real usage.
But, it reduces the duration of `make test`
from:
```
…
✓ testTypeBodyLengths (15.942 seconds)
…
Executed 70 tests, with 0 failures (0 unexpected) in 22.355 (22.393) seconds
```
to:
```
…
✓ testTypeBodyLengths (8.197 seconds)
…
Executed 70 tests, with 0 failures (0 unexpected) in 14.455 (14.500) seconds
```
2016-01-23 11:59:56 +09:00
Scott Hoyt 9b6f3070a3 Wrote ConfigurableRule, made ParameterizedRule's conform, moved configuration into rules themselves. 2016-01-11 11:21:49 -08:00
JP Simard 85d8c68978 test violation locations 2015-12-27 13:33:42 -05:00
JP Simard 8d529f1804 Fix multibyte handling in many rules 2015-12-24 20:59:15 -05:00
JP Simard 96a4e6cc2f remove `init()` from `Rule`. 2015-11-29 21:43:53 -08:00
Marcelo Fabri 1bc53b50fe Fixing typo 2015-11-28 01:12:14 -02:00
Marcelo Fabri 815f19632b Variable name violation should be ignored if the entire name is in capitals 2015-11-28 00:16:56 -02:00
JP Simard ecb2a8bee5 refactor variable name rules 2015-11-17 16:13:06 -08:00
JP Simard 66a8b4441d minor improvements to the variable name family of rules 2015-11-17 10:30: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 c6800e1ace update dependencies & lint parameter variables 2015-11-03 12:31:37 -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
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
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 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
Nikolaj Schumacher d8e0047ed2 Add caching of Structure and SyntaxMap.
There is no need to read them individually for every rule.
This cuts execution time by more than 50%.
2015-05-26 17:24:08 +02:00
JP Simard a68a886d3f minor tweaks 2015-05-25 15:23:21 -07:00
Chris Eidhof e7a4e9f651 Rename examples from correct/failure to non-triggering and triggering 2015-05-25 14:46:14 -07:00
Chris Eidhof 20fd31672a List of all the rules 2015-05-25 14:46:13 -07:00
Chris Eidhof 89ea957b05 Changed RuleExample to be a struct 2015-05-25 14:46:13 -07:00
JP Simard e2df0546d3 Split `Rule` into `Rule` and `ParameterizedRule` protocols (fixes #21) 2015-05-20 18:27:16 +02:00
JP Simard fc625656ae [ASTRule] Made several rules conform to ASTRule 2015-05-19 15:36:07 +02:00
Aaron Daub 15a100153d Have the Rule protocol define its members as non-static so that we can pass around instances of Rule 2015-05-19 07:44:11 +02:00
JP Simard 8753bece31 VariableNameRule 2015-05-18 06:06:49 +02:00