Skip to content

Commit

Permalink
Clean up on naming.
Browse files Browse the repository at this point in the history
  • Loading branch information
daveverwer committed Sep 12, 2023
1 parent fe3a98a commit 5e21a89
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import ArgumentParser
import Foundation

extension Validator {
struct RemoveDenyList: ParsableCommand {
struct ApplyDenyList: ParsableCommand {
@Option(name: .shortAndLong, help: "Path to packages.json")
var packagesFile: String

@Option(name: .shortAndLong, help: "Path to denylist.json")
var denylistFile: String
var denyFile: String

private struct DeniedPackage: Decodable {
var packageUrl: String
Expand All @@ -31,7 +31,7 @@ extension Validator {
}
}

func getDenylistUrls(from path: String) throws -> [PackageURL] {
func getDenyListUrls(from path: String) throws -> [PackageURL] {
let fileUrl = URL(fileURLWithPath: path)
let data = try Data(contentsOf: fileUrl)
let deniedPackages = try JSONDecoder().decode([DeniedPackage].self, from: data)
Expand Down Expand Up @@ -77,8 +77,8 @@ extension Validator {

mutating func run() throws {
let packageUrls = try InputSource.file(packagesFile).packageURLs()
let denylistUrls = try getDenylistUrls(from: denylistFile)
let processedPackageList = processPackageDenyList(packageList: packageUrls, denyList: denylistUrls)
let denyListUrls = try getDenyListUrls(from: denyFile)
let processedPackageList = processPackageDenyList(packageList: packageUrls, denyList: denyListUrls)

let fileURL = URL(fileURLWithPath: packagesFile)
try packageListEncoder.encode(processedPackageList).write(to: fileURL)
Expand Down
2 changes: 1 addition & 1 deletion Sources/ValidatorCore/Commands/Validator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public struct Validator: ParsableCommand {
subcommands: [CheckDependencies.self,
CheckRedirects.self,
MergeLists.self,
RemoveDenyList.self,
ApplyDenyList.self,
Version.self],
defaultSubcommand: Version.self
)
Expand Down
2 changes: 1 addition & 1 deletion Tests/ValidatorTests/RemoveDenyListTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final class RemoveDenyListTests: XCTestCase {
].map { PackageURL(rawValue: URL(string: $0)!) }

// MUT
let command = Validator.RemoveDenyList()
let command = Validator.ApplyDenyList()
let processedList = command.processPackageDenyList(packageList: packageList, denyList: denyList)

XCTAssertEqual(processedList, [
Expand Down

0 comments on commit 5e21a89

Please sign in to comment.