Skip to content

Fix the strict lint failures, and build the examples in CI - #3

Merged
fredsimard merged 2 commits into
mainfrom
fix/lint-strict-and-example-ci
Aug 16, 2026
Merged

fredsimard merged 2 commits into
mainfrom
fix/lint-strict-and-example-ci

Conversation

@fredsimard

Copy link
Copy Markdown
Owner

What this changes

The first run with --strict failed with eight violations. This fixes them, adds a CI job that compiles Examples/, and adds the 1.0.1 changelog entry.

The violations

Genuinely redundant, fixed in code. Four ?? nil coalescings in executeAppleScript(_:with:), e.g. result.stringValue ?? nil. The expression is already optional and the return type is Any?, so they did nothing. Same results, same types.

Deliberate style, rules disabled with a note. statement_position flagged the else if chains in the character scanner — the same category as colon and switch_case_alignment, already disabled. cyclomatic_complexity put parseSimpleAppleScriptRecord at 16 against a threshold of 15; raised to 20, since splitting a scanner across functions would make it harder to follow.

Silenced at the line. The single force_unwrapping, CFURLPathStyle(rawValue: 1)!, where the raw value is a constant that cannot fail. The rule stays on for everything else.

Examples in CI

Examples/AppleScripts.swift isn't part of any target, so nothing was compiling it and it could rot unnoticed. The new Build examples job assembles a throwaway package that depends on this one by path — the way a real consumer does — and builds it in Swift 5 language mode. Verified by running the same steps locally.

For the reviewer

No public API change, and no behaviour change. 1.0.1 is docs, examples, lint config and CI.

The Swift 5 language mode in the examples job is not incidental: AppleScriptObject is not Sendable, so the static let script constants do not compile under Swift 6 mode. That is documented in the README and tracked in #2.

fredsimard and others added 2 commits August 16, 2026 13:12
--strict was turned on against a baseline I had only partly checked, so eight
violations failed the first run. Four were genuine: `?? nil` on an expression
already returning an optional into an Any? return type, redundant in all four
cases and removed. The rest are style the codebase chose deliberately —
else-if chains on their own lines, and the character scanner's branch count —
so statement_position is disabled and the complexity threshold raised, both
with a note saying why. The one force unwrap is a fixed CFURLPathStyle raw
value that cannot fail, silenced at the line rather than by dropping the rule.

The examples now build in CI as a separate package depending on this one by
path, the way a consumer would, since nothing else compiles that file.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@fredsimard fredsimard self-assigned this Aug 16, 2026
@fredsimard
fredsimard merged commit a8f4ddd into main Aug 16, 2026
3 checks passed
@fredsimard
fredsimard deleted the fix/lint-strict-and-example-ci branch August 16, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant