Skip to content

Remove non-inclusive language #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Sources/TSCBasic/StringConversions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/// - codeUnit: The code unit to be checked.
///
/// - Returns: True if shell escaping is not needed.
private func inShellWhitelist(_ codeUnit: UInt8) -> Bool {
private func inShellAllowlist(_ codeUnit: UInt8) -> Bool {
#if os(Windows)
if codeUnit == UInt8(ascii: "\\") {
return true
Expand Down Expand Up @@ -49,8 +49,8 @@ extension String {
/// - Returns: Shell escaped string.
public func spm_shellEscaped() -> String {

// If all the characters in the string are in whitelist then no need to escape.
guard let pos = utf8.firstIndex(where: { !inShellWhitelist($0) }) else {
// If all the characters in the string are in the allow list then no need to escape.
guard let pos = utf8.firstIndex(where: { !inShellAllowlist($0) }) else {
return self
}

Expand Down
32 changes: 16 additions & 16 deletions Sources/TSCTestSupport/PseudoTerminal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,43 @@ import TSCLibc
#if os(Windows)
#else
public final class PseudoTerminal {
let master: Int32
let slave: Int32
let primary: Int32
let secondary: Int32
public var outStream: LocalFileOutputByteStream

public init?(){
var master: Int32 = 0
var slave: Int32 = 0
if openpty(&master, &slave, nil, nil, nil) != 0 {
var primary: Int32 = 0
var secondary: Int32 = 0
if openpty(&primary, &secondary, nil, nil, nil) != 0 {
return nil
}
guard let outStream = try? LocalFileOutputByteStream(filePointer: fdopen(slave, "w"), closeOnDeinit: false) else {
guard let outStream = try? LocalFileOutputByteStream(filePointer: fdopen(secondary, "w"), closeOnDeinit: false) else {
return nil
}
self.outStream = outStream
self.master = master
self.slave = slave
self.primary = primary
self.secondary = secondary
}

public func readMaster(maxChars n: Int = 1000) -> String? {
public func readPrimary(maxChars n: Int = 1000) -> String? {
var buf: [CChar] = [CChar](repeating: 0, count: n)
if read(master, &buf, n) <= 0 {
if read(primary, &buf, n) <= 0 {
return nil
}
return String(cString: buf)
}

public func closeSlave() {
_ = TSCLibc.close(slave)
public func closeSecondary() {
_ = TSCLibc.close(secondary)
}

public func closeMaster() {
_ = TSCLibc.close(master)
public func closePrimary() {
_ = TSCLibc.close(primary)
}

public func close() {
closeSlave()
closeMaster()
closeSecondary()
closePrimary()
}
}
#endif
6 changes: 3 additions & 3 deletions Sources/TSCUtility/PkgConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ import Foundation
public enum PkgConfigError: Swift.Error, CustomStringConvertible {
case couldNotFindConfigFile(name: String)
case parsingError(String)
case nonWhitelistedFlags(String)
case prohibitedFlags(String)

public var description: String {
switch self {
case .couldNotFindConfigFile(let name):
return "couldn't find pc file for \(name)"
case .parsingError(let error):
return "parsing error(s): \(error)"
case .nonWhitelistedFlags(let flags):
return "non whitelisted flag(s): \(flags)"
case .prohibitedFlags(let flags):
return "prohibited flag(s): \(flags)"
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions Tests/TSCBasicTests/TerminalControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ final class TerminalControllerTests: XCTestCase {

// Test red color.
term.write("hello", inColor: .red)
XCTAssertEqual(pty.readMaster(), "\u{1B}[31mhello\u{1B}[0m")
XCTAssertEqual(pty.readPrimary(), "\u{1B}[31mhello\u{1B}[0m")

// Test clearLine.
term.clearLine()
XCTAssertEqual(pty.readMaster(), "\u{1B}[2K\r")
XCTAssertEqual(pty.readPrimary(), "\u{1B}[2K\r")

// Test endline.
term.endLine()
XCTAssertEqual(pty.readMaster(), "\r\n")
XCTAssertEqual(pty.readPrimary(), "\r\n")

// Test move cursor.
term.moveCursor(up: 3)
XCTAssertEqual(pty.readMaster(), "\u{1B}[3A")
XCTAssertEqual(pty.readPrimary(), "\u{1B}[3A")

// Test color wrapping.
var wrapped = term.wrap("hello", inColor: .noColor)
Expand Down
6 changes: 3 additions & 3 deletions Tests/TSCUtilityTests/ProgressAnimationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,18 @@ final class ProgressAnimationTests: XCTestCase {

var output = ""
let thread = Thread {
while let out = terminal.readMaster() {
while let out = terminal.readPrimary() {
output += out
}
}

thread.start()
closure(terminal)
terminal.closeSlave()
terminal.closeSecondary()

// Make sure to read the complete output before checking it.
thread.join()
terminal.closeMaster()
terminal.closePrimary()

return output
}
Expand Down