Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/aarondaub/SwiftLint into …
Browse files Browse the repository at this point in the history
…ad-dynamicRules
  • Loading branch information
Aaron Daub authored and Aaron Daub committed May 20, 2015
2 parents 9299e54 + d550d7d commit 97b96ec
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* The `Rule` and `ASTRule` protocol members are now non-static.
[aarondaub](https://github.com/aarondaub)

* Split `Rule` into `Rule` and `ParameterizedRule` protocols.
[aarondaub](https://github.com/aarondaub)
[#21](https://github.com/realm/SwiftLint/issues/21)

##### Enhancements

* The following rules now conform to `ASTRule`:
Expand Down
11 changes: 5 additions & 6 deletions Source/SwiftLintFramework/Rule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@

import SourceKittenFramework

protocol Rule {
var identifier: String { get }
func validateFile(file: File) -> [StyleViolation]
}

protocol ParameterizedRule: Rule {
typealias ParameterType
var parameters: [RuleParameter<ParameterType>] { get }

}

public protocol Rule {
var identifier: String { get }
func validateFile(file: File) -> [StyleViolation]
}

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import SourceKittenFramework
import SwiftXPC

struct FunctionBodyLengthRule: ASTRule {
struct FunctionBodyLengthRule: ASTRule, ParameterizedRule {
let identifier = "function_body_length"
let parameters = [
RuleParameter(severity: .VeryLow, value: 40),
Expand Down
2 changes: 1 addition & 1 deletion Source/SwiftLintFramework/Rules/TypeBodyLengthRule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import SourceKittenFramework
import SwiftXPC

struct TypeBodyLengthRule: ASTRule {
struct TypeBodyLengthRule: ASTRule, ParameterizedRule {
let identifier = "type_body_length"
let parameters = [
RuleParameter(severity: .VeryLow, value: 200),
Expand Down

0 comments on commit 97b96ec

Please sign in to comment.