Skip to content

Commit

Permalink
Silently load nested configurations.
Browse files Browse the repository at this point in the history
  • Loading branch information
scottrhoyt committed Dec 28, 2015
1 parent 0bf09ef commit d8c418e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions Source/SwiftLintFramework/Extensions/QueuedPrint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ public func queuedPrint<T>(object: T) {
A thread-safe, newline-terminated version of fputs(..., stderr).

- parameter string: String to print.
- parameter silent: True suppresses output
*/
public func queuedPrintError(string: String) {
dispatch_async(outputQueue) {
fputs(string + "\n", stderr)
public func queuedPrintError(string: String, silent: Bool = false) {
if !silent {
dispatch_async(outputQueue) {
fputs(string + "\n", stderr)
}
}
}
4 changes: 2 additions & 2 deletions Source/SwiftLintFramework/Models/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public struct Configuration {
let yamlContents = try NSString(contentsOfFile: fullPath,
encoding: NSUTF8StringEncoding) as String
if let yamlConfig = Configuration.loadYaml(yamlContents) {
queuedPrintError("Loading configuration from '\(path)'")
queuedPrintError("Loading configuration from '\(path)'", silent: silent)
self.init(yamlConfig: yamlConfig)!
configPath = fullPath
return
Expand Down Expand Up @@ -225,7 +225,7 @@ extension Configuration {
// If a config exists and it isn't us, load and merge the configs
if configSearchPath != configPath &&
NSFileManager.defaultManager().fileExistsAtPath(configSearchPath) {
return merge(Configuration(path: configSearchPath, optional: false))
return merge(Configuration(path: configSearchPath, optional: false, silent: true))
}

// If we are not at the root path, continue down the tree
Expand Down

0 comments on commit d8c418e

Please sign in to comment.