Commit Graph

1162 Commits

Author SHA1 Message Date
Danny Mösch d7cf2fe631 Adapt and templatize test reference (#5589) 2024-05-16 20:55:52 +00:00
Garric G. Nahapetian 919c10f211 Fix testSARIFReporter (#5572) 2024-05-13 19:50:00 +00:00
Danny Mösch c29391a5ae Ignore but report invalid keys (#5567)
Don't fall back to the default configuration due to invalid keys.
2024-05-11 10:28:10 +00:00
Danny Mösch d734022778 Add package ACL (#5559) 2024-05-04 15:52:21 +02:00
Garric G. Nahapetian 16c0213027 Add option to redundant_type_annotation rule to consider default literal types redundant (#4756) 2024-05-01 21:15:35 +02:00
Chandler Wall 16cb4a02b1 Fix numeric version comparisons (#5526) 2024-05-01 20:51:01 +02:00
Martin Redington 96db41c379 Add an experimental baseline feature (#5475) 2024-05-01 16:55:33 +02:00
Martin Redington 7623f1e730 Enable more rules in SwiftLint's own .swiftlint.yml (#5532) 2024-04-27 18:43:08 +02:00
Danny Mösch 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ösch 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
Marceau TONELLI b3dd89088e Rewrite redundant_type_annotation with SwiftSyntax (#5389)
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2024-04-21 17:46:29 +02:00
waitbutY 5315c3d1b6 Add SARIF reporter (#5516) 2024-04-13 05:49:57 -04:00
waitbutY 745aec5903 Adjust case of severity in Code Climate reporter (#5523) 2024-04-07 12:39:08 +02:00
Martin Redington dfb09820d3 Enable superfluous_disable_command rule for analyzer rules (#5522) 2024-04-03 20:27:21 +02:00
Danny Mösch 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
Danny Mösch 1c0d28fd0d Compare rule IDs and configurations with reference (#5510)
This new test ensures that rule IDs and their option names do not get
changed inadvertently.

The file can easily be updated by running:

```bash
swift run swiftlint rules --config-only --default-config > Tests/IntegrationTests/default_rule_configurations.yml
```
2024-03-26 19:07:39 +01:00
Danny Mösch 299042a233 Allow to configure only severity in a short form for every rule with a severity (#5509)
The README states that a configuration like `attributes: error` is
valid to only set a different severity level for a rule (the
`attributes` rule here). This was previously only possible for rules
that were accompanied by a plain severity configuration.

I don't think this broke with the automatic parsing code generation.
For some rules it might have worked before, for others not. This change
makes it consistently working for all rules.
2024-03-25 21:40:56 +01: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
Danny Mösch dfa7f2fd4d Use result builder to fix indentation (#5507) 2024-03-24 09:04:36 +00: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ösch 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
deterclosed 082adfaed7 Fix some typos (#5504) 2024-03-23 15:25:16 +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 a5818b9066 Support Swift version 5.10.0 (#5491) 2024-03-09 13:34:07 +00:00
Phlippie a84d9a9ed4 Add new static_over_final_class rule (#5487) 2024-03-08 20:37:35 +01:00
Kotaro Suto d9c6888287 Make trailing_closure rule correctable (#5453) 2024-03-05 21:16:45 +01: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 4078e41f1b Let all rewriters have a configuration by default (#5467) 2024-02-11 15:13:24 +01:00
Hayashi Tatsuya 6d38558bd4 Rewrite nesting rule with SwiftSyntax (#5439) 2024-02-07 15:35:38 -05:00
Danny Mösch 7c29ae4f3e Add new shorthand_argument rule (#5451) 2024-02-06 23:36:28 +00:00
Kotaro Suto f0c1780b53 Make empty_count rule correctable (#5409) 2024-01-29 20:15:51 +01:00
Kasra Babaei 77bae5429c Allow line_length rule to ignore certain lines based on regex patterns (#5437) 2024-01-26 09:40:59 +01:00
m.a 443cbd7fce Add new option ignore_typealiases_and_associatedtypes to nesting rule (#5433) 2024-01-21 12:28:23 -05:00
Danny Mösch 1e9428a92e Respect scattered disable commands in duplicate_imports rule (#5432) 2024-01-20 14:30:46 +01:00
Danny Mösch 1c605a597a Refine violation position of trailing_closure rule (#5419) 2024-01-16 13:16:04 -05:00
Danny Mösch 8b98d859a3 Make superfluous_else rule auto-correctable (#5411) 2024-01-07 18:55:42 +01:00
Danny Mösch a8a676f479 Merge return_value_from_void_function and discouraged_void_return rules (#5403) 2023-12-26 11:23:27 +01:00
Danny Mösch 77a9d3ccc6 Add discouraged_void_return rule (#5400) 2023-12-22 15:21:36 +01:00
Danny Mösch ddaf3d22ad Add new final_test_case rule (#5396) 2023-12-20 20:59:03 +01:00
Garric G. Nahapetian 6366fb8566 Support Swift version 5.9.2 (#5391) 2023-12-13 22:35:23 +01:00
Muhammad Zeeshan 7d6f6cfa17 Add new one_declaration_per_file rule (#5377) 2023-12-09 05:11:25 -05: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
Leonardo de Sousa Rodrigues eecb44db6e Add option to make unneeded_override rule affect initializers (#5270) 2023-11-30 21:35:53 +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 efddde68ac Allow to configure more operators in identifier_name rule (#5362) 2023-11-19 15:59:54 +01:00
Danny Mösch 09d1ef9d1d Harmonize violation positions (#5360)
Marks the violating identifiers directly.
2023-11-19 13:51:53 +01:00
Danny Mösch eab0af851c Rewrite identifier_name rule with SwiftSyntax (#5354) 2023-11-19 12:47:41 +01:00