mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
24 lines
667 B
Swift
24 lines
667 B
Swift
//
|
|
// TodoRule.swift
|
|
// SwiftLint
|
|
//
|
|
// Created by JP Simard on 2015-05-16.
|
|
// Copyright (c) 2015 Realm. All rights reserved.
|
|
//
|
|
|
|
import SourceKittenFramework
|
|
|
|
struct TodoRule: Rule {
|
|
static let identifier = "todo"
|
|
static let parameters = [RuleParameter<Void>]()
|
|
|
|
static func validateFile(file: File) -> [StyleViolation] {
|
|
return file.matchPattern("// (TODO|FIXME):", withSyntaxKinds: [.Comment]).map { range in
|
|
return StyleViolation(type: .TODO,
|
|
location: Location(file: file, offset: range.location),
|
|
severity: .Low,
|
|
reason: "TODOs and FIXMEs should be avoided")
|
|
}
|
|
}
|
|
}
|