Commit Graph

181 Commits

Author SHA1 Message Date
Danny Moesch d99be668c5 Ignore more locations of static references not using 'Self' in classes (#3771)
Static references with `Self` are not allowed to define

* default values of properties,
* annotation parameter values and
* default method parameter values

in classes.
2022-01-21 12:43:12 -08:00
Ethan Wong 5fd8ef38c1 Fix malformed doc for rule "InclusiveLanguage". 2022-01-21 10:45:15 -05:00
JP Simard 027bdcdc95 Fix crash when parsing multi-line attributes with the attributes rule (#3776)
Fixes #3761
2021-12-06 16:08:53 +00:00
Danny Mösch 050473a0e1 Add optional prefer_self_in_static_references rule (#3732) 2021-11-29 18:42:53 +00:00
Paul Taykalo a87aee1771 Colon rule should ignore cases when comment is in function argument (#3740) 2021-10-14 16:05:11 +03:00
Marcelo Fabri 383e5b5bc2 Handle get async and get throws in implicit_getter (#3743)
Fixes #3684
2021-10-12 10:32:34 -07:00
Artem Garmash 67114bb729 Exclude id from identifier_name by default (#3730) 2021-10-04 21:13:40 +00:00
Paul Taykalo 6b8c4442b0 Speed up "computed accessors order" rule (#3727) 2021-10-01 03:07:57 +03:00
Marcelo Fabri cc79edd4af Fix issues in ImplicitReturnRule 2021-08-16 02:23:28 -07:00
Marcelo Fabri 9e3f0a8ff8 Fix some rules when using Swift 5.4 2021-08-16 02:23:28 -07:00
Ikko Ashimine 81eb0d9b1f Fix typo in ClosureSpacingRule.swift (#3669)
occurences -> occurrences
2021-07-06 10:41:59 -07:00
p-x9 050a10bbd9 Add Test 2021-05-21 14:33:16 -07:00
p-x9 80ca9a7e37 Fix Space appending process when multi byte offsets. 2021-05-21 14:33:16 -07:00
p-x9 7ea514b77a Fixed error in character limit per line. 2021-05-21 14:33:16 -07:00
p-x9 f0c707f477 Fix indents 2021-05-21 14:33:16 -07:00
p-x9 04a41bdb2f Fix Autocorrect on no space between the tuple and "in" in unneeded_parentheses_in_closure_argument 2021-05-21 14:33:16 -07:00
raduciobanu002 07c8e52fc8 "Colon Spacing" rule name update (#3583)
* * Changed rule name from "Colon" to "Colon Spacing"
* Updated tests

* Update CHANGELOG.md

Co-authored-by: Seth Friedman <sethfri@gmail.com>
2021-05-20 23:46:54 -04:00
Steven 625cd180ae Fix type_contents_order initializer detection (#3622) 2021-05-10 09:56:21 -04:00
Marcelo Fabri 4e3c87e2f3 Fix false positive in empty_enum_arguments (#3616)
Fixes #3562
2021-04-28 20:25:05 -07:00
JP Simard 027f130e8c fixup! Fix OSSCheck noise 2021-03-03 11:36:09 -05:00
JP Simard 7f7fc03a8f Fix OSSCheck noise
Try a few things:

1. Sort InclusiveLanguageRule terms since they're a Set and don't have
  deteministic ordering (will definitely help)
2. Fetch remote at the beginning of the script (likely to help)
3. Only fetch remote once (likely to help)
4. Sort branch & master output before diffing (unlikely to help)
5. Change diff filter from `d` to `AMRCU` (no idea if it will help)
2021-03-03 11:19:41 -05:00
Otavio Cordeiro 7ea9b733ff Allow multi-line parameters rule to always break lines (#3494) 2021-02-02 13:27:29 -08:00
JP Simard bbf1ad4a18 [ExplicitSelfRule] Fix violation location and misplaced corrections (#3507) 2021-01-29 10:59:28 -08: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
Keith Smiley b7ec75b68b Add support for testing Examples with configuration
This was extracting from another change that no longer needed it. It
should be helpful for anyone testing custom configuration with their
non-analyzer rules.

I added a random example of something that wasn't previously tested as
an example.
2020-11-16 15:37:15 -08:00
JP Simard bf2790df54 Enable CommentSpacingRule by default
And fix violations in SwiftLint
2020-11-10 12:50:39 -05:00
Paul Taykalo ba58d571d8 Add option that allows skipping aligned constants (#3391) 2020-11-08 10:07:24 -05:00
Paul Taykalo 1b3e9945af Fix inconsistency in operator_usage_whitespace rule (#3388)
This Fixes case when the right part of the expression is an array or a string
Previously, strings and comments tokens were ignored.
In the current implementation, matching done first and then those are filtered if the operator is within the string token
2020-11-07 23:16:44 -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
JP Simard 2dcce6b184 [AttributesRule] Fix parameterized attributes (#3405)
Some attributes are parameterized, such as `@objc(name)`. Previously
these reported `attributes` violations because their contents weren't
included in the configuration, which would just have `@objc`.
2020-11-07 16:57:57 -05:00
Zsolt Kovács ac2c5e4054 Allow opening brace on newline in case of multiline function (#3068) 2020-11-07 16:02:17 -05:00
JP Simard d628c41665 [IdentifierNameRule] Allow "allowed symbols" as first character (#3403)
This means that if `allowed_symbols` contains `_`, you can now write
identifiers like `let _myLet`.

Fixes https://github.com/realm/SwiftLint/issues/3306
2020-11-07 09:54:04 -08:00
Sam e6df1d32e1 Use indentation_width severity configuration (#3397)
* Use the severity from the configuration

It was previously using a hardcoded value, that of the default configuration.

* Update CHANGELOG.md

* Correctly format CHANGELOG addition
2020-10-31 11:50:43 +02:00
Sven Münnich da408b5901 Fix some false positives in rule explicit_self (#3368) 2020-09-25 09:23:03 -07:00
Frederick Kellison-Linn 64b309e19e Fix false positives for 'multiple_closures_with_trailing_closure' (#3353) 2020-09-22 14:18:50 -07:00
JP Simard 6d2e8cfc06 Skip correcting files with parser diagnostics (#3349)
* Skip correcting files with parser diagnostics

Also fix many rule examples with parser diagnostics.

* Sourcery

* Link to issue in changelog entry
2020-09-17 18:14:00 -04:00
Ryan Demo 51544bb4cc Add excluded_match_kinds custom rule config parameter (#3336)
This allows custom rules to define an `excluded_match_kinds` array instead of listing out all but one or a few of the `SyntaxKind`s in `match_kinds`. Rules that include both `match_kinds` and `excluded_match_kinds` will be invalid, since there's not an obvious way to resolve the two without an arbitrary priority between them.
2020-09-10 21:08:41 -04:00
Lukas Schmidt 8945038087 Use correct term for associated values
See https://docs.swift.org/swift-book/LanguageGuide/Enumerations.html for reference
2020-09-03 11:26:57 +02:00
Zsolt Kovacs b33b86acd9 Extend empty_enum_arguments rule to support if case and guard case 2020-08-05 03:48:42 -07:00
Marcelo Fabri 2d67213741 Merge pull request #3282 from realm/marcelo/self-and-is-multiple
Enable legacy_multiple and prefer_self_type_over_type_of_self in our codebase
2020-08-05 03:46:50 -07:00
Marcelo Fabri 8638d23aec Merge pull request #3281 from realm/marcelo/bugfix-3225
Trigger closure_parameter_position in free closures and capture lists
2020-08-05 01:12:22 -07:00
Marcelo Fabri f8ef7d649c Enable legacy_multiple and prefer_self_type_over_type_of_self in our codebase 2020-08-05 01:11:17 -07:00
Marcelo Fabri a05a87e7f2 Merge pull request #3258 from SimplyDanny/bugfix-3034
Fix #3034: Allow opening brace directly after another opening brace
2020-08-05 01:02:00 -07:00
Marcelo Fabri 6ec5806a93 Trigger closure_parameter_position in free closures and capture lists 2020-08-05 00:42:27 -07:00
Marcelo Fabri d36743b58a Fix false positive in no_space_in_method_call with multiple trailing closures
Fixes #3259
2020-08-04 21:20:54 -07:00
Marcelo Fabri 9e5557fbc5 Merge pull request #3160 from realm/mf-computed_accessors_order
Add computed_accessors_order rule
2020-08-04 05:04:45 -07:00
Marcelo Fabri 28bec96b3e Remove a usage of “blacklist” 2020-08-04 04:00:36 -07:00
Marcelo Fabri 240e25232f Add computed_accessors_order rule
Fixes #3158
2020-08-04 03:23:36 -07:00
Marcelo Fabri 063cd3e56c Fix false positive on switch_case_on_newline with Swift 5.3
Fixes #3253
2020-08-04 03:17:23 -07:00