Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 16 additions & 4 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# RepoPrompt CE SwiftLint policy.
# Scripts/swift_style.sh owns the canonical first-party Swift file list used by
# local and CI checks. The include/exclude lists here mirror that scope for
# direct SwiftLint invocations and editor integrations.
# Full-repo lint uses this config for file discovery. Keep these include/exclude
# lists aligned with Scripts/swift_style.sh's SwiftFormat first-party scope.

included:
- Package.swift
Expand All @@ -16,13 +15,26 @@ included:
excluded:
- .build
- .swiftpm
- DerivedData
- build
- Carthage
- DerivedData
- Generated
- Pods
- Vendor
- Packages/RepoPromptAgentProviders/.build
- Sources/CSwiftPCRE2
- Sources/RepoPromptC
- Sources/RepoPrompt/ThirdParty/SwiftPCRE2
- Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPromptSharedFragments.swift
- Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPrompt+Build.swift
- Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPrompt+DeepPlan.swift
- Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPrompt+Investigate.swift
- Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPrompt+Optimize.swift
- Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPrompt+OracleExport.swift
- Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPrompt+Orchestrate.swift
- Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPrompt+Refactor.swift
- Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPrompt+Reminder.swift
- Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPrompt+Review.swift

# Keep the initial integration intentionally humane. Broader cleanup-oriented
# rules are deferred until the one-time baseline and future focused cleanup work.
Expand Down
15 changes: 3 additions & 12 deletions Scripts/swift_style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,10 @@ run_swiftformat(){

run_swiftlint(){
ensure_tool swiftlint
ensure_swift_files_collected

if (( ${#SWIFT_FILES[@]} == 0 )); then
fail "No Swift files found in configured style scope."
fi

local index
export SCRIPT_INPUT_FILE_COUNT="${#SWIFT_FILES[@]}"
for index in "${!SWIFT_FILES[@]}"; do
export "SCRIPT_INPUT_FILE_$index=${SWIFT_FILES[$index]}"
done

local args=(lint --strict --config "$ROOT_DIR/.swiftlint.yml" --use-script-input-files)
# Full-repo lint lets SwiftLint discover files from .swiftlint.yml instead of
# paying the large environment/script-input overhead for every Swift file.
local args=(lint --strict --config "$ROOT_DIR/.swiftlint.yml" --quiet --force-exclude)
if [[ "${GITHUB_ACTIONS:-}" == "true" ]]; then
args+=(--reporter github-actions-logging)
fi
Expand Down
45 changes: 45 additions & 0 deletions Scripts/test_release_tooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,51 @@ def test_ci_secret_scan_covers_introduced_commit_range_and_checked_out_tree(self
self.assertIn('gitleaks git --redact --log-opts="$range" .', workflow)
self.assertIn("gitleaks dir --redact .", workflow)

def test_swift_style_lint_uses_config_discovery_without_script_input_overhead(self) -> None:
root = SCRIPT_DIR.parent
style_script = (SCRIPT_DIR / "swift_style.sh").read_text(encoding="utf-8")
swiftlint_config = (root / ".swiftlint.yml").read_text(encoding="utf-8")
lint_body = style_script.split("run_swiftlint(){", 1)[1].split("\n}\n\ncase", 1)[0]
Comment thread
baron marked this conversation as resolved.
Outdated

self.assertIn('local args=(lint --strict --config "$ROOT_DIR/.swiftlint.yml" --quiet --force-exclude)', lint_body)
self.assertNotIn("SCRIPT_INPUT_FILE", lint_body)
self.assertNotIn("--use-script-input-files", lint_body)

style_paths_body = style_script.split("STYLE_PATHS=(", 1)[1].split("\n)", 1)[0]
style_paths = [
line.strip().strip('"')
for line in style_paths_body.splitlines()
if line.strip().startswith('"')
]
for style_path in style_paths:
self.assertIn(f" - {style_path}", swiftlint_config)

for excluded_path in (
".build",
".swiftpm",
"build",
"Carthage",
"DerivedData",
"Generated",
"Pods",
"Vendor",
"Packages/RepoPromptAgentProviders/.build",
"Sources/CSwiftPCRE2",
"Sources/RepoPromptC",
"Sources/RepoPrompt/ThirdParty/SwiftPCRE2",
"Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPromptSharedFragments.swift",
"Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPrompt+Build.swift",
"Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPrompt+DeepPlan.swift",
"Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPrompt+Investigate.swift",
"Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPrompt+Optimize.swift",
"Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPrompt+OracleExport.swift",
"Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPrompt+Orchestrate.swift",
"Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPrompt+Refactor.swift",
"Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPrompt+Reminder.swift",
"Sources/RepoPrompt/Infrastructure/AI/Prompts/Workflows/WorkflowPrompt+Review.swift",
):
self.assertIn(f" - {excluded_path}", swiftlint_config)

def test_publish_staged_validates_before_creating_dist(self) -> None:
release_script = (SCRIPT_DIR / "release.sh").read_text(encoding="utf-8")
publish_staged = release_script.split("publish_staged_release() {", 1)[1].split("\n}", 1)[0]
Expand Down
Loading