5084 Commits
Author SHA1 Message Date
JP Simard d91c2179bb release 0.41.0 0.41.0 2020-11-08 12:07:40 -05:00
JP Simard 41c99048bf Format changelog 2020-11-08 10:11:14 -05:00
Paul Taykalo ba58d571d8 Add option that allows skipping aligned constants (#3391) 2020-11-08 10:07:24 -05:00
Christian Mitteldorf 67165f7c64 Improve documentation for running SwiftLint as Xcode build phase 2020-11-08 09:11:02 -05:00
Marcelo Fabri 0e29701aba Merge pull request #3410 from realm/mf-bugfix-3398
Fix false positive in `toggle_bool` rule
2020-11-08 05:23:57 -08:00
Marcelo Fabri f2e12c3db5 Merge pull request #3409 from realm/mf-1082
Validate closures outside of function calls in unused_closure_parameter
2020-11-08 05:19:50 -08:00
Marcelo Fabri 551cf2da3c Fix false positive in toggle_bool rule 2020-11-08 04:57:59 -08:00
Marcelo Fabri 7ccda8eb23 Validate closures outside of function calls in unused_closure_parameter
Fixes #1082
2020-11-08 04:47:35 -08:00
Marcelo Fabri 1172ab5730 Merge pull request #3408 from realm/mf-prefer_nimble
Add prefer_nimble opt-in rule
2020-11-08 04:39:45 -08:00
Marcelo Fabri c8596a647a Add prefer_nimble opt-in rule
Fixes #3293
2020-11-08 00:09:51 -08:00
Seth Friedman 6d77deb359 Use working directory as root path instead of trying to calculate it (#3384)
We currently try to derive the root path by using the path passed in. However, this doesn't allow us to actually get the root, just the containing directory of the path passed in. We also don't currently have a heuristic to use for deriving the root path for multiple paths passed in.

The fix (which fixes #3383) is to remove our root path calculation and just use the current working directory as the root instead.
2020-11-07 23:51:44 -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
Seth Friedman e316bd693d Fix finding the nested config when a single file path is passed (#3379)
This was previously attempted in #3342, but produced a bug in the case where `--config` is used to specify a config from outside of the source tree. The `--config` argument wasn't always being used as an override, and was being merged with the config in the source tree. This has now been addressed and reverts the revert done in #3362. 

Fixes #3341
2020-11-07 23:07:03 -05:00
JP Simard 6c5a850c25 Exempt rule requests from being closed as stale 2020-11-07 22:12:26 -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
Seth Friedman 812e9dd950 Add stale probot config (#3385) 2020-11-07 20:18:53 -05:00
JP Simard 0465d3984a Fix changelog entry location 2020-11-07 20:13:30 -05:00
Zev Eisenberg 87bf6c6a6b Fix convenience type false positives (#3062) 2020-11-07 20:12:09 -05:00
Iulian Onofrei bed8591e65 Fix incorrect regex patterns in README files (#3393) 2020-11-07 20:08:27 -05:00
JP Simard 390e9a2423 Remove UnneededNotificationCenterRemovalRule (#3407)
See https://github.com/realm/SwiftLint/issues/3338 for detailed
motivation.
2020-11-07 18:59:33 -05:00
Paul Taykalo 693ee2cae9 Add Isnot Empty extension in the Swift Framework (#3387) 2020-11-07 18:42:55 -05:00
Dalton Claybrook 580314d21e 'nslocalizedstring_key' now validates the comment argument in addition to the key argument (#3373) 2020-11-07 18:10:30 -05:00
JP Simard c8d8d913b9 Fix incorrect violation message for line length violations (#3406) 2020-11-07 18:01:04 -05:00
Quinn Taylor 865b59f0c8 Fix some missed cases in rule unavailable_function. (realm#3374) (#3375) 2020-11-07 17:36:26 -05:00
JP Simard 35ad3f941c Add 5.3.1 to testDetectSwiftVersion() 2020-11-07 16:58:12 -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
Cihat Gündüz 81942449d3 Adjust --strict to treat warnings as errors instead of only altering exit code (#3372) 2020-11-07 15:47:38 -05:00
JP Simard b005920cc5 Improve compilation times (#3404)
By speeding up a handful of the longest expressions to compile.
2020-11-07 12:16:25 -08:00
Mikhail Monakov fc0092dc8c Add excluding by prefix option (#3345)
As we discussed here https://github.com/realm/SwiftLint/pull/3325 sometimes current excluding algorithm maybe slower than excluding paths by absolute prefix. So I added option for such cases.

Based on what I've checked it works faster for next scenarios:
- the number of input files is relatively small (e.g. when using `use-script-input-files`) and excluded directories contain relatively big number of lintable files
- the number of excluded directories relatively small (e.g. Pods + ThirdParty) and globs not used
2020-11-07 10:54:06 -08: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
Keith Smiley 05344f5fed Fix DuplicateImportsRule's support for import attributes (#3402)
* Fix DuplicateImportsRule's support for import attributes

* update changelog

* Fix changelog
2020-11-05 10:45:01 -08:00
Keith Smiley 51084adf82 Remove @IBOutlet and @IBInspectable from UnusedDeclarationRule (#3184) 2020-11-05 08:21:54 -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
Iulian Onofrei 1950abb3b7 Fix incomplete example (#3396) 2020-10-28 12:45:00 -07:00
5308e0d167 Improve CONTRIBUTING.md (#3394)
* Improve "Working Directory" instructions in CONTRIBUTING.md (#1280)

The instruction wasn't clear to me and it took me some time to figure out what to insert into the "Working Directory" option.

Co-Authored-By: oonoo <2565796+oonoo@users.noreply.github.com>

* Improve "Arguments Passed On Launch" instructions in CONTRIBUTING.md (#1280)

I wasn't sure which arguments could be passed to SwiftLint. I referenced the Command Line paragraph in the README, it already lists the available arguments.

Co-Authored-By: oonoo <2565796+oonoo@users.noreply.github.com>

* Add more details to "Submodules" in CONTRIBUTING.md (#1280)

The reason to checkout git submodules wasn't mentioned. I added the use cases for submodules, as Swift Package Manager doesn't make use of the git submodules.

* Format "Using Xcode" in CONTRIBUTING.md (#1280)

Limit line length to 80 characters in "Using Xcode" section of CONTRIBUTING.md.

* Document changes in CHANGELOG.md (#1280)

* Add missing word

Co-authored-by: oonoo <2565796+oonoo@users.noreply.github.com>
Co-authored-by: JP Simard <jp@jpsim.com>
2020-10-27 10:33:08 -07:00
hank121314 9afc3bbfd9 [Fix] UnusedCaptureListRule: unowned self in @escaping closures (#3392)
* [Fix] `UnusedCaptureListRule`: should also handle unowned self
* [Docs] `CHANGELOG.md`: update.
2020-10-24 21:10:18 +03:00
Paul Taykalo 662db7be39 Fix correct .zero autocorrection (#3386) 2020-10-19 14:27:47 -07:00
Keith SmileyandJP Simard 5d6e25ae5f Add TestCaseAccessibilityRule (#3376)
Co-authored-by: JP Simard <jp@jpsim.com>
2020-10-12 08:59:45 -07:00
Sven Münnich da408b5901 Fix some false positives in rule explicit_self (#3368) 2020-09-25 09:23:03 -07:00
JP Simard 15c25abc47 Update SourceKitten to 0.30.1 (#3367) 2020-09-23 08:34:46 -07:00
JP Simard 2731f994d8 Fix issues with analyzer rules, Xcode 12 & SwiftUI (#3366)
We weren't properly handling some new Xcode 12 compiler logs.

We also were marking declarations used by SwiftUI as unused
(`@main` and preview providers).
2020-09-23 07:15:54 -07:00
JP Simard 1ff293888b Add empty changelog section 2020-09-22 17:43:48 -04:00
JP Simard 4f8b7a5f48 release 0.40.3 0.40.3 2020-09-22 17:22:18 -04: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 494796b526 [UnusedDeclarationRule] Work around SR-11985 (#3363) 2020-09-22 10:00:16 -07:00
JP Simard a67b0f26e7 Revert "Fix finding the nested config when a single file path is passed (#3342)" (#3362)
This reverts commit ea06b79e0d.
2020-09-22 08:30:52 -07:00
JP Simard 774267c436 [CONTRIBUTING] Add building & running tips (#3360)
* [CONTRIBUTING] Add building & running tips

* fixup! [CONTRIBUTING] Add building & running tips
2020-09-22 10:44:11 -04:00
Seth Friedman ea06b79e0d Fix finding the nested config when a single file path is passed (#3342)
Fixes #3341

When SwiftLint searches for nested configurations and only one file has been passed in via the `paths` argument, SwiftLint returns early after inadvertently comparing the containing directory of the file-to-be-linted to itself. This happens because `rootDirectory` is calculated from `rootPath`, which is set to the file being linted in this scenario.
2020-09-22 07:24:52 -07:00
Seth Friedman 7db31658cb Include Linux zip in list of GitHub release binaries (#3350)
* Include Linux zip in list of GitHub release binaries

This matches what has been included in recent releases.

* Fix one more Linux zip reference

* Use all 1s for the numbered list in Releasing.md

Markdown renders the numbered list correctly, and this way one can easily reorder the steps
or add new steps without needing to renumber everything.
2020-09-22 07:01:55 -07:00