Skip to content

Commit

Permalink
Enable more CI warnings (#347)
Browse files Browse the repository at this point in the history
Enable more CI warnings

### Motivation

Fixes #332 and re-enables warnings as errors as we don't have deprecation warnings in our tests anymore.

### Modifications

Enabled a few previously disabled warnings/errors.

### Result

Stricter CI.

### Test Plan

The CI on this PR.


Reviewed by: PeterAdams-A

Builds:
     ✔︎ pull request validation (5.10) - Build finished. 
     ✔︎ pull request validation (5.8) - Build finished. 
     ✔︎ pull request validation (5.9) - Build finished. 
     ✔︎ pull request validation (compatibility test) - Build finished. 
     ✔︎ pull request validation (docc test) - Build finished. 
     ✔︎ pull request validation (integration test) - Build finished. 
     ✔︎ pull request validation (nightly) - Build finished. 
     ✔︎ pull request validation (soundness) - Build finished. 

#347
  • Loading branch information
czechboy0 authored Oct 26, 2023
1 parent 69eb1a2 commit 4355b3a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 41 deletions.
8 changes: 7 additions & 1 deletion Sources/_OpenAPIGeneratorCore/Extensions/Foundation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
//===----------------------------------------------------------------------===//
import Foundation

#if compiler(>=5.11)
extension FileHandle: @retroactive TextOutputStream {}
#else
extension FileHandle: TextOutputStream {}
#endif

extension InMemoryInputFile {
/// Creates a new in-memory file by reading the contents at the specified path.
/// - Parameter url: The path to the file to read.
Expand All @@ -23,7 +29,7 @@ extension InMemoryInputFile {
/// File handle to stderr.
let stdErrHandle = FileHandle.standardError

extension FileHandle: TextOutputStream {
extension FileHandle {
/// Writes the given string to the file handle.
///
/// This method writes the provided string to the file handle using its UTF-8
Expand Down
15 changes: 11 additions & 4 deletions Sources/swift-openapi-generator/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@ import ArgumentParser
import _OpenAPIGeneratorCore
import Yams

extension URL: ExpressibleByArgument {
#if compiler(>=5.11)
extension URL: @retroactive ExpressibleByArgument {}
extension GeneratorMode: @retroactive ExpressibleByArgument {}
extension FeatureFlag: @retroactive ExpressibleByArgument {}
#else
extension URL: ExpressibleByArgument {}
extension GeneratorMode: ExpressibleByArgument {}
extension FeatureFlag: ExpressibleByArgument {}
#endif

extension URL {

/// Creates a `URL` instance from a string argument.
///
Expand All @@ -25,9 +35,6 @@ extension URL: ExpressibleByArgument {
public init?(argument: String) { self.init(fileURLWithPath: argument) }
}

extension GeneratorMode: ExpressibleByArgument {}
extension FeatureFlag: ExpressibleByArgument {}

extension CaseIterable where Self: RawRepresentable, Self.RawValue == String {

/// A string representation of the raw values of all the cases,
Expand Down
5 changes: 1 addition & 4 deletions docker/docker-compose.2204.510.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ services:
image: *image
environment:
- WARN_AS_ERROR_ARG=-Xswiftc -warnings-as-errors
# SwiftSyntax currently imports a module it does not explicitly depend
# on and so we must disable this for the time being.
# - IMPORT_CHECK_ARG=--explicit-target-dependency-import-check error
- IMPORT_CHECK_ARG=--explicit-target-dependency-import-check error
- STRICT_CONCURRENCY_ARG=-Xswiftc -strict-concurrency=complete

shell:
image: *image
16 changes: 2 additions & 14 deletions docker/docker-compose.2204.58.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,8 @@ services:
test:
image: *image
environment:
# Because OpenAPI supports deprecation, the generated code could include
# deprecated symbols, which will produce warnings.
#
# We'll disable -warnings-as-errors for now and revisit this when we
# refactor the compilation of the generated code into a separate
# pipeline.
#
# - WARN_AS_ERROR_ARG=-Xswiftc -warnings-as-errors

# SwiftSyntax currently imports a module it does not explicitly depend
# on and so we must disable this for the time being.
# - IMPORT_CHECK_ARG=--explicit-target-dependency-import-check error

- WARN_AS_ERROR_ARG=-Xswiftc -warnings-as-errors
- IMPORT_CHECK_ARG=--explicit-target-dependency-import-check error
- STRICT_CONCURRENCY_ARG=-Xswiftc -strict-concurrency=complete

shell:
image: *image
5 changes: 1 addition & 4 deletions docker/docker-compose.2204.59.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ services:
image: *image
environment:
- WARN_AS_ERROR_ARG=-Xswiftc -warnings-as-errors
# SwiftSyntax currently imports a module it does not explicitly depend
# on and so we must disable this for the time being.
# - IMPORT_CHECK_ARG=--explicit-target-dependency-import-check error
- IMPORT_CHECK_ARG=--explicit-target-dependency-import-check error
- STRICT_CONCURRENCY_ARG=-Xswiftc -strict-concurrency=complete

shell:
image: *image
16 changes: 2 additions & 14 deletions docker/docker-compose.2204.main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,8 @@ services:
test:
image: *image
environment:
# Because OpenAPI supports deprecation, the generated code could include
# deprecated symbols, which will produce warnings.
#
# We'll disable -warnings-as-errors for now and revisit this when we
# refactor the compilation of the generated code into a separate
# pipeline.
#
# - WARN_AS_ERROR_ARG=-Xswiftc -warnings-as-errors

# SwiftSyntax currently imports a module it does not explicitly depend
# on and so we must disable this for the time being.
# - IMPORT_CHECK_ARG=--explicit-target-dependency-import-check error

- WARN_AS_ERROR_ARG=-Xswiftc -warnings-as-errors
- IMPORT_CHECK_ARG=--explicit-target-dependency-import-check error
- STRICT_CONCURRENCY_ARG=-Xswiftc -strict-concurrency=complete

shell:
image: *image

0 comments on commit 4355b3a

Please sign in to comment.