Commit Graph

29 Commits

Author SHA1 Message Date
JP Simard b4f45aa55e
Move TSan Runs CI job to Buildkite (#4457)
Now that we have more Buildkite machines, these should be faster than
running on Azure Pipelines.

Also remove the `//bazel:xcode_config` configurations since they should
no longer be in use.
2022-10-23 13:05:28 -04:00
JP Simard 1ee5154687
Update SwiftSyntax to `fa7ff05` (#4455)
There's a new SwiftParserDiagnostics module and the rewriter visit
function signatures changed.
2022-10-23 11:56:22 -04:00
JP Simard 401d0f7929
Update SwiftSyntax to `60c7037` (#4454)
This has changes to how comments are associated to nodes.

See https://github.com/apple/swift-syntax/pull/985
2022-10-23 11:15:27 -04:00
JP Simard e84430f222
Update SwiftSyntax (#4431) 2022-10-20 13:16:00 -04:00
JP Simard 25c9d34f5a
Update SwiftSyntax (#4429) 2022-10-20 09:21:14 -04:00
JP Simard 8ec6e0eefc
Update SwiftSyntax (#4398)
https://github.com/apple/swift-syntax/pull/938 was impacting some
corrections in Lyft's codebase.
2022-10-17 09:42:02 -04:00
JP Simard 33f6ee1f36
Update SwiftSyntax (#4363)
Noteworthy:

* https://github.com/apple/swift-syntax/pull/912
* https://github.com/apple/swift-syntax/pull/932
2022-10-13 10:28:00 -04:00
JP Simard 602070164b
Reduce memory usage (#4349)
When linting SwiftLint, this brings memory usage down by around 20%,
going from 372MB to 297MB.

This is achieved by removing the unused `RebuildQueue` and by clearing
cached data associated with files after processing them.

Depends on https://github.com/jpsim/SourceKitten/pull/749.
2022-10-12 09:39:36 -04:00
JP Simard 87e9757af2
Update SwiftSyntax (#4346)
I think there might have been changes impacting the `static_operator`
rule, so I want to look more into those here.

Remove workaround for https://github.com/apple/swift-syntax/issues/888
2022-10-11 21:12:29 -04:00
JP Simard 016c7b6abd
[Bazel] Fix CryptoSwift compiler warnings (#4345)
Pulls in https://github.com/krzyzanowskim/CryptoSwift/pull/989
2022-10-11 14:22:22 -04:00
JP Simard 1533e72fd4
Specify `@SwiftLint` workspace in opt_wrapper.bzl load (#4314) 2022-10-06 16:59:24 -04:00
Keith Smiley 367389a489
[bazel] For SwiftSyntax to compile with optimizations (#4311)
This avoids potential stack overflows and slowness when just working on
SwiftLint itself with bazel. These compiles take a lot longer but as
long as you're not updating swift-syntax that should be a 1 time penalty
2022-10-06 15:54:41 -04:00
JP Simard d6fd754679
Rewrite `contains_over_range_nil_comparison` with SwiftSyntax (#4225)
Use SwiftOperators.
2022-10-06 01:18:31 -04:00
JP Simard 54ccc39e72
Update SwiftSyntax (#4290)
Just staying up to date here.

There's no need to frequently update, but given that we just updated to
trunk, I wanted to make sure we can update without issues.
2022-10-05 16:28:56 -04:00
JP Simard 2388e49190
Use SwiftSyntax's new SwiftParser (#4216) 2022-10-01 15:05:36 -04:00
JP Simard 86f6023d13
Update CryptoSwift to 1.6.0 release (#4258) 2022-09-28 23:37:54 -04:00
JP Simard fd7afedfcf
Update SwiftSyntax & internal parser for Swift 5.7 (#4203)
Require Swift 5.7 to compile
2022-09-26 14:11:39 +00:00
JP Simard 8c5d3cbfc8
Use Xcode 14 RC1 on CI (#4186)
https://twitter.com/XcodeReleases/status/1567607977900929024
2022-09-07 22:58:15 -04:00
JP Simard 9cfd3dc978
Update CI to use Xcode 14 beta 6 (#4125)
Only used for the TSan CI job right now, which was previously using
Xcode 14 beta 5.

https://twitter.com/XcodeReleases/status/1562130365191315457
2022-08-23 15:31:25 -04:00
JP Simard 2960ae6a7a
Test with thread sanitizer in Buildkite using Bazel (#4115)
This will allow for the test to be skipped if it's already cached,
speeding up CI runs.
2022-08-22 19:21:54 -04:00
JP Simard 69f3a3b4b7
Refactor bazel release rule
Moving the signature file generation from the Makefile to the bazel rule
2022-08-22 12:26:22 -04:00
JP Simard e8f738b39c
Automate producing release tarballs for Bazel (#4113) 2022-08-19 17:26:21 +00:00
JP Simard 21ba7c8280
Update SourceKitten to 0.33.0 (#4085)
https://github.com/jpsim/SourceKitten/releases/tag/0.33.0
2022-08-11 21:04:32 +00:00
JP Simard 8f620ccd0b
Bump SourceKitten bazel ref (#4080)
To avoid a compiler warning when building with Xcode 14 beta 5
2022-08-10 14:30:41 -04:00
JP Simard a97718f4c6
Replace incrementer dispatch queue with an actor (#4073)
To support this, we first must use an async entrypoint to the CLI, which
we do by changing the lint and analyze commands to conform to
`AsyncParsableCommand`.

The in order to map over the closures with suspension points, we pull in
CollectionConcurrencyKit as a new dependency.

This change does not touch SwiftLintFramework, only the CLI target.
2022-08-09 13:06:08 +00:00
JP Simard 949ab6289a
[Bazel] Update SourceKitten 2022-07-27 11:04:45 -04:00
JP Simard 29cd97e59c
Bump SourceKitten (#4045) 2022-07-26 14:30:02 -04:00
JP Simard c0f9f2175b
Add support for native custom rules (#4039)
This change makes it possible to add native custom rules when building
SwiftLint via Bazel (possible as of
https://github.com/realm/SwiftLint/pull/4038).

First, add a local bazel repository where custom rules will be defined
to your project's `WORKSPACE`:

```python
local_repository(
    name = "swiftlint_extra_rules",
    path = "swiftlint_extra_rules",
)
```

Then in the extra rules directory, add an empty `WORKSPACE` and a
`BUILD` file with the following contents:

```python
filegroup(
    name = "extra_rules",
    srcs = glob(["*.swift"]),
    visibility = ["//visibility:public"],
)
```

To add a rule (for example, `MyPrivateRule`) add the following two
files:

```swift
// ExtraRules.swift
func extraRules() -> [Rule.Type] {
    [
        MyPrivateRule.self,
    ]
}
```

```swift
// MyPrivateRule.swift
import SourceKittenFramework
import SwiftSyntax

struct MyPrivateRule: ConfigurationProviderRule {
    var configuration = SeverityConfiguration(.error)

    init() {}

    static let description = RuleDescription(
        identifier: "my_private_rule",
        name: "My Private Rule",
        description: "This is my private rule.",
        kind: .idiomatic
    )

    func validate(file: SwiftLintFile) -> [StyleViolation] {
        // Perform validation here...
    }
}
```

Then you can reference the rule in your configuration or source files as
though they were built in to the official SwiftLint repo.

This means that you have access to SwiftLintFramework's internal API.
We make no guarantees as to the stability of these internal APIs,
although if you end up using something that gets removed please reach
out and we'll make a best effort to maintain some level of support.

This PR also improves the linter cache on macOS to make it correctly
invalidate previous results when custom native rules are edited. This
even works when doing local development of SwiftLint, where previous it
was necessary to use `--no-cache` when working on SwiftLint, now the
cache should always work.

Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>
2022-07-26 13:56:22 -04:00
JP Simard 24735ef4d3
Add support for building with Bazel (#4038) 2022-07-26 07:09:02 -04:00