Commit Graph

24 Commits

Author SHA1 Message Date
Danny Mösch b89e43a799
Make sure case check can be disabled by new `off` option value (#5064) 2023-06-17 22:27:57 +02:00
Danny Mösch 83ab977a1b Introduce visitor that tracks declared variables while traversing the AST 2023-06-13 23:24:48 +02:00
JP Simard e5cf99088b
Update SwiftSyntax to 509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-06-05-a (#5058)
Diff: https://github.com/apple/swift-syntax/compare/509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-05-02-a...509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-06-05-a
2023-06-12 15:22:17 -04:00
woxtu 2f9997e2cc
Fix typos (#5033) 2023-05-25 23:58:29 +02:00
Danny Mösch 704c9ae116
Move ViolationsSyntaxVisitor into its own file (#5028) 2023-05-22 07:35:46 -04:00
Danny Mösch 3f039f26d5
Connect configs with their referencing rules to have some context in error logging (#5017)
With the binding of configurations to their associated rule types
"unknown configuration" errors can be made more specific mentioning
also the rule's identifier in the printed message.
2023-05-19 20:58:24 +02:00
Danny Mösch fe312a06fe
Rely on pre-defined issues and allow to print them directly to the console (#5013)
Advantages of having typical errors at a common place:
* Error message styling can be harmonized
* Existing messages can be reused
* Overview of prefixes ('error: ', 'warning: ')
* Manage how to print them to the console
2023-05-16 20:15:14 +02:00
Danny Mösch d73970e9d7
Remove error wrapper (#5008) 2023-05-16 18:22:25 +02:00
Danny Mösch 405113f793
Open ConfigurationError up to be used more broadly (#5005) 2023-05-14 20:00:46 +02:00
JP Simard 1e73835e83
Remove dead code (#5004)
Identified with the upcoming improved dead code detection.
2023-05-12 14:20:31 -04:00
JP Simard 34f5ffa7f7
release 0.52.2 2023-05-12 11:02:03 -04:00
Marcelo Fabri 9f7c57b719
Make id and isVirtual public in SwiftLintFile (#4994) 2023-05-11 13:33:48 -04:00
JP Simard 5616d858bc
release 0.52.1 2023-05-11 11:13:58 -04:00
Danny Mösch c99a4286b8 Let `validates_start_with_lowercase` option in name configurations expect a severity 2023-05-10 22:20:30 +02:00
JP Simard 97259e24d0
release 0.52.0 2023-05-10 15:15:09 -04:00
Danny Mösch 9c1678968f
Remove deprecation warnings introduced > 2 years ago (#4972) 2023-05-10 14:05:28 -04:00
Andyy Hope 5e15039554
Move `excludedPaths` out of iteration loop to speed up lint times (#4955) 2023-05-06 16:43:33 -04:00
Danny Mösch 6a2e973de3
Add new `redundant_self_in_closure` rule (#4911) 2023-05-05 21:14:14 +02:00
JP Simard e86c06c390
[SwiftLintCore] Make `focused()` public (#4959)
So it can be used from SwiftLintBuiltInRules.

I missed this when splitting the SwiftLintFramework module.
2023-05-04 15:07:37 +00:00
JP Simard 6b094dd711
[SwiftSyntax] Update to latest 509.0.0 tag (#4920)
* [bazel] Remove custom SwiftSyntax BUILD file

Something similar to this has been merged upstream instead now. This
also renames the repo name to SwiftSyntax in preparation for it being in
the BCR

* [SwiftSyntax] Update to latest 509.0.0 tag

https://github.com/apple/swift-syntax/releases/tag/509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-04-25-b
2023-05-03 11:34:26 -04:00
Chris White 71b89e66de
Prepend `warning: ` to error messages (#4927) 2023-05-01 18:26:25 +02:00
JP Simard 86d60400c1 Move core SwiftLint functionality to new SwiftLintCore module
Over the years, SwiftLintFramework had become a fairly massive monolith,
containing over 400 source files with both core infrastructure and
rules.

Architecturally, the rules should rely on the core infrastructure but
not the other way around. There are two exceptions to this:
`custom_rules` and `superfluous_disable_command` which need special
integration with the linter infrastructure.

Now the time has come to formalize this architecture and one way to do
that is to move the core SwiftLint functionality out of
SwiftLintFramework and into a new SwiftLintCore module that the rules
can depend on.

Beyond enforcing architectural patterns, this also has the advantage of
speeding up incremental compilation by skipping rebuilding the core
functionality when iterating on rules.

Because the core functionality is always useful when building rules, I'm
opting to import SwiftLintCore in SwiftLintFramework as `@_exported` so
that it's implicitly available to all files in SwiftLintFramework
without needing to import it directly.

In a follow-up I'll also split the built-in rules and the extra rules
into their own modules. More modularization is possible from there, but
not planned.

The bulk of this PR just moves files from `Source/SwiftLintFramework/*`
to `Source/SwiftLintCore/*`. There are some other changes that can't be
split up into their own PRs:

* Change jazzy to document the SwiftLintCore module instead of
  SwiftLintFramework.
* Change imports in unit tests to reflect where code was moved to.
* Update `sourcery` make rule to reflect where code was moved to.
* Create a new `coreRules` array and register those rules with the
  registry. This allows the `custom_rules` and
  `superfluous_disable_command` rule implementations to remain internal
  to the SwiftLintCore module, preventing more implementation details
  from leaking across architectural layers.
* Move `RuleRegistry.registerAllRulesOnce()` out of the type declaration
  and up one level so it can access rules defined downstream from
  SwiftLintCore.
2023-04-26 21:10:19 -04:00
JP Simard 740572f049 Move `Version.swift` to SwiftLintCore 2023-04-26 21:10:19 -04:00
JP Simard 711d92e26f Add empty SwiftLintCore module
Source files will be added to it in a follow-up commit.
2023-04-26 21:10:19 -04:00