Commit Graph

3385 Commits

Author SHA1 Message Date
Danny Mösch d2327ec0c9 Prepare 0.64.0-rc.1 release 2026-01-24 21:15:31 +00:00
Danny Mösch ca72b68404 Do not just skip hidden files (#6460) 2026-01-24 22:13:56 +01:00
Danny Mösch 5d44592e27 Run ConfigPathResolutionTests with Bazel 2026-01-24 22:13:56 +01:00
Danny Mösch efaf900d50 Use URL enumerator 2026-01-24 22:13:56 +01:00
Danny Mösch 40f03cd918 Use relative display path in output for duplicated files 2026-01-24 22:13:56 +01:00
Danny Mösch 450d51c8d2 Rename property 2026-01-24 22:13:56 +01:00
Danny Mösch f96d7d9e73 Assume absolute path patterns 2026-01-24 22:13:56 +01:00
Danny Mösch 4b12699ebe Extend basic globbing on Windows 2026-01-24 22:13:56 +01:00
Danny Mösch 6c1ae86eb3 Use URL for file paths throughout the code base
# Conflicts:
#	Source/SwiftLintFramework/Extensions/FileManager+SwiftLint.swift
#	Tests/IntegrationTests/ConfigPathResolutionTests.swift
2026-01-24 22:13:56 +01:00
Saleem Abdulrasool 3c7c1e6ae1 Fix Windows path handling in various places
An assortment of fixes that improve the test coverage on Windows. With
this set, local testing reveals 1 failure (RemoteCycleDetection) and
another set of test failures due to Windows globbing not matching the
POSIX semantics.

Co-authored-by: Roman Lavrov <roman.lavrov@thebrowser.company>
2026-01-24 22:13:56 +01:00
Danny Mösch 71396cc146 Prepare 0.63.1 release 2026-01-15 19:47:12 +00:00
Danny Mösch 8978ae2ccb Add --disable-sourcekit flag to disable SourceKit (#6439) 2026-01-15 20:30:52 +01:00
Danny Mösch faa5859155 Introduce guarded filepath provider for file collection (#6435) 2026-01-14 18:06:13 -05:00
Danny Mösch 35e3d0c6f4 Mark directories as such to enforce a new hierarchy (#6434) 2026-01-13 21:25:22 +01:00
Danny Mösch 8d3ed07cc5 Prepare 0.63.0 release 2026-01-03 12:23:31 +00:00
Danny Mösch f72d03c84a Prepare 0.63.0-rc.2 release 2025-12-20 11:28:50 +00:00
Danny Mösch 2e78f40e54 Use directory enumerator to collect and exclude files at the same time (#6366) 2025-12-17 19:47:21 +01:00
Danny Mösch ac701c088c Improve performance of excluded files filter (#6342)
The current algorithm is like "collect all included files and subtract all excluded files".
Collecting all included and all excluded files relies on the file system. This can become slow
when the patterns used to exclude files resolve to a large number of files.

The new approach only collects all lintable files and checks them against the exclude patterns.
This can be done by in-memory string-regex-match and does therefore not require file system accesses.
The new implementation also no longer traverses directories that already match an exclude pattern.

(cherry picked from commit 152355e36f)
2025-12-07 15:58:23 +01:00
Danny Mösch 32c33c2588 Re-enable redundant_self rule (#6368) 2025-12-07 08:11:08 -05:00
Saleem Abdulrasool 562ec8f369 Correct incorrect handling of file paths (#6355)
`URL.path` is not a usable rendering of the path. `URL.path` represents
the URI path. If the path is meant to be consumable as a file path, the
file system representation (aka FSR) must be retrieved.

This improves the file path handling and makes additional tests now
pass.

Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2025-12-01 22:02:12 +01:00
Roman Lavrov 2e92f75a69 Replace invalid characters with underscore in caching (#6358) 2025-11-27 15:12:18 -05:00
Saleem Abdulrasool 339d250464 Port to Windows (#5030)
At least ensure it compiles just fine on Windows.

* build: add CryptoSwift dependency for Windows
* SwiftLintBuiltInRules: treat Windows similar to Linux wrt `NSDataDetector`
* SwiftLintCore: initial pass for Windows support

Add some Windows specific handling for the paths in SwiftLintCore.  The
one piece that this change does not cover is the handling of `glob` as
that is not an ISO C standard function and as such there is no `glob` on
Windows.  This will be worked through separately.

* swiftlint: add a Windows port

This enables building the swiftlint command on Windows.  There is no
system ioctl for terminal access, instead, we can use the Win32 Console
API surface to query the console size.  In the case of a failure, assume
the width to be 80-columns (as the standard VGA console is 80x25).

* WIP/SwiftLintCore: port the `glob` function to Windows

Windows does not support `glob` as a standard C library function as that
is not part of the C standard.  Attempt to emulate that through the use
of `FindFirstFileW` and `FindNextFile` to iterate the matching files
given a pattern.  This should allow us to start enumerating the files as
if we had `glob` available.
2025-11-21 09:59:28 +01:00
Copilot 038135e14d Enable prefer_key_path rule (#6331)
Co-authored-by: SimplyDanny <16365760+SimplyDanny@users.noreply.github.com>
2025-10-31 16:58:41 +00:00
Danny Mösch 069a7f9cb9 Prepare 0.62.2 release 2025-10-28 16:57:24 +00:00
Nandhini Subramani 4cca8280f6 Add test count to JUnit reporter (#6319) 2025-10-25 16:57:51 +02:00
Danny Mösch 67e98911fc Get rid of @testable import 2025-10-18 00:19:05 +02:00
Danny Mösch 23d218c0a8 Prepare 0.62.1 release 2025-10-13 20:57:16 +00:00
Danny Mösch fb030b9cf1 Prepare 0.62.0 release 2025-10-13 18:19:32 +00:00
Danny Mösch 4065fc8437 Enable upcoming feature MemberImportVisibility (#6286) 2025-10-08 08:12:05 +02:00
Danny Mösch bae9a2a351 Remove deprecated connectivity check (#6278) 2025-10-04 11:35:34 +02:00
Danny Mösch 58be16cd0e Use task-local parser diagnostic toggle (#6273) 2025-10-03 22:34:32 +02:00
Danny Mösch aa67f5ac13 Adopt typed throws where possible (#5922) 2025-09-27 19:11:46 +02:00
Martin Redington 13c0c235eb only rule should work for individual custom rules (#6057) 2025-09-18 10:21:47 +01:00
Danny Mösch 292343c31c Prepare 0.61.0 release 2025-09-06 14:09:41 +00:00
Danny Mösch 77050e8c40 Enable a fully statically linked Linux executable (#6211)
If SwiftLint is built from this state using the Swift SDK, we'll get a
large self-contained Linux executable that runs without loading SourceKit.
It can do that by disabling any rule that requires SourceKit.

With `SWIFTLINT_DISABLE_SOURCEKIT` set on a normally (dynamically linked)
binary, the behavior is the same. That's different from the previously
reported more serious warnings.
2025-08-30 10:02:38 -04:00
Danny Mösch 21942bd3cc Prepare 0.60.0 release 2025-08-30 11:27:51 +00:00
Danny Mösch 7624586c18 Maintain SourceKit-mode as long as custom rules don't support SwiftSyntax (#6212) 2025-08-30 09:42:52 +02:00
Danny Mösch c1ffdfe891 Enable prefer_condition_list rule (#6163) 2025-07-12 09:41:00 -04:00
Danny Mösch 599e51a5a2 Format code (#6151) 2025-07-02 17:50:53 -04:00
JP Simard f6c9633087 Add RegexConfiguration.ExecutionMode (#6128)
* Add `RegexConfiguration.ExecutionMode`

To help migrate custom rules to SwiftSyntax. Not wired up yet, just the
configuration parsing and defaults. Will wire it up in the next PR.

The diff looks big, but it's 500+ lines of tests, with ~45 lines of
actually new code.

* Docs

* Address PR feedback

- Add `default` case to ExecutionMode enum instead of using optional
- Change configuration key from `mode` to `execution_mode` for consistency
- Move default execution mode logic to runtime instead of configuration time
- Refactor test functions to use throws instead of do-catch
2025-06-22 10:19:14 -04:00
JP Simard 3a922d41f9 Add ConditionallySourceKitFree to migrate custom rules to SwiftSyntax (#6127)
The protocol will be used to tag rules that may or may not require
SourceKit depending on its configuration. I only expect this to be used
for custom rules as utility to help transition to a fully SwiftSyntax
based approach.
2025-06-21 15:54:56 -04:00
JP Simard 5a2cf4b1fe Remove dead code (#6125)
In particular lots of stuff that used to be needed with SourceKit that
we no longer need to keep around.

Identified using Periphery: https://github.com/peripheryapp/periphery
2025-06-21 15:19:37 -04:00
JP Simard 81474e36d0 Enforce SourceKitFreeRule contract with fatal error (#6107) 2025-06-20 07:25:01 -04:00
Danny Mösch 6d5af5f924 Enable async_without_await rule (#6104) 2025-06-19 15:01:42 -04:00
Martin Redington f72f195ece Fix error reporting (#6061) 2025-05-21 11:34:46 +01:00
Danny Mösch b35a96e5b6 Prepare 0.59.1 release 2025-04-15 15:19:16 +00:00
Danny Mösch e7d1f4fce7 Prepare 0.59.0 release 2025-04-05 11:32:37 +00:00
Danny Mösch 47335d7f95 Remove tracking of correction positions (#5950)
Report number of corrections per file instead.
2025-04-05 06:04:37 -04:00
Danny Mösch 9710148f76 Replace Sourcery with internal implementation (#6034)
Tasks we perform with Sourcery are rather simple and can be replaced
with a basic collection of files and the generation of lists in the
new `swiftlint-dev` command. This spares contributors from installing
either Sourcery or Bazel.
2025-03-26 20:38:53 +00:00
Martin Redington 5517d233fd Started to add rationales (#5681) 2025-03-06 10:16:30 +00:00