Commit Graph
917 Commits
Author SHA1 Message Date
Danny MöschandGitHub fb4ef951ee Print invalid keys when configuration parsing fails (#5350) 2023-11-14 23:43:38 +01:00
Marcelo FabriandGitHub ed8ed010f1 Revert "Trigger superfluous_disable_command for custom_rules (#4755)" (#5339)
This reverts commit 7499896199.
2023-11-09 04:11:48 -05:00
Marcelo FabriandGitHub 7499896199 Trigger superfluous_disable_command for custom_rules (#4755)
Fixes #4754
2023-11-07 04:11:58 -05:00
Danny Mösch 45e19610be Use _modify accessor to allow ConfigurationElement to be a struct type 2023-11-05 00:24:42 +01:00
JP SimardandGitHub 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
Marcelo FabriandGitHub 715198ae3f Rewrite cyclomatic_complexity with SwiftSyntax (#5308) 2023-10-29 11:17:45 -07:00
BB9zandGitHub cb3001bca2 Keep trailing trivia in explicit_init rule correction (#5296) 2023-10-23 15:41:10 -04:00
Marcelo FabriandGitHub ee02f19cfc Fix CocoaPods job + Swift 5.9.1 (#5298) 2023-10-23 10:13:44 +00:00
Danny MöschandGitHub 2ed1fc2f27 Let all rules be configurable (#5274) 2023-10-12 17:30:45 +02:00
Danny MöschandGitHub 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öschandGitHub 2433e7b5bf Make use of macros to generate configuration parsing code (#5250) 2023-10-02 22:35:24 +02:00
Tatsuyuki KobayashiandGitHub 1bbce6c1b0 Add only configuration option to todo rule (#5233) 2023-09-26 14:45:04 -04:00
Martin RedingtonandGitHub f783b0279a Add strict configuration file setting (#5226) 2023-09-18 19:27:30 +02:00
Ricky TanandGitHub 865f0227f6 Add new mode weak_except_iboutlets to implicitly_unwrapped_optional rule (#4975) 2023-09-15 22:15:42 +02:00
Martin RedingtonandGitHub 0c9827bc59 Add include_bare_init option to explicit_init rule (#5203) 2023-09-04 22:19:54 +02:00
Martin RedingtonandGitHub a459ccf5c4 Drop support for disable/enable commands in multiline comments (#4803) 2023-09-03 18:09:55 -04:00
Danny MöschandGitHub 02640a3415 Rewrite implicit_return rule using SwiftSyntax (#5166) 2023-09-02 14:32:37 +02:00
Danny Mösch 84405f9d3f Use correct separator for nested descriptions 2023-08-28 20:19:28 +02:00
Danny Mösch 668cce84db Print YAML configuration in output of rules command 2023-08-28 20:19:28 +02:00
Danny MöschandGitHub f10fc3056b Remove superfluous newline characters from examples (#5158) 2023-08-06 12:23:26 -04:00
Martin RedingtonandGitHub 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öschandGitHub 5b64c1097a Fix runtime error when an excluded directory does not exist (#5143) 2023-07-25 21:25:04 +02:00
Danny Mösch a25fbe3e50 Make indent function a String extension 2023-07-17 23:18:26 +02:00
Christian PanettaandGitHub bf8edaaeff Improve violation message for attributes rule (#5108) 2023-07-15 15:47:11 +02:00
Danny MöschandGitHub 678cd6f805 Introduce a model for rule configuration description (#3931) 2023-07-03 22:47:30 +02:00
Danny MöschandGitHub 33545d2f4b Add configuration for unallowed symbols severity (#5066) 2023-06-22 10:42:41 -04:00
Danny Mösch f5ea2492dc Merge allowed symbols with alphanumerics where possible 2023-06-18 12:01:28 +02:00
Danny MöschandGitHub b89e43a799 Make sure case check can be disabled by new off option value (#5064) 2023-06-17 22:27:57 +02:00
JP SimardandGitHub 7462187191 Add 5.9 to Swift version tests (#5057)
This gets all tests passing with Xcode 15 beta 1.
2023-06-12 18:39:18 +00:00
woxtuandGitHub c735e6320f Add Swift version 5.8.1 (#5050) 2023-06-05 16:52:35 +00:00
Danny MöschandGitHub a2ba0a0626 Omit "Rule" in configuration names (#5024) 2023-05-20 04:39:04 -04:00
Danny MöschandGitHub 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öschandGitHub d938b2d3c3 Specify default options in configurations only (#5020) 2023-05-18 17:21:30 +02:00
Danny MöschandGitHub 405113f793 Open ConfigurationError up to be used more broadly (#5005) 2023-05-14 20:00:46 +02:00
Danny Mösch 0ffe0c5911 Extract tests for NameConfiguration 2023-05-10 22:20:30 +02: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
Andyy HopeandGitHub 5e15039554 Move excludedPaths out of iteration loop to speed up lint times (#4955) 2023-05-06 16:43:33 -04:00
Simon StøvringandGitHub 9054ec0658 Add test verifying that the file_header rule can require an empty file header (#4928) 2023-05-01 18:47:37 +02:00
JP SimardandGitHub a7bc9e20c7 Move built-in rules to new SwiftLintBuiltInRules module (#4950) 2023-04-27 11:16:01 -04: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 4c04cdafa7 Introduce SwiftLintTestCase
To consistently set up rules before tests
2023-04-25 12:28:50 -04:00
JP Simard 165172e0fa Introduce a "rule registry" concept
This will allow for registering rules that aren't compiled as part of
SwiftLintFramework.

Specifically this will allow us to split the built-in and extra rules
into separate modules, leading to faster incremental compilation when
working on rules since the rest of the framework won't need to be
rebuilt on every compilation.
2023-04-25 12:28:50 -04:00
Sven MünnichandGitHub a2facce70c Fix false positives related to multiline strings in indentation_width rule (#4862) 2023-04-04 19:27:16 +02:00
Danny MöschandGitHub ee849bcb10 Remove unused imports (#4856) 2023-04-03 19:26:59 +02:00
Danny MöschandGitHub 16e2bb0f18 Extend xct_specific_matcher rule to check for boolean asserts on (un)equal comparisons (#3858) 2023-04-02 12:30:21 +02:00
Danny MöschandGitHub 82491e6f84 Add Swift version 5.8 (#4851) 2023-03-31 22:44:25 +02:00
Danny MöschandGitHub 3d15419adb Fix warnings in Swift 5.8/Xcode 14.3 (#4850) 2023-03-31 22:13:20 +02:00
Martin RedingtonandGitHub 7dad240ea7 Add a reporters subcommand (#4836) 2023-03-31 08:09:01 +02:00
Martin RedingtonandGitHub ca43d2359b Fix unit test configuration (#4847) 2023-03-30 22:46:31 +02:00
5a91b1e392 Fixed display of optin and correctable (#4841)
Co-authored-by: Martin Redington <mildm8nnered@gmail.com>
2023-03-27 07:48:51 +02:00