Commit Graph
111 Commits
Author SHA1 Message Date
Danny MöschandGitHub 5bbdf7f4e6 Allow to set configuration elements as deprecated (#5540)
Automatically print an appropriate warning to the console.
2024-04-25 19:37:04 +00:00
Danny MöschandGitHub 1b7fbc4bcd Make postprocessors non-throwing (#5539)
Failing immediately when a property is invalid is too strict. It feels
sufficient to allow to report an issue but otherwise continue with a default
value instead of stopping execution completely.
2024-04-23 16:45:59 -04:00
waitbutYandGitHub 5315c3d1b6 Add SARIF reporter (#5516) 2024-04-13 05:49:57 -04:00
waitbutYandGitHub 745aec5903 Adjust case of severity in Code Climate reporter (#5523) 2024-04-07 12:39:08 +02:00
Martin RedingtonandGitHub dfb09820d3 Enable superfluous_disable_command rule for analyzer rules (#5522) 2024-04-03 20:27:21 +02:00
Martin RedingtonandGitHub 8fdf669d53 Add all analyzer pseudo-rule (#5519) 2024-04-02 09:34:17 +02:00
Danny MöschandGitHub 758c22e7cb Prohibit configuration key inference (#5513)
While this is already implemented, it only works when a configuration
is updated by calling `apply(configuration:)` on it somewhere. This
imperceptible detail could lead to confusing. So better prohibit the
use of the feature for the time being as long as a good solution is
found. So far, no explicit configuration keys have been removed.
2024-03-27 19:08:59 -04:00
Martin RedingtonandGitHub 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
Danny Mösch e6bb673444 Handle issues in nested contexts gracefully while still throwing standalone
Use different issues to make inlineable configurations work in both
scenarios, namely being used standalone and nested as part of another
configuration. In the latter case, finding no values to parse in a raw
configuration is okay, while as a standalone configuration it's not.
2024-03-24 09:36:18 +01:00
Danny Mösch ccd50e8c68 Merge duplicated issues 2024-03-24 09:36:18 +01:00
Danny MöschandGitHub 82cad0bfff Allow to infer option names (#5505)
This allows to infer names of options from their names in a configuration. CamelCase is translated into snake_case automatically when `apply` is triggered.

* Don't have all `RuleConfiguration`s conform to `InlinableOptionType`. Mark types that must have this capability explicitly. Same for `AcceptableByConfigurationElement`.
* A type being an `InlinableOptionType` doesn't mean it's automatically inlined. This also doesn't depend on the fact of having a name for its key configured any longer. Instead, an `inline` attribute must explicitly be set to `true` in `@ConfigurationElement`.
* Key name inference is optional and can be overwritten by specifying a key name in the attribute.
* Inlined configurations only fail in `apply` when they are really sure that something is odd. Otherwise, they accept to not being updated.
2024-03-23 18:54:39 +01:00
deterclosedandGitHub 082adfaed7 Fix some typos (#5504) 2024-03-23 15:25:16 +01:00
Danny MöschandGitHub 6398c3b807 Shift selection of default reporter (#5499) 2024-03-17 20:26:15 +01:00
Oleg KohtenkoandGitHub 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öschandGitHub 5bfe329d09 Update SwiftSyntax to version 510.0.0 (#5479) 2024-03-09 15:46:45 -05:00
Marcelo FabriandGitHub 1aa8289085 Allow rules to lint empty files (#5478) 2024-03-04 07:36:40 -08:00
Danny MöschandGitHub c730047176 Enable superfluous_else rule (#5412) 2024-03-03 16:30:44 +01:00
Danny MöschandGitHub d0fb75fcfb Prefer package ACL over @_spi (#5466) 2024-03-03 16:30:04 +01:00
Danny MöschandGitHub 4078e41f1b Let all rewriters have a configuration by default (#5467) 2024-02-11 15:13:24 +01:00
Danny MöschandGitHub fc2a18e4aa Preprocess syntax tree before running corrections (#5428) 2024-01-18 20:25:34 +01:00
Danny MöschandGitHub 8b98d859a3 Make superfluous_else rule auto-correctable (#5411) 2024-01-07 18:55:42 +01:00
Ben PandGitHub 544e1c60c7 Add a new non_optional_string_data_conversion rule (#5264) 2023-12-02 07:33:22 -05:00
Kishikawa KatsumiandGitHub 0d54c2a10d Rewrite opening_brace rule with SwiftSyntax (#5164) 2023-12-02 12:21:50 +01:00
Danny MöschandGitHub 8cb2cf9f85 Rewrite let_var_whitespace rule with SwiftSyntax (#5367) 2023-11-29 22:45:06 +01:00
Danny MöschandGitHub eab0af851c Rewrite identifier_name rule with SwiftSyntax (#5354) 2023-11-19 12:47:41 +01:00
Danny MöschandGitHub fb4ef951ee Print invalid keys when configuration parsing fails (#5350) 2023-11-14 23:43:38 +01:00
Danny MöschandGitHub 1603f4ab55 Remove filter that is assuming classes cannot be nested inside of extensions (#5344) 2023-11-11 14:28:16 +01:00
Danny Mösch 779f6f0910 Add missing subscript declaration 2023-11-11 14:06:06 +01:00
Danny Mösch 3a03e7a31f Extract method that checks if a declaration shall be skipped 2023-11-11 14:06:06 +01:00
JP Simard f17a4f9dfb release 0.54.0 2023-11-10 15:54:29 -05: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
Kabir OberaiandGitHub 92679e230d Fix implicit_getter false positive in case of unknown accessors (#5300) 2023-11-09 09:14:16 +01: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 e7460339d4 Declare ConfigurationElement as Equatable right away 2023-11-05 00:24:42 +01: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
JP SimardandGitHub 48604d35e3 Update Sourcery to 2.1.2 (#5318) 2023-10-31 20:34:49 +00:00
JP SimardandGitHub bc7d3c0228 Remove unused SubstitutionCorrectableASTRule protocol (#5312)
Last use was removed in https://github.com/realm/SwiftLint/pull/4192.
2023-10-30 14:11:38 -04:00
Danny MöschandGitHub 4c0f33782c Check disabled regions for all syntax types in parent rewriter class (#5292) 2023-10-23 15:34:51 -04:00
Danny MöschandGitHub 5ec1de0312 Generate makeRewriter optionally (#5281) 2023-10-17 15:19:19 -04:00
Danny MöschandGitHub 57632017e4 Introduce parent class for rewriters (#5282) 2023-10-17 18:55:02 +02:00
Danny MöschandGitHub 40bd97038a Support arbitrary configurations in @SwiftSyntaxRule (#5275)
Almost all rules based on SwiftSyntax can be set up now by just adding
`@SwiftSyntaxRule` to the rule struct.
2023-10-16 19:34:43 +02:00
JP SimardandGitHub 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ö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 0934c18cba Let RuleConfigurations be equatable by default (#5257) 2023-10-03 18:05:31 +02:00
Danny MöschandGitHub f6e5f778fc Configure expression folding by argument of @SwiftSyntaxRule macro (#5255) 2023-10-03 07:16:33 -04:00
JP SimardandGitHub 591154091e Introduce @SwiftSyntaxRule & @Fold macros (#5253)
These macros remove some of the boilerplate involved when writing rules.

This change also adds test infrastructure for the macros used within
SwiftLint.
2023-10-02 18:43:16 -04:00
Danny MöschandGitHub 2433e7b5bf Make use of macros to generate configuration parsing code (#5250) 2023-10-02 22:35:24 +02:00
John SzumskiandGitHub 696e19df33 Fix false positives in unused_import rule for constructors defined in transitive modules (#5246) 2023-10-01 11:19:41 +02:00