Skip to content
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
20 changes: 10 additions & 10 deletions .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ jobs:
name: Ubuntu 24.04

steps:
- name: Install Swift
- name: 🤍 Install Swift 🤍
uses: tayloraswift/swift-install-action@master
with:
swift-prefix: "swift-6.2.4-release/ubuntu2404/swift-6.2.4-RELEASE"
swift-id: "swift-6.2.4-RELEASE-ubuntu24.04"

- name: Install Unidoc
- name: 🤍 Install Unidoc 🤍
uses: tayloraswift/swift-unidoc-action@master

# This clobbers everything in the current directory!
- name: Checkout repository
uses: actions/checkout@v3
- name: 🤍 Checkout repository 🤍
uses: actions/checkout@v6

- name: Validate documentation
- name: 🤍 Validate documentation 🤍
run: |
unidoc compile \
--swift-toolchain $SWIFT_INSTALLATION \
Expand All @@ -39,16 +39,16 @@ jobs:
runs-on: macos-26
name: macOS
steps:
- name: Install Unidoc
- name: 🤍 Install Unidoc 🤍
uses: tayloraswift/swift-unidoc-action@master

- name: Checkout repository
uses: actions/checkout@v3
- name: 🤍 Checkout repository 🤍
uses: actions/checkout@v6

- name: Select Xcode 26.3
- name: 🤍 Select Xcode 26.3 🤍
run: sudo xcode-select -s /Applications/Xcode_26.3.app/Contents/Developer

- name: Validate documentation
- name: 🤍 Validate documentation 🤍
run: |
unidoc build \
--ci fail-on-errors \
Expand Down
41 changes: 33 additions & 8 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,56 @@ on:
branches: [ master ]

jobs:
changes:
runs-on: ubuntu-latest
name: Assess changes
steps:
- name: 💖 Checkout repository 💖
uses: actions/checkout@v6

- name: 💖 Decide checks 💖
uses: tj-actions/changed-files@v47
id: changes
with:
files_ignore: |
README.md
LICENSE
NOTICE
.mailmap
.gitignore
.github/FUNDING.yml
outputs:
code_changed: ${{ steps.changes.outputs.any_changed }}

linux:
runs-on: ubuntu-24.04
name: Ubuntu 24.04
needs: changes
if: ${{ needs.changes.outputs.code_changed == 'true' }}
steps:
- name: Install Swift
- name: 💖 Install Swift 💖
uses: tayloraswift/swift-install-action@master
with:
swift-prefix: "swift-6.2.4-release/ubuntu2404/swift-6.2.4-RELEASE"
swift-id: "swift-6.2.4-RELEASE-ubuntu24.04"

- name: Checkout repository
uses: actions/checkout@v3
- name: 💖 Checkout repository 💖
uses: actions/checkout@v6

- name: Run tests
- name: 💖 Run tests 💖
run: Scripts/TestAll

