diff --git a/.github/workflows/SyntaxKit.yml b/.github/workflows/SyntaxKit.yml index 9df2099..798806b 100644 --- a/.github/workflows/SyntaxKit.yml +++ b/.github/workflows/SyntaxKit.yml @@ -308,29 +308,11 @@ jobs: if: ${{ !cancelled() && !failure() && (github.event_name == 'pull_request' || !contains(github.event.head_commit.message, 'ci skip')) }} runs-on: ubuntu-latest needs: [build-ubuntu, build-macos, build-windows, build-macos-full, build-android] - env: - MINT_PATH: .mint/lib - MINT_LINK_PATH: .mint/bin steps: - uses: actions/checkout@v6 - - name: Cache mint - id: cache-mint - uses: actions/cache@v5 - env: - cache-name: cache + - uses: jdx/mise-action@v4 with: - path: | - .mint - Mint - key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }} - restore-keys: | - ${{ runner.os }}-mint- - - name: Install mint - if: steps.cache-mint.outputs.cache-hit == '' - run: | - git clone https://github.com/yonaskolb/Mint.git - cd Mint - swift run mint install yonaskolb/mint + cache: true - name: Lint run: ./Scripts/lint.sh diff --git a/.mise.toml b/.mise.toml new file mode 100644 index 0000000..a5bd89f --- /dev/null +++ b/.mise.toml @@ -0,0 +1,6 @@ +[tools] +swiftlint = "0.63.2" +periphery = {version = "3.7.2", os = ["macos"]} +# Community asdf plugin — builds swift-format from source (no official binary releases) +# Plugin repo: https://github.com/eelcokoelewijn/asdf-swift-format +"asdf:eelcokoelewijn/asdf-swift-format" = "602.0.0" diff --git a/CLAUDE.md b/CLAUDE.md index d05d27b..a09a578 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -82,9 +82,9 @@ Sources/SyntaxKit/ - **SwiftDocC Plugin** (1.4.0+) - Documentation generation ### Quality Tools -- **SwiftFormat** (600.0.0) - Code formatting -- **SwiftLint** (0.58.2) - Static analysis (90+ opt-in rules) -- **Periphery** (3.0.1) - Unused code detection +- **SwiftFormat** (602.0.0) - Code formatting +- **SwiftLint** (0.63.2) - Static analysis (90+ opt-in rules) +- **Periphery** (3.7.2) - Unused code detection ## Project Structure diff --git a/Mintfile b/Mintfile deleted file mode 100644 index 4386537..0000000 --- a/Mintfile +++ /dev/null @@ -1,3 +0,0 @@ -swiftlang/swift-format@600.0.0 -realm/SwiftLint@0.58.2 -peripheryapp/periphery@3.0.1 diff --git a/Scripts/lint.sh b/Scripts/lint.sh index fea08ac..78fc37e 100755 --- a/Scripts/lint.sh +++ b/Scripts/lint.sh @@ -27,57 +27,43 @@ else PACKAGE_DIR="${SRCROOT}" fi -# Detect OS and set paths accordingly -if [ "$(uname)" = "Darwin" ]; then - DEFAULT_MINT_PATH="/opt/homebrew/bin/mint" -elif [ "$(uname)" = "Linux" ] && [ -n "$GITHUB_ACTIONS" ]; then - DEFAULT_MINT_PATH="$GITHUB_WORKSPACE/Mint/.mint/bin/mint" -elif [ "$(uname)" = "Linux" ]; then - DEFAULT_MINT_PATH="/usr/local/bin/mint" -else - echo "Unsupported operating system" - exit 1 -fi - -# Use environment MINT_CMD if set, otherwise use default path -MINT_CMD=${MINT_CMD:-$DEFAULT_MINT_PATH} - -export MINT_PATH="$PACKAGE_DIR/.mint" -MINT_ARGS="-n -m $PACKAGE_DIR/Mintfile --silent" -MINT_RUN="$MINT_CMD run $MINT_ARGS" - if [ "$LINT_MODE" = "NONE" ]; then exit elif [ "$LINT_MODE" = "STRICT" ]; then SWIFTFORMAT_OPTIONS="--strict --configuration .swift-format" SWIFTLINT_OPTIONS="--strict" STRINGSLINT_OPTIONS="--config .strict.stringslint.yml" -else +else SWIFTFORMAT_OPTIONS="--configuration .swift-format" SWIFTLINT_OPTIONS="" STRINGSLINT_OPTIONS="--config .stringslint.yml" fi -pushd $PACKAGE_DIR -run_command $MINT_CMD bootstrap -m Mintfile +pushd "$PACKAGE_DIR" +if [ -z "$CI" ]; then + mise install +fi +if command -v mise &> /dev/null; then + eval "$(mise env)" +fi if [ -z "$CI" ]; then - run_command $MINT_RUN swift-format format $SWIFTFORMAT_OPTIONS --recursive --parallel --in-place Sources Tests - run_command $MINT_RUN swiftlint --fix + run_command swift-format format $SWIFTFORMAT_OPTIONS --recursive --parallel --in-place Sources Tests + run_command swiftlint --fix fi if [ -z "$FORMAT_ONLY" ]; then - run_command $MINT_RUN swift-format lint --configuration .swift-format --recursive --parallel $SWIFTFORMAT_OPTIONS Sources Tests - run_command $MINT_RUN swiftlint lint $SWIFTLINT_OPTIONS + run_command swift-format lint --configuration .swift-format --recursive --parallel $SWIFTFORMAT_OPTIONS Sources Tests + run_command swiftlint lint $SWIFTLINT_OPTIONS fi -$PACKAGE_DIR/Scripts/header.sh -d $PACKAGE_DIR/Sources -c "Leo Dion" -o "BrightDigit" -p "SyntaxKit" +$PACKAGE_DIR/Scripts/header.sh -d $PACKAGE_DIR/Sources -c "Leo Dion" -o "BrightDigit" -p "SyntaxKit" -y 2025 -run_command $MINT_RUN swiftlint lint $SWIFTLINT_OPTIONS -run_command $MINT_RUN swift-format lint --recursive --parallel $SWIFTFORMAT_OPTIONS Sources Tests +run_command swiftlint lint $SWIFTLINT_OPTIONS +run_command swift-format lint --recursive --parallel $SWIFTFORMAT_OPTIONS Sources Tests if [ -z "$CI" ]; then - run_command $MINT_RUN periphery scan $PERIPHERY_OPTIONS --disable-update-check + run_command periphery scan $PERIPHERY_OPTIONS --disable-update-check fi diff --git a/Sources/DocumentationHarness/CodeBlockExtractor.swift b/Sources/DocumentationHarness/CodeBlockExtractor.swift index 8af306a..08646b8 100644 --- a/Sources/DocumentationHarness/CodeBlockExtractor.swift +++ b/Sources/DocumentationHarness/CodeBlockExtractor.swift @@ -31,5 +31,6 @@ /// - Parameter content: The markdown content to parse /// - Returns: Array of extracted code blocks /// - Throws: CodeBlockExtractorError if extraction fails -package typealias CodeBlockExtractor = @Sendable (String) throws(CodeBlockExtractorError) -> +package typealias CodeBlockExtractor = + @Sendable (String) throws(CodeBlockExtractorError) -> [CodeBlock] diff --git a/Tests/SyntaxDocTests/Settings.swift b/Tests/SyntaxDocTests/Settings.swift index f85ebaf..8255864 100644 --- a/Tests/SyntaxDocTests/Settings.swift +++ b/Tests/SyntaxDocTests/Settings.swift @@ -85,9 +85,9 @@ internal enum Settings { } } else { #if os(Android) // os(Android) is a valid Swift platform condition since Swift 5.9 - let resolvedPath = filePath + let resolvedPath = filePath #else - let resolvedPath = "Sources/SyntaxKit/" + filePath + let resolvedPath = "Sources/SyntaxKit/" + filePath #endif return Self.projectRoot.appendingPathComponent(resolvedPath) }