Skip to content

Commit

Permalink
Merge pull request #37 from arthurpalves/fix/filename-processing
Browse files Browse the repository at this point in the history
Fix filename processing if source folder is referenced as './'
  • Loading branch information
arthurpalves authored Jun 1, 2020
2 parents fa6b27a + 7c653c1 commit 2638c79
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### 0.5.1
- fix: fail to on 'init' command if not installed through make/brew/mint ([#35](https://github.com/arthurpalves/coherent-swift/pull/35)) via [@arthurpalves](https://github.com/arthurpalves)

6 changes: 5 additions & 1 deletion Sources/coherent-swift/Helpers/IO/IOOperations.swift
Original file line number Diff line number Diff line change
@@ -108,6 +108,10 @@ extension IOOperations {
fileAmount += 1
}
}
} else {
self.logger.logDebug("⚠️ Ignoring: ",
item: "\(filename) - Not a .swift file format",
color: .purple)
}
}

@@ -140,7 +144,7 @@ extension IOOperations {

private func processFilePath(filename: String, sourcePath: String) -> String {
var filepath = filename
if filepath.contains(sourcePath) {
if sourcePath.count > 2, filepath.contains(sourcePath) {
filepath = filepath.replacingOccurrences(of: sourcePath, with: "")
filepath = filepath.starts(with: "/") ? String(filepath.dropFirst()) : filepath
}
2 changes: 1 addition & 1 deletion Sources/coherent-swift/main.swift
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import SwiftCLI

let cli = CLI(
name: "coherent-swift",
version: "0.5.0",
version: "0.5.2",
description: "A command-line tool to analyze and report Swift code cohesion"
)

0 comments on commit 2638c79

Please sign in to comment.