5105 Commits

Author SHA1 Message Date
Przemysław Olszacki 79c30afefa Implement baseline functionality 2020-11-09 22:23:38 +02:00
JP Simard ddfba6ea5d Fix duplicate changelog entry 2020-11-09 13:16:29 -05:00
JP Simard d319ad1c8b Merge pull request #1645 from Skoti/feature/distinguish_types_and_statements_nesting
Separating level counting for types and functions in `nesting` rule.
2020-11-09 12:56:17 -05:00
JP Simard 6c370caa77 Fix indentation 2020-11-09 12:06:45 -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
JP Simard 0788cd237c Format changelog entries 2020-11-09 12:06:34 -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
JP Simard 474cb2bd29 Reword changelog entry 2020-11-09 12:05:15 -05:00
JP Simard 5e23fbdd3e Merge pull request #3418 from agarmash/unavailable_function_never
Rule Modification: Don't trigger `unavailable_function` for a function that returns `Never`
2020-11-09 12:03:46 -05:00
Artem Garmash d1d42a9a35 Fix tests 2020-11-09 17:17:38 +03:00
Artem Garmash 7b1175511e Update changelog 2020-11-09 12:28:50 +03:00
Artem Garmash b679b8d75c Add check for return type Never 2020-11-09 12:18:42 +03:00
JP Simard fced10f61b Remove Xcode project & drop Carthage support (#3414)
* Remove Xcode project & Drop Carthage Support

Xcode has supported Swift Package Manager projects natively since Xcode
11, which has been out for over a year, where you can use Xcode by
having it open the `Package.swift` manifest rather than a `.xcodeproj`
or `.xcworkspace`.

I've been primarily developing SwiftLint in Xcode using this approach
for over a year, and despite a few nitpicks I have, it's been a joy to
use.

So I'd like to completely remove the Xcode project along with things
that support it:

* `SwiftLint.xcworkspace`/`SwiftLint.xcodeproj`: Neither of these are
  needed if we use `xed .` or `xed Package.swift` to develop SwiftLint
  in Xcode.
* `Cartfile`/`Cartfile.private`/`Cartfile.resolved`/`.gitmodules`/`Carthage/`:
  These were used to manage dependencies as git submodules for use in
  the Xcode workspace, but that's no longer necessary if Xcode delegates
  to SwiftPM to manage dependencies for us.
* Some scripts can be simplified, cleaned up or even completely removed.

* **Reduce duplication:** Rather than update dependencies or files in
  multiples places, there will only be the package manifest and the
  Podfile
* **Reduce merge conflicts:** This hasn't been too bad, but it's
  occasionally a pain when trying to land old PRs
* **Reduce development overhead:** No need to manually make sure that
  files in the Xcode project are sorted alphabetically
* **Reduce clone time:** No need to run
  `git submodules update --init --recursive` anymore

I think this breaks Carthage users that pull in SwiftLintFramework as a
dependency in a Cartfile.

However I can't find any references to [`SwiftLintFramework` in any
`Cartfile` files on GitHub](https://github.com/search?q=swiftlintframework+filename%3ACartfile&type=Code&ref=advsearch&l=&l=)
so this doesn't appear to be worth continuing to maintain.

Resolves https://github.com/realm/SwiftLint/issues/3412
2020-11-08 14:42:41 -05:00
JP Simard f365dfd1d0 Duplicate Array+SwiftLint.swift rather than symlink 2020-11-08 14:06:09 -05:00
JP Simard 76708d88f7 Remove Xcode project & Drop Carthage Support
Xcode has supported Swift Package Manager projects natively since Xcode
11, which has been out for over a year, where you can use Xcode by
having it open the `Package.swift` manifest rather than a `.xcodeproj`
or `.xcworkspace`.

I've been primarily developing SwiftLint in Xcode using this approach
for over a year, and despite a few nitpicks I have, it's been a joy to
use.

So I'd like to completely remove the Xcode project along with things
that support it:

* `SwiftLint.xcworkspace`/`SwiftLint.xcodeproj`: Neither of these are
  needed if we use `xed .` or `xed Package.swift` to develop SwiftLint
  in Xcode.
* `Cartfile`/`Cartfile.private`/`Cartfile.resolved`/`.gitmodules`/`Carthage/`:
  These were used to manage dependencies as git submodules for use in
  the Xcode workspace, but that's no longer necessary if Xcode delegates
  to SwiftPM to manage dependencies for us.
* Some scripts can be simplified, cleaned up or even completely removed.

* **Reduce duplication:** Rather than update dependencies or files in
  multiples places, there will only be the package manifest and the
  Podfile
* **Reduce merge conflicts:** This hasn't been too bad, but it's
  occasionally a pain when trying to land old PRs
* **Reduce development overhead:** No need to manually make sure that
  files in the Xcode project are sorted alphabetically
* **Reduce clone time:** No need to run
  `git submodules update --init --recursive` anymore

I think this breaks Carthage users that pull in SwiftLintFramework as a
dependency in a Cartfile.

However I can't find any references to [`SwiftLintFramework` in any
`Cartfile` files on GitHub](https://github.com/search?q=swiftlintframework+filename%3ACartfile&type=Code&ref=advsearch&l=&l=)
so this doesn't appear to be worth continuing to maintain.

Resolves https://github.com/realm/SwiftLint/issues/3412
2020-11-08 13:32:07 -05:00
JP Simard b2b95cf403 Require Swift 5.2 or higher to build (#3413)
Swift 5.2 has been officially released for over 7 months now, there's no
reason to keep supporting earlier versions when _building_ SwiftLint.

However, SwiftLint still supports _linting_ back up to Swift 3.0.
2020-11-08 13:31:29 -05:00
JP Simard 2950826bb1 Add helpful comment 2020-11-08 12:55:57 -05:00
JP Simard 2d94feee86 Add deployment targets to iOS/macOS/watchos/tvos 2020-11-08 12:39:21 -05:00
JP Simard 45f7aaa961 Update CryptoSwift to 1.3.2 2020-11-08 12:30:59 -05:00
JP Simard f2c9a55811 Add empty changelog section 2020-11-08 12:30:50 -05:00
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