Skip to content

Commit

Permalink
Fix typos across the codebase (#3162)
Browse files Browse the repository at this point in the history
* fix docs in .github

* fix typo in Authentication

* fix typo in Concurrency

* fix typo in Content

* fix typos logger label

* fix typo caseInsensitive

* fix typo in HTTP

* fix typo in Request

* fix typo in URLEncodedForm

* fix typo in Utilities

* fix typo in Validation

* fix some typos in Tests

* Revert "fix typo caseInsensitive"

This reverts commit 0950033.
  • Loading branch information
mrs1669 committed Apr 8, 2024
1 parent 11cdb29 commit 8409c3c
Show file tree
Hide file tree
Showing 21 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/contributing.md
Expand Up @@ -84,7 +84,7 @@ The release title should be concise description. For example:
- ✅ Add case-insensitive routing
- ✅ Fix `routes` command symbol usage

The release titles should use sentence capitialization and not be too verbose. They should also use present tense.
The release titles should use sentence capitalization and not be too verbose. They should also use present tense.

- ❌ Fix `routes` Command Symbol Usage
- ❌ Add new method on RouteBuilder called `caseInsensitive` which can be used to enable case-insensitive routing
Expand Down
2 changes: 1 addition & 1 deletion .github/maintainers.md
Expand Up @@ -6,7 +6,7 @@ maintainers will determine if you are a good fit and either accept and merge the
to be taken in order to be accepted.

## Perks
- Special "Maintainer" role in Discord with purple highlght.
- Special "Maintainer" role in Discord with purple highlight.
- Write access to maintained repo (including approve and merge permissions).
- Invite to "Maintainers" team on GitHub.
- Opportunity to actively participate in deciding on new features in package.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Vapor/Authentication/AuthenticationCache.swift
Expand Up @@ -104,7 +104,7 @@ extension Request.Authentication {
// multiple places. But given how Vapor and its users use Authentication this should almost never
// occur and it was decided the trade-off was acceptable
// As the name implies, the usage of this is unsafe because it disables the sendable checking of the
// compiler and does not add any synchronisation.
// compiler and does not add any synchronization.
@usableFromInline
internal struct UnsafeAuthenticationBox<A>: @unchecked Sendable {
@usableFromInline
Expand Down
4 changes: 2 additions & 2 deletions Sources/Vapor/Concurrency/RequestBody+Concurrency.swift
Expand Up @@ -120,7 +120,7 @@ extension Request.Body: AsyncSequence {
/// Generates an `AsyncIterator` to stream the body’s content as
/// `ByteBuffer` sequences. This implementation supports backpressure using
/// `NIOAsyncSequenceProducerBackPressureStrategies`
/// - Returns: `AsyncIterator` containing the `Requeset.Body` as a
/// - Returns: `AsyncIterator` containing the `Request.Body` as a
/// `ByteBuffer` sequence
public func makeAsyncIterator() -> AsyncIterator {
let delegate = AsyncSequenceDelegate(eventLoop: request.eventLoop)
Expand Down Expand Up @@ -159,7 +159,7 @@ extension Request.Body: AsyncSequence {
// return the future that we will fulfill eventually.
return promise.futureResult
case .produceMore:
// We can produce more immidately. Return a succeeded future.
// We can produce more immediately. Return a succeeded future.
return request.eventLoop.makeSucceededVoidFuture()
}
case .error(let error):
Expand Down
4 changes: 2 additions & 2 deletions Sources/Vapor/Content/ContentCoders.swift
Expand Up @@ -27,7 +27,7 @@ public protocol ContentEncoder {

/// Conform a type to this protocol to make it usable for decoding data via Vapor's ``ContentConfiguration`` system.
public protocol ContentDecoder {
/// Legacy "decode object" method. The provided ``NIOCore/ByteBuffer`` should be decoded as a vaule of the given
/// Legacy "decode object" method. The provided ``NIOCore/ByteBuffer`` should be decoded as a value of the given
/// type, optionally guided by the provided ``NIOHTTP1/HTTPHeaders``.
///
/// Most decoders should implement this method by simply forwarding it to the decoder userInfo-aware version below,
Expand All @@ -36,7 +36,7 @@ public protocol ContentDecoder {
func decode<D>(_ decodable: D.Type, from body: ByteBuffer, headers: HTTPHeaders) throws -> D
where D: Decodable

/// "Decode object" method. The provided ``NIOCore/ByteBuffer`` should be decoded as a vaule of the given type,
/// "Decode object" method. The provided ``NIOCore/ByteBuffer`` should be decoded as a value of the given type,
/// optionally guided by the provided ``NIOHTTP1/HTTPHeaders``. The provided ``userInfo`` dictionary must be
/// forwarded to the underlying ``Swift/Decoder`` used to perform the decoding operation.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/Vapor/Content/PlaintextEncoder.swift
Expand Up @@ -98,7 +98,7 @@ private final class _PlaintextEncoder: Encoder, SingleValueEncodingContainer {
}
}

/// This ridiculosity is a workaround for the inability of encoders to throw errors in various places. It's still better than fatalError()ing.
/// This ridiculously is a workaround for the inability of encoders to throw errors in various places. It's still better than fatalError()ing.
struct FailureEncoder<K: CodingKey>: Encoder, KeyedEncodingContainerProtocol, UnkeyedEncodingContainer, SingleValueEncodingContainer {
let codingPath = [CodingKey](), userInfo = [CodingUserInfoKey: Any](), count = 0
var error: EncodingError { .invalidValue((), .init(codingPath: [], debugDescription: "Plaintext encoding does not support nesting.")) }
Expand Down
4 changes: 2 additions & 2 deletions Sources/Vapor/Deprecations/DotEnvFile+load.swift
Expand Up @@ -19,7 +19,7 @@ extension DotEnvFile {
public static func load(
for environment: Environment = .development,
on eventLoopGroupProvider: Application.EventLoopGroupProvider = .singleton,
logger: Logger = Logger(label: "dot-env-loggger")
logger: Logger = Logger(label: "dot-env-logger")
) {
let threadPool = NIOThreadPool(numberOfThreads: 1)
threadPool.start()
Expand Down Expand Up @@ -51,7 +51,7 @@ extension DotEnvFile {
public static func load(
path: String,
on eventLoopGroupProvider: Application.EventLoopGroupProvider = .singleton,
logger: Logger = Logger(label: "dot-env-loggger")
logger: Logger = Logger(label: "dot-env-logger")
) {
let threadPool = NIOThreadPool(numberOfThreads: 1)
threadPool.start()
Expand Down
4 changes: 2 additions & 2 deletions Sources/Vapor/HTTP/Headers/HTTPCookies.swift
Expand Up @@ -193,7 +193,7 @@ public struct HTTPCookies: ExpressibleByDictionaryLiteral, Sendable {

// MARK: Methods

/// Seriaizes an `HTTPCookie` to a `String`.
/// Serializes an `HTTPCookie` to a `String`.
public func serialize(name: String) -> String {
var serialized = "\(name)=\(self.string)"

Expand Down Expand Up @@ -264,7 +264,7 @@ public struct HTTPCookies: ExpressibleByDictionaryLiteral, Sendable {

// MARK: Serialize

/// Seriaizes the `Cookies` for a `Request`
/// Serializes the `Cookies` for a `Request`
var cookieHeader: String? {
guard !self.cookies.isEmpty else {
return nil
Expand Down
2 changes: 1 addition & 1 deletion Sources/Vapor/Request/Request.swift
Expand Up @@ -57,7 +57,7 @@ public final class Request: CustomStringConvertible, Sendable {
/// A unique ID for the request.
///
/// The request identifier is set to value of the `X-Request-Id` header when present, or to a
/// uniquelly generated value otherwise.
/// uniquely generated value otherwise.
public let id: String

// MARK: Metadata
Expand Down
Expand Up @@ -53,7 +53,7 @@ extension Array where Element == CodingKey {
}
}

// MARK: Utilties
// MARK: Utilities

extension String {
/// Prepares a `String` for inclusion in form-urlencoded data.
Expand Down
4 changes: 2 additions & 2 deletions Sources/Vapor/Utilities/BaseN.swift
Expand Up @@ -12,7 +12,7 @@ public struct BaseNEncoding: Sendable {
@inlinable
internal static func sizeEnc(for bits: Int, count: Int) -> Int {
let outputs = 8 >> bits.trailingZeroBitCount, inputs = bits >> bits.trailingZeroBitCount // number of output values per input bytes
return ((count * outputs - 1) / inputs) + 1 // Integer divsion rounding away from zero
return ((count * outputs - 1) / inputs) + 1 // Integer division rounding away from zero
}

/// For a given base and count, calculate the number of bytes encoded by a given count of values. Does not
Expand Down Expand Up @@ -101,7 +101,7 @@ public struct BaseNEncoding: Sendable {
internal struct BreakLoopError: Error { @inlinable internal init() {} }

// N.B.: The values used for the invalid and padding byte representations are not arbitrarily chosen; they are
// intended to be used in optimized versions of the algorithm to quickly distinguish the vairous cases.
// intended to be used in optimized versions of the algorithm to quickly distinguish the various cases.

@usableFromInline
internal static var invalidByte: UInt8 { 0b1111_1111 } // All bits set
Expand Down
4 changes: 2 additions & 2 deletions Sources/Vapor/Utilities/DotEnv.swift
Expand Up @@ -46,7 +46,7 @@ public struct DotEnvFile: Sendable {
for environment: Environment = .development,
on eventLoopGroupProvider: Application.EventLoopGroupProvider = .singleton,
fileio: NonBlockingFileIO,
logger: Logger = Logger(label: "dot-env-loggger")
logger: Logger = Logger(label: "dot-env-logger")
) {
let eventLoopGroup: EventLoopGroup

Expand Down Expand Up @@ -93,7 +93,7 @@ public struct DotEnvFile: Sendable {
path: String,
on eventLoopGroupProvider: Application.EventLoopGroupProvider = .singleton,
fileio: NonBlockingFileIO,
logger: Logger = Logger(label: "dot-env-loggger")
logger: Logger = Logger(label: "dot-env-logger")
) {
let eventLoopGroup: EventLoopGroup

Expand Down
2 changes: 1 addition & 1 deletion Sources/Vapor/Validation/RangeResult.swift
Expand Up @@ -57,7 +57,7 @@ public enum RangeResult<T>: Equatable where T: Comparable {
// any other case is either not comparable (e.g. comparing Float.nan with anything is always false)
// or it should never happen because all static methods on `Validator` that can make
// the count and range validators all result in at least a minimum or a maximum or both.
// The thrown error needs to be handlded at a higher level then.
// The thrown error needs to be handled at a higher level then.
throw RangeResultError.notComparable
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Vapor/Validation/Validators/Range.swift
Expand Up @@ -59,7 +59,7 @@ extension Validator {
// TODO: Remove when keypaths are `Sendable`
/// ``UnsafeMutableTransferBox`` can be used to make non-`Sendable` values `Sendable` and mutable.
/// It can be used to capture local mutable values in a `@Sendable` closure and mutate them from within the closure.
/// As the name implies, the usage of this is unsafe because it disables the sendable checking of the compiler and does not add any synchronisation.
/// As the name implies, the usage of this is unsafe because it disables the sendable checking of the compiler and does not add any synchronization.
@usableFromInline
final class UnsafeMutableTransferBox<Wrapped> {
@usableFromInline
Expand Down
2 changes: 1 addition & 1 deletion Tests/VaporTests/AsyncMiddlewareTests.swift
Expand Up @@ -88,7 +88,7 @@ final class AsyncMiddlewareTests: XCTestCase {
}
}

func testCORSMiddlewareNoVariationByRequstOriginAllowed() throws {
func testCORSMiddlewareNoVariationByRequestOriginAllowed() throws {
let app = Application(.testing)
defer { app.shutdown() }

Expand Down
4 changes: 2 additions & 2 deletions Tests/VaporTests/AsyncPasswordTests.swift
Expand Up @@ -68,11 +68,11 @@ final class AsyncPasswordTests: XCTestCase {
.async(on: app.threadPool, hopTo: app.eventLoopGroup.next())
.hash("vapor")

let asyncVerifiy = try await app.password
let asyncVerify = try await app.password
.async(on: app.threadPool, hopTo: app.eventLoopGroup.next())
.verify("vapor", created: asyncHash)

XCTAssertTrue(asyncVerifiy, file: file, line: line)
XCTAssertTrue(asyncVerify, file: file, line: line)
}

private func assertAsyncRequestPasswordVerifies(
Expand Down
6 changes: 3 additions & 3 deletions Tests/VaporTests/AsyncRequestTests.swift
Expand Up @@ -35,13 +35,13 @@ final class AsyncRequestTests: XCTestCase {
let testValue = String.randomDigits()

app.on(.POST, "stream", body: .stream) { req in
var recievedBuffer = ByteBuffer()
var receivedBuffer = ByteBuffer()
for try await part in req.body {
XCTAssertNotNil(part)
var part = part
recievedBuffer.writeBuffer(&part)
receivedBuffer.writeBuffer(&part)
}
let string = String(buffer: recievedBuffer)
let string = String(buffer: receivedBuffer)
return string
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/VaporTests/MiddlewareTests.swift
Expand Up @@ -92,7 +92,7 @@ final class MiddlewareTests: XCTestCase {
}
}

func testCORSMiddlewareNoVariationByRequstOriginAllowed() throws {
func testCORSMiddlewareNoVariationByRequestOriginAllowed() throws {
let app = Application(.testing)
defer { app.shutdown() }

Expand Down
4 changes: 2 additions & 2 deletions Tests/VaporTests/PasswordTests.swift
Expand Up @@ -95,12 +95,12 @@ final class PasswordTests: XCTestCase {
.hash("vapor")
.wait()

let asyncVerifiy = try app.password
let asyncVerify = try app.password
.async(on: app.threadPool, hopTo: app.eventLoopGroup.next())
.verify("vapor", created: asyncHash)
.wait()

XCTAssertTrue(asyncVerifiy, file: file, line: line)
XCTAssertTrue(asyncVerify, file: file, line: line)
}

private func assertAsyncRequestPasswordVerifies(
Expand Down
2 changes: 1 addition & 1 deletion Tests/VaporTests/RequestTests.swift
Expand Up @@ -75,7 +75,7 @@ final class RequestTests: XCTestCase {
}
}

func testRequestPeerAddressRemoteAddres() throws {
func testRequestPeerAddressRemoteAddress() throws {
let app = Application(.testing)
defer { app.shutdown() }

Expand Down
2 changes: 1 addition & 1 deletion Tests/VaporTests/Utilities/CapturingMetricsSystem.swift
Expand Up @@ -156,7 +156,7 @@ internal final class TestTimer: TimerHandler, Equatable, @unchecked Sendable {
}
}

func retriveValueInPreferredUnit(atIndex i: Int) -> Double {
func retrieveValueInPreferredUnit(atIndex i: Int) -> Double {
return self.lock.withLock {
let value = values[i].1
guard let displayUnit = self.displayUnit else {
Expand Down

0 comments on commit 8409c3c

Please sign in to comment.