Commit Graph

42 Commits

Author SHA1 Message Date
Danny Mösch dfe19ac7fc Respect comments before opening braces in opening_brace rule (#5582) 2024-05-15 23:06:59 +02:00
Danny Mösch 5f8fe00bf9 Pass an entity's parent to the traversal block as well 2024-05-03 22:26:21 +02:00
Danny Mösch 11cbac63d1 Enable consider_default_literal_types_redundant option (#5555) 2024-05-01 19:58:42 +00:00
Martin Redington 7623f1e730 Enable more rules in SwiftLint's own .swiftlint.yml (#5532) 2024-04-27 18:43:08 +02:00
Martin Redington 8fdf669d53 Add all analyzer pseudo-rule (#5519) 2024-04-02 09:34:17 +02:00
Martin Redington 5075cc073c Fix warnings about configured rules that are not enabled, when they are enabled in a parent config (#4864) 2024-03-25 21:39:22 +01:00
Oleg Kohtenko bedf211c43 Ignore absence of child or parent config instead of falling back to default (#5407) 2024-03-16 10:29:42 -04:00
Danny Mösch c730047176 Enable superfluous_else rule (#5412) 2024-03-03 16:30:44 +01:00
Danny Mösch d0fb75fcfb Prefer package ACL over @_spi (#5466) 2024-03-03 16:30:04 +01:00
Danny Mösch 8b98d859a3 Make superfluous_else rule auto-correctable (#5411) 2024-01-07 18:55:42 +01:00
Ben P 544e1c60c7 Add a new non_optional_string_data_conversion rule (#5264) 2023-12-02 07:33:22 -05:00
Kishikawa Katsumi 0d54c2a10d Rewrite opening_brace rule with SwiftSyntax (#5164) 2023-12-02 12:21:50 +01:00
Danny Mösch 8cb2cf9f85 Rewrite let_var_whitespace rule with SwiftSyntax (#5367) 2023-11-29 22:45:06 +01:00
Danny Mösch eab0af851c Rewrite identifier_name rule with SwiftSyntax (#5354) 2023-11-19 12:47:41 +01:00
Danny Mösch fb4ef951ee Print invalid keys when configuration parsing fails (#5350) 2023-11-14 23:43:38 +01:00
JP Simard 6e3bfc1a45 Fix more strict concurrency warnings (#5324)
These aren't enough to enable `-strict-concurrency=complete` for more
modules, but they address some warnings with that flag on and reduces
the scope of what remains to be migrated.
2023-11-01 12:41:54 -04:00
JP Simard 907294929b Remove workaround for SR-11170 (#5280)
The original issue was closed a year ago and this doesn't appear to be
needed anymore.

I compiled in Debug mode and ran the tests in Xcode to verify.
2023-10-16 09:39:10 -04:00
Danny Mösch 58928b7e40 Enforce any on existential types (#5273)
This makes syntactically clear which types are rather expensive.
2023-10-12 08:37:23 +02:00
Danny Mösch 2433e7b5bf Make use of macros to generate configuration parsing code (#5250) 2023-10-02 22:35:24 +02:00
John Szumski 696e19df33 Fix false positives in unused_import rule for constructors defined in transitive modules (#5246) 2023-10-01 11:19:41 +02:00
Danny Mösch 075017cba5 Merge modifier extensions into one (#5234) 2023-09-24 23:50:10 +02:00
Martin Redington f783b0279a Add strict configuration file setting (#5226) 2023-09-18 19:27:30 +02:00
Danny Mösch 35a78815d1 Update SwiftSyntax (#5198) 2023-09-14 22:49:55 +02:00
Danny Mösch b281a8d33a Update SwiftSyntax (#5168) 2023-08-30 22:57:10 +02:00
Danny Mösch 9f927e9d9b Add new non_overridable_class_declaration rule (#5160) 2023-08-28 13:34:09 -04:00
Martin Redington 9a5c3ed641 Disabled rules in child configs are no longer automatically ignored if they are opt-in (#4863) 2023-07-26 21:19:39 +02:00
Danny Mösch b53919d40c Simplify data flow 2023-07-17 23:18:26 +02:00
Danny Mösch a25fbe3e50 Make indent function a String extension 2023-07-17 23:18:26 +02:00
Danny Mösch 9881930be5 Implement conformances in extensions (#5109) 2023-07-08 13:52:17 +02:00
Martin Redington 0693d547b0 Add new unneeded_synthesized_initializer rule (#4812) 2023-06-21 22:15:02 +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 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 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
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 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