macos:
runs-on: macos-26
name: macOS
needs: changes
if: ${{ needs.changes.outputs.code_changed == 'true' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: 💖 Checkout repository 💖
uses: actions/checkout@v6

- name: Select Xcode 26.3
- name: 💖 Select Xcode 26.3 💖
run: sudo xcode-select -s /Applications/Xcode_26.3.app/Contents/Developer

- name: Run tests
- name: 💖 Run tests 💖
run: Scripts/TestAll
17 changes: 15 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// swift-tools-version:6.2
import class Foundation.ProcessInfo
import PackageDescription

let package: Package = .init(
Expand Down Expand Up @@ -85,6 +86,14 @@ let package: Package = .init(
),
]
)

var WarningsAsErrors: Bool {
switch ProcessInfo.processInfo.environment["WARNINGS_AS_ERRORS"] {
case "true"?: true
case "1"?: true
default: false
}
Comment on lines +91 to +95

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logic for checking the WARNINGS_AS_ERRORS environment variable can be simplified for better readability and conciseness. Using a direct boolean comparison is more idiomatic and easier to understand than a switch statement on an optional value.

    let value = ProcessInfo.processInfo.environment["WARNINGS_AS_ERRORS"]
    return value == "true" || value == "1"

}
package.targets = package.targets.map {
switch $0.type {
case .plugin: return $0
Expand All @@ -95,8 +104,12 @@ package.targets = package.targets.map {
var settings: [SwiftSetting] = $0 ?? []

settings.append(.enableUpcomingFeature("ExistentialAny"))
settings.append(.treatWarning("ExistentialAny", as: .error))
settings.append(.treatWarning("MutableGlobalVariable", as: .error))
settings.append(.enableUpcomingFeature("InternalImportsByDefault"))

if WarningsAsErrors {
settings.append(.treatWarning("ExistentialAny", as: .error))
settings.append(.treatWarning("MutableGlobalVariable", as: .error))
}

$0 = settings
} (&$0.swiftSettings)
Expand Down
8 changes: 6 additions & 2 deletions Scripts/TestAll
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash
set -e
set -euo pipefail

export WARNINGS_AS_ERRORS=1

swift --version
swift test
swift build -c release
swift build -c release \
--explicit-target-dependency-import-check=error
2 changes: 1 addition & 1 deletion Sources/JSONDecoding/Decoding/JSON.DecodingError.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TraceableErrors
public import TraceableErrors

extension JSON {
/// An error occurred while decoding a document field.
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONParsing/JSON.Array (ext).swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar
import JSONAST

extension JSON.Array {
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONParsing/JSON.Node (ext).swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar
import JSONAST

extension JSON.Node {
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONParsing/JSON.Object (ext).swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar
import JSONAST

extension JSON.Object {
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONParsing/Rules/JSON (ext).swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar

extension JSON {
typealias CommaRule<Location> =
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONParsing/Rules/JSON.NodeRule.Array.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar

extension JSON.NodeRule {
/// Matches an array literal.
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONParsing/Rules/JSON.NodeRule.False.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar

extension JSON.NodeRule {
/// A literal `false` expression.
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONParsing/Rules/JSON.NodeRule.Inf.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar

extension JSON.NodeRule {
enum Inf: LiteralRule {
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONParsing/Rules/JSON.NodeRule.NaN.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar

extension JSON.NodeRule {
/// A literal `nan` expression, all lowercase.
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONParsing/Rules/JSON.NodeRule.Nonfinite.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar

extension JSON.NodeRule {
enum Nonfinite: ParsingRule {
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONParsing/Rules/JSON.NodeRule.Null.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar

extension JSON.NodeRule {
/// A literal `null` expression.
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONParsing/Rules/JSON.NodeRule.Object.Item.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar

extension JSON.NodeRule.Object {
/// Matches an key-value expression.
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONParsing/Rules/JSON.NodeRule.Object.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar

extension JSON.NodeRule {
/// Matches an object literal.
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONParsing/Rules/JSON.NodeRule.True.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar

extension JSON.NodeRule {
/// A literal `true` expression.
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONParsing/Rules/JSON.NodeRule.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar

extension JSON {
/// Matches any value, including fragment values.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar

extension JSON.NumberRule {
/// Matches an ASCII `+` or `-` sign.
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONParsing/Rules/JSON.NumberRule.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar

extension JSON {
/// Matches a numeric literal.
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONParsing/Rules/JSON.RootRule.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar

extension JSON {
/// All of the parsing rules in this library are defined at the UTF-8 level.
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONParsing/Rules/JSON.StringRule.CodeUnit.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar

extension JSON.StringRule {
/// Matches a UTF-8 code unit that is allowed to appear inline in a string literal.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar

extension JSON.StringRule {
/// Matches a sequence of escaped UTF-16 code units.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar

extension JSON.StringRule {
/// Matches an ASCII character (besides `u`) that is allowed to
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONParsing/Rules/JSON.StringRule.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar

extension JSON {
/// Matches a string literal.
Expand Down
2 changes: 1 addition & 1 deletion Sources/JSONParsing/Rules/JSON.WhitespaceRule.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Grammar
internal import Grammar

extension JSON {
/// Matches the whitespace characters U+0020, `\t`, `\n`, and `\r`.
Expand Down
2 changes: 1 addition & 1 deletion Sources/JavaScriptPersistence/JSObject.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import JSON
public import JSON

public final class JSObject {
@usableFromInline var object: [String: JSValue]
Expand Down
2 changes: 1 addition & 1 deletion Sources/JavaScriptPersistence/JSValue.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import JSON
public import JSON

@frozen public struct JSValue {
@usableFromInline let storage: Storage
Expand Down
Loading