23 Commits

Author SHA1 Message Date
Danny Mösch 63e03721bb Respect existing environment variables in build tool plugins (#6566) 2026-03-27 20:51:10 +00:00
Danny Mösch 9e5a526483 Enable unneeded_throws_rethrows rule (#6335) 2025-11-03 20:24:57 +01:00
Danny Mösch 17c77cd1f8 Print workspace directory only in debug builds (#6137) 2025-06-25 19:39:45 +00:00
Danny Mösch 6d5af5f924 Enable async_without_await rule (#6104) 2025-06-19 15:01:42 -04:00
Danny Mösch e42ee1090a Pass only Swift files in Xcode target to linter (#5890) 2024-12-07 16:32:49 +00:00
Danila Shikulin 75c13228f0 Support linting only provided file paths with command plugins (#5879)
This enables anyone to run SwiftLint on file paths provided via arguments without
installing it via Mint or Homebrew. This can be useful for custom Git hooks that run
only for modified files.
2024-12-07 14:50:28 +00:00
Danny Mösch 9d9156fcc6 Add Xcode command plugin (#5867) 2024-11-26 19:58:30 +01:00
Danny Mösch c784adcb03 Pass only remaining arguments to swiftlint command (#5865)
Missing part of 7904d9a.
2024-11-19 22:58:57 +01:00
Danny Mösch 3344fc6d31 Add cache path and directories only when commands accept them (#5851) 2024-11-10 14:32:16 +00:00
Danny Mösch 8241909add Run command plugin in whole package if no targets defined (#5789) 2024-09-11 21:16:39 +00:00
Enric Enrich 27cab449ac Use Diagnostics.error when command failed (#5782) 2024-09-07 12:49:42 +00:00
Danny Mösch 7904d9a438 Support --target paths being passed to command plugin (#5696) 2024-07-24 22:57:24 +02:00
Danny Mösch c810459e6a Enforce mandatory trailing comma and fix all violations (#5640) 2024-06-28 05:36:50 +00:00
Garric G. Nahapetian e4e3545b71 Introduce SwiftLintCommandPlugin (#5497) 2024-03-19 22:07:22 +01:00
Garric G. Nahapetian 76af7cc7ab Use BUILD_WORKSPACE_DIRECTORY in SwiftLintPlugin (#4758) 2024-03-02 18:45:33 +00:00
Slava Karpenko 91c0240fd5 Explicitely disable cache for SwiftLintPlugin runs on Xcode Cloud (#5287)
In Xcode Cloud environment, SwiftLint’s cache cannot be written. When using the SwiftLintPlugin, there is no way to disable the cache. Previously, a solution was made for the SwiftLint CLI itself where it looks at a set of environment variables (#4485). This solution offers a cleaner approach where the plugin itself decides whether it needs to enable or disable the cache based on the `CI_XCODE_CLOUD` environment variable.

In the long run, SwiftLint should get rid of `isLikelyXcodeCloudEnvironment` entirely. The caller should always decide if caching is possible or not, while SwiftLint itself should be platform-agnostic.
2023-11-05 14:04:22 +01:00
Tony Arnold cfd9a26e33 Ensure that configuration exclusion rules are respected by the build plugin (#4757)
We always pass all of the Swift source files in the target to the tool, so we need to ensure that any exclusion rules in the configuration are respected.
2023-03-02 22:26:49 +01:00
Roman Stetsenko 843198d241 Use prebuildCommand for SwiftLint plugin (#4680) 2023-02-02 19:25:25 +01:00
Danny Mösch f8f2317bdb Extract common plugin execution code to method (#4690) 2023-01-14 12:35:53 +01:00
Tony Arnold ab143685a4 Use a binary target for the build tool plugin (#4603)
* Use a binary target for the build tool plugin

* Merge `push_version` and `release` make commands

Instead of running `make push_version "0.2.0: Tumble Dry"` and then
`make release`, now run `make release "0.2.0: Tumble Dry"`, which will
build the release artifacts and update/push the new version to GitHub.

This allows the artifacts to use the new version, update the artifact
bundle checksum in the package manifest, then tag the release.

The Releasing.md instructions were updated to reflect this new workflow.

* Add `SwiftLintSourcePlugin` source plugin for SwiftPM

* Add changelog entry

* Remove SwiftLintSourcePlugin for now

* Build from Source on Linux

* Use a lower-level method of checking if a file is accessible

This shouldn’t trigger sandbox violations, I hope…

* Prevent an infinite recursion of the filesystem root

* Remove unnecessary logging

* Quieten the output so that Xcode only prints violations

* Break up comment to avoid line length warning

* Fix capitalization of Glibc import

Co-authored-by: JP Simard <jp@jpsim.com>
2022-11-29 18:10:47 -05:00
JP Simard 5a7d3ade02 Lint Plugins directory (#4591) 2022-11-25 15:51:09 +00:00
Tony Arnold f088bbde15 Only lint Swift source files within the provided target (#4406)
* Only lint Swift source files within the provided target

* Restore plugin display name to “SwiftLint”

* Xcode targets don’t always conform to the SourceModuleTarget

Use a “baser” way to get at the Swift sources of the current target

* Use the cache path as the outputFiles

This prevents the warning we’re seeing in Xcode on every build, but shouldn’t interfere with the re-run logic

* Look for configuration files manually in the project directory and parents

* Check if the file is readable, not just that it exists

* Move the Path helper into a separate file

* Fix a wayward apostrophe

Signed-off-by: Tony Arnold <tony@thecocoabots.com>

* Add an entry to the CHANGELOG

Signed-off-by: Tony Arnold <tony@thecocoabots.com>

Signed-off-by: Tony Arnold <tony@thecocoabots.com>
2022-11-24 18:38:41 -05:00
Johannes Ebeling 3fd1573c57 Make SwiftLint available as a build tool plugin (#4176)
*  (spm) add build tool plugin definition for swiftlint
* 📝 (changelog) add changelog item for the plugin
* 🐛 (cache) define cache path explicitly to avoid issues during build without issues
* 🎨 minor code cleanup
* 📝 document usage with Xcode as well as Swift packages
2022-10-05 15:28:19 -04:00