Skip to content

feat: add swiftlint#854

Open
kaanbiryol wants to merge 1 commit into
aspect-build:mainfrom
kaanbiryol:feat/swiftlint
Open

feat: add swiftlint#854
kaanbiryol wants to merge 1 commit into
aspect-build:mainfrom
kaanbiryol:feat/swiftlint

Conversation

@kaanbiryol

Copy link
Copy Markdown

Adds SwiftLint support to rules_lint for Swift sources.

Closes #55

This adds lint_swiftlint_aspect, wires SwiftLint binary fetching through the lint tools extension, and updates the Swift example/docs. The aspect supports explicit config inputs, default empty config behavior, baseline files, nested config selection, fix patches, and SARIF machine-readable reports.

Changes are visible to end-users: yes

  • Searched for relevant documentation and updated as needed: yes
  • Breaking change (forces users to change their own code or config): no
  • Suggested release notes appear below: yes

Add SwiftLint as a supported Swift linter.

Test plan

  • New test cases added
  • Manual testing:
cd examples/swift

bazel test //test:all

# Expected to fail and report the intentional SwiftLint violation.
aspect lint -- //src:all

# Expected to apply the generated SwiftLint fix to the workspace.
aspect lint --fix -- //src:all

# Expected to pass and generate a patch without changing the workspace.
bazel build --config=lint --output_groups=rules_lint_patch --@aspect_rules_lint//lint:fix //src:all

@CLAassistant

CLAassistant commented May 4, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@aspect-workflows

aspect-workflows Bot commented May 4, 2026

Copy link
Copy Markdown

Bazel 7 (Test)

6 test targets passed

Targets
//format/test:custom_args_test [k8-fastbuild] 379ms
//format/test:ls-files_test [k8-fastbuild]    765ms
//lint/rust:test_human [k8-fastbuild]         107ms
//lint/rust:test_patch [k8-fastbuild]         164ms
//lint/rust:test_sarif [k8-fastbuild]         218ms
//tools/sarif:sarif_test [k8-fastbuild]       96ms

Bazel 8 (Test)

All tests were cache hits

6 tests (100.0%) were fully cached saving 1s.


Bazel 9 (Test)

All tests were cache hits

6 tests (100.0%) were fully cached saving 1s.

Comment thread lint/lint.axl
ctx.std.io.stderr.write(generated)
if file.name.endswith(".report"):
report = ctx.std.fs.read_to_string(filepath)
if '"results": [' in report:

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Updated to normalize whitespace and look for an actual result object ("results":[{) instead of the exact substring "results": [.

SwiftLint formats SARIF as "results" : [ and can emit empty reports as:

"results" : [

],

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.

[FR]: add SwiftLint

2 participants