Commit Graph

271 Commits

Author SHA1 Message Date
Marcelo Fabri fa6db3cca7
Rewrite `collection_alignment` rule with SwiftSyntax (#4472) 2022-10-24 10:51:31 -07:00
Marcelo Fabri 25a04e8eeb
Migrate `inclusive_language` rule to SwiftSyntax (#4390) 2022-10-23 14:00:40 +00:00
Marcelo Fabri 0bd9e4e65f
Rewrite `unused_optional_binding` with SwiftSyntax (#4449) 2022-10-23 06:13:54 -07:00
Marcelo Fabri 7b1099a33d
Rewrite `prefixed_toplevel_constant` with SwiftSyntax (#4425) 2022-10-21 13:11:40 -07:00
Marcelo Fabri 1fb04902c0
Rewrite `multiline_parameters` rule with SwiftSyntax (#4438) 2022-10-21 09:08:27 +00:00
Marcelo Fabri a4fbec355c
Validate protocols in `type_name` rule (#4433)
Fixes #4430
2022-10-21 00:11:18 -07:00
Marcelo Fabri 9f4b2c37ba
Rewrite `for_where`, adding `allow_for_as_filter` config (#4154) 2022-10-20 18:47:31 -07:00
Marcelo Fabri f509998ec1
Rewrite `empty_count` with SwiftSyntax (#4426) 2022-10-20 16:52:30 -07:00
Marcelo Fabri 844b7c02dd
Rewrite `trailing_comma` rule with SwiftSyntax (#4385) 2022-10-16 23:36:11 -07:00
Marcelo Fabri 4522005ab4
Migrate `implicitly_unwrapped_optional` to SwiftSyntax (#4278)
* Migrate `implicitly_unwrapped_optional` to SwiftSyntax

* Update Source/SwiftLintFramework/Rules/RuleConfigurations/ImplicitlyUnwrappedOptionalConfiguration.swift

Co-authored-by: Danny Mösch <danny.moesch@icloud.com>

* Fix after rebase

Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2022-10-16 22:55:32 -07:00
Danny Mösch f8e5339c69
Introduce `ReasonedRuleViolation` type to associate a reason with a violation position (#4379) 2022-10-16 12:53:38 +02:00
Marcelo Fabri 860b027005
Migrate `private_over_fileprivate` to SwiftSyntax (#4376) 2022-10-15 14:49:16 -07:00
Marcelo Fabri c9ef157c29
Rewrite `conditional_returns_on_newline` with SwiftSyntax (#4340)
* Rewrite `conditional_returns_on_newline` with SwiftSyntax

* Keep original behavior

* PR feedback
2022-10-15 02:25:56 -07:00
JP Simard f04e28cbf8
Rewrite `switch_case_alignment` with SwiftSyntax (#4373) 2022-10-14 10:06:54 +00:00
JP Simard 4e3c750086
Rewrite `attributes` with SwiftSyntax (#4359)
Not 100% the same as it previously was, but I think all the changes
reported by OSSCheck are improvements or neutral.
2022-10-13 00:40:24 -04:00
Marcelo Fabri b938a4e07d
Convert `number_separator` rule to SwiftSyntax (#4333) 2022-10-09 21:03:57 -07:00
Danny Mösch ab3f070222
Introduce `SeverityBasedRuleConfiguration` to avoid custom `makeViolation`s (#4274) 2022-10-04 07:39:07 +02:00
Martin Redington 0db26db975
Add `test_parent_classes` option to `test_case_accessibility` rule (#4214) 2022-09-21 18:29:32 +02:00
Marcelo Fabri f8a4276aba
Rewrite `generic_type_name` rule with SwiftSyntax (#4229) 2022-09-21 08:29:52 -07:00
dahlborn f3d367f667
Add `LibraryContentProvider` to `file_types_order` rule (#4209) 2022-09-19 22:15:41 +02:00
Marcelo Fabri c1650e6918
Add `excludes_trivial_init` for `missing_docs (#4152)
Fixes #4107
2022-09-03 22:11:57 -07:00
JP Simard 9979c4fd27
Add new `self_binding` opt-in rule (#4146)
To enforce that `self` identifiers are consistently re-bound to a common
identifier name.

Configure `bind_identifier` to the name you want to use.

Defaults to `self`.

Addresses https://github.com/realm/SwiftLint/issues/2495
2022-08-30 16:37:19 -04:00
Ben Davis 7dfadc205a
Add new configuration to `operator_usage_whitespace` rule to specify no-space operators (#4112) 2022-08-25 17:59:27 +02:00
Danny Mösch 828f36958f
Introduce option to ignore indentation of compiler directives in `indentation_width` rule (#4066) 2022-08-10 21:52:32 +02:00
JP Simard 0ded5859a1
Rewrite ColonRule with SwiftSyntax (#4063)
Making it about 7x faster, finding some previously missed cases.
2022-08-04 17:23:52 -04:00
Danny Mösch a51be7bcce
Refactor deployment target configuration to avoid duplications (#4017) 2022-07-06 17:07:15 -04:00
Taha Bebek e34f49695b
Support extension targets in `deployment_target` rule (#4011) 2022-07-05 22:41:56 +02:00
Marcelo Fabri a19ffddf66
Support arrays for `included` & `excluded` in custom rules (#4006)
* Support arrays for `included` & `excluded` in custom rules

* Extract shouldValidate(filePath:) and add tests
2022-06-27 00:29:26 -07:00
Chris Hale 9beef23175
Throw error on bad expiring todo date format (#3626) 2022-04-11 21:20:05 +02:00
JP Simard 54a24638a2
Print minimum_fraction_length in description even when unset 2022-03-03 12:49:11 -05:00
JP Simard 006bb2a85e
Sort implicit return configuration description (#3823)
To make the output deterministic
2022-01-24 17:13:12 -08:00
Danny Mösch 050473a0e1
Add optional prefer_self_in_static_references rule (#3732) 2021-11-29 18:42:53 +00:00
Ben Fox 00799cc782
Fixes MissingDocRuleConfiguration (#3713)
* add configuration for missing_docs

* fix MissingDocsRuleConfiguration

* add to changelog

* fix up Config default values and update tests

* use XCTAssertTrue and XCTAssertFalse

* fix line length violation

* finish up unit tests

* rever Package.resolved
2021-09-13 15:23:55 -04:00
Ben Fox 1f44d56357
add configuration for missing_docs (#3701)
* `excludes_extensions` defaults to `true` to skip reporting violations
  for extensions with missing documentation comments.
* `excludes_inherited_types` defaults to `true` to skip reporting
  violations for inherited declarations, like subclass overrides.
2021-09-01 21:42:47 +00:00
Dylan Maryk 5a3844401b
Fix missing comma in description (#3588) 2021-04-27 22:51:37 -07:00
Artem Garmash 4266ea9d60
Add Bool violation reporting in `redundant_type_annotation` (#3438)
* Add Bool violation detection

* Update Changelog

* Fix issues found by the rule
2021-02-24 14:29:08 -08:00
JP Simard 60242fd599
[UnusedDeclarationRule] Allow configuration related USRs to skip (#3525)
For example you might have custom source tooling that does something
with types conforming to a procotol even if that type is never
explicitly referenced by other code.
2021-02-17 12:25:23 -08:00
Otavio Cordeiro 7ea9b733ff
Allow multi-line parameters rule to always break lines (#3494) 2021-02-02 13:27:29 -08:00
Yurii Kotov 6dba929b4f
Fix typos in configuration options for file_name rule 2020-12-16 19:56:50 +02:00
Dalton Claybrook ba5e6d2e1c
Fix false positives in inclusive_language rule (#3439)
* Add support for allowed terms in inclusive language rule

* Update changelog

* Move changelog entry to Enhancements section

Co-authored-by: JP Simard <jp@jpsim.com>
2020-11-20 14:12:24 -05:00
Bryan Ricker 999bfbdefa Fix consoleDescription for OverriddenSuperCallConfiguration 2020-11-10 20:40:41 -08:00
Bryan Ricker 8a0eb67561 chore: rename OverridenSuperCallConfiguration to OverriddenSuperCallConfiguration
BREAKING CHANGE: As `OverridenSuperCallConfiguration` is a
publicly-exposed struct, this rename should be considered breaking.
2020-11-10 20:40:41 -08:00
JP Simard bf2790df54
Enable CommentSpacingRule by default
And fix violations in SwiftLint
2020-11-10 12:50:39 -05:00
JP Simard d9b5df2d72
Merge pull request #3254 from realm/ks/add-always_keep_imports-to-unusedimportrule
Add 'always_keep_imports' to UnusedImportRule
2020-11-09 17:43:20 -05:00
JP Simard 46ed5e2ece
Add print statement for deprecation
To indicate that `statement_level` has been renamed to `function_level`.
2020-11-09 12:06:45 -05:00
JP Simard aa02a8aec0
Apply small refactorings 2020-11-09 12:06:44 -05:00
Skoti b9841595a5
Separated nesting level counting for types and functions in `nesting` rule (fixes #1151). Enhanced `nesting` rule to search for nested types and functions within closures and statements. Enhanced `nesting` rule to allow for one nested type within a function even if breaking a maximum type level nesting (fixes #1151). 2020-11-09 12:06:34 -05:00
Paul Taykalo ba58d571d8
Add option that allows skipping aligned constants (#3391) 2020-11-08 10:07:24 -05:00
Dalton Claybrook d305e03905
Add `inclusive_language` rule (#3243)
Current events have renewed the conversation in our community about the roles of terminology with racist connotations in our software. Many companies and developers are now taking appropriate steps to remove this terminology from their codebases and products. (e.g. [GitHub](https://twitter.com/natfriedman/status/1271253144442253312)) This small rule prevents the use of declarations that contain any of the terms: whitelist, blacklist, master, and slave. It may be appropriate to add more terms to this list now or in the future.
2020-11-07 22:03:08 -05:00
Paul Taykalo 693ee2cae9
Add Isnot Empty extension in the Swift Framework (#3387) 2020-11-07 18:42:55 -05:00