Danny Mösch
3ec9bc85bc
Inline variables
2023-06-18 12:01:28 +02:00
Danny Mösch
f5ea2492dc
Merge allowed symbols with alphanumerics where possible
2023-06-18 12:01:28 +02:00
Danny Mösch
b89e43a799
Make sure case check can be disabled by new `off` option value ( #5064 )
2023-06-17 22:27:57 +02:00
Danny Mösch
c8cd311615
Collapse conditional statements into single expression
2023-06-13 23:24:48 +02:00
Danny Mösch
ba42a6aa36
Extract examples
2023-06-13 23:24:48 +02:00
Danny Mösch
83ab977a1b
Introduce visitor that tracks declared variables while traversing the AST
2023-06-13 23:24:48 +02:00
Danny Mösch
f12b8d66d3
Do not trigger `prefer_self_in_static_references` rule on collection types ( #5055 )
2023-06-12 16:40:45 -04:00
JP Simard
e29de7a99f
Update Bazel dependencies ( #5060 )
...
* rules_apple: 2.2.0 -> 2.3.0
* rules_swift: 1.7.1 -> 1.8.0
* rules_xcodeproj: 1.5.1 -> 1.7.0
2023-06-12 15:58:41 -04:00
JP Simard
d32bf2b879
Update CryptoSwift ( #5059 )
...
Diff: https://github.com/krzyzanowskim/CryptoSwift/compare/1.7.1...1.7.2
2023-06-12 19:23:33 +00:00
JP Simard
e5cf99088b
Update SwiftSyntax to 509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-06-05-a ( #5058 )
...
Diff: https://github.com/apple/swift-syntax/compare/509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-05-02-a...509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-06-05-a
2023-06-12 15:22:17 -04:00
JP Simard
7462187191
Add 5.9 to Swift version tests ( #5057 )
...
This gets all tests passing with Xcode 15 beta 1.
2023-06-12 18:39:18 +00:00
Danny Mösch
23326fc433
Specify default options in configurations only ( #5056 )
2023-06-11 10:44:06 -07:00
woxtu
156f6aabc8
Fix false positives in `sorted_first_last` rule when `first`/`last` have a predicate ( #5038 )
2023-06-11 17:22:06 +02:00
woxtu
43190834c5
Fix `legacy_random` examples ( #5047 )
2023-06-10 23:53:45 +02:00
woxtu
f1d5a55658
Fix typo ( #5044 )
2023-06-10 23:50:49 +02:00
woxtu
c735e6320f
Add Swift version 5.8.1 ( #5050 )
2023-06-05 16:52:35 +00:00
woxtu
2f9997e2cc
Fix typos ( #5033 )
2023-05-25 23:58:29 +02:00
woxtu
8f3eea06d3
Fix include path for custom `rule_id` rule ( #5031 )
2023-05-24 00:36:00 +02:00
woxtu
a53a1f052b
Fix links to rules directory ( #5029 )
2023-05-22 21:37:48 +02:00
Danny Mösch
704c9ae116
Move ViolationsSyntaxVisitor into its own file ( #5028 )
2023-05-22 07:35:46 -04:00
Martin Redington
521df18fdb
Fix false alarms in `redundant_objc_attribute` rule ( #4742 )
2023-05-20 21:45:27 +02:00
Danny Mösch
a2ba0a0626
Omit "Rule" in configuration names ( #5024 )
2023-05-20 04:39:04 -04:00
Hilton Campbell
1094a3b70e
Add `grouping` option to the `sorted_imports` rule ( #4935 )
2023-05-19 15:49:07 -04:00
Haocen Jiang
754127924f
Update replacement for CGRectIntersection ( #5023 )
2023-05-19 15:17:14 -04:00
Danny Mösch
3f039f26d5
Connect configs with their referencing rules to have some context in error logging ( #5017 )
...
With the binding of configurations to their associated rule types
"unknown configuration" errors can be made more specific mentioning
also the rule's identifier in the printed message.
2023-05-19 20:58:24 +02:00
Danny Mösch
671589b1d4
Let configuration names match rule names ( #5021 )
2023-05-18 12:04:39 -04:00
Danny Mösch
d938b2d3c3
Specify default options in configurations only ( #5020 )
2023-05-18 17:21:30 +02:00
Danny Mösch
7fd22e0d6e
Use `SeverityBasedRuleConfiguration` where possible ( #5019 )
2023-05-18 16:04:20 +02:00
JP Simard
07740506b5
Automate adding a new changelog section after releasing ( #5016 )
2023-05-17 10:36:31 -04:00
kid cherish
26d06bcebb
[Update] Add Code Line in README_KR.md ( #5015 )
2023-05-17 07:05:37 +02:00
Danny Mösch
fe312a06fe
Rely on pre-defined issues and allow to print them directly to the console ( #5013 )
...
Advantages of having typical errors at a common place:
* Error message styling can be harmonized
* Existing messages can be reused
* Overview of prefixes ('error: ', 'warning: ')
* Manage how to print them to the console
2023-05-16 20:15:14 +02:00
Danny Mösch
d73970e9d7
Remove error wrapper ( #5008 )
2023-05-16 18:22:25 +02:00
Danny Mösch
c0ea9d1925
Do not trigger `prefer_self_in_static_references` rule on `typealias` in classes ( #5012 )
2023-05-15 14:07:21 -04:00
Danny Mösch
405113f793
Open ConfigurationError up to be used more broadly ( #5005 )
2023-05-14 20:00:46 +02:00
Danny Mösch
f4987071f0
Extract configuration into its own file ( #5007 )
2023-05-14 13:05:36 -04:00
Danny Mösch
306dec0fcc
Disable `no_fallthrough_only` in favor of simultaneously active `fallthrough` ( #5006 )
...
Avoids two violation when using `fallthrough`.
2023-05-14 15:55:02 +00:00
Danny Mösch
4d4a330d46
Silence `xct_specific_matcher` rule on types and tuples used in "one argument asserts" ( #4997 )
2023-05-13 22:04:35 +02:00
JP Simard
1e73835e83
Remove dead code ( #5004 )
...
Identified with the upcoming improved dead code detection.
2023-05-12 14:20:31 -04:00
JP Simard
866001db2f
Add new changelog section
2023-05-12 11:05:45 -04:00
JP Simard
34f5ffa7f7
release 0.52.2
2023-05-12 11:02:03 -04:00
JP Simard
1b1b19a902
Fix some `unhandled_throwing_task` false positives ( #5001 )
...
Fixes some of the cases reported in
https://github.com/realm/SwiftLint/issues/4987
2023-05-12 10:35:59 -04:00
JP Simard
15a18fd4e8
Merge `make release` with `make publish` ( #5003 )
...
To simplify the release process.
2023-05-12 09:58:06 -04:00
JP Simard
5802fd99b1
Parallelize TSan tests on CI ( #5002 )
2023-05-12 09:54:27 -04:00
JP Simard
e7bf813f15
Make `unhandled_throwing_task` rule opt-in ( #5000 )
...
Because since it was included in a release a few days ago, we've had
several reports of false positives and so flipping to opt-in is
appropriate so users can determine for themselves if they should enable
the rule.
2023-05-12 09:46:07 -04:00
Danny Mösch
3cf9585b2e
Exclude `self.x = x` from being reported in the `redundant_self_in_closure` rule ( #4996 )
2023-05-11 23:26:39 +02:00
JP Simard
8827fca693
Automate GitHub Release Creation ( #4995 )
...
* Add `tools/generate-release-notes.sh` script
* Add `tools/create-github-release.sh` script
* Update `Releasing.md`
2023-05-11 14:01:29 -04:00
Marcelo Fabri
9f7c57b719
Make id and isVirtual public in SwiftLintFile ( #4994 )
2023-05-11 13:33:48 -04:00
JP Simard
73acbaf6d5
Add new changelog section
2023-05-11 11:26:23 -04:00
JP Simard
5616d858bc
release 0.52.1
2023-05-11 11:13:58 -04:00
JP Simard
6cdb0aa689
Update `make publish`
...
To use the CocoaPods version from bundler and to remove the stale
workaround.
2023-05-11 11:03:28 -04:00
JP Simard
7483e61615
Fix Bazel release tarball for compiling on macOS ( #4992 )
...
Fixes #4985
2023-05-11 10:59:02 -04:00
Kyle Bashour
87e230ce87
Fix false positive when result is accessed ( #4986 )
2023-05-10 20:36:00 -04:00
JP Simard
7f3b93147a
Update Gemfile.lock ( #4983 )
...
This happened automatically when I ran `bundle install` locally.
2023-05-10 17:23:50 -04:00
JP Simard
7501d44b69
Add new changelog section
2023-05-10 16:46:19 -04:00
Danny Mösch
0ffe0c5911
Extract tests for NameConfiguration
2023-05-10 22:20:30 +02:00
Danny Mösch
c99a4286b8
Let `validates_start_with_lowercase` option in name configurations expect a severity
2023-05-10 22:20:30 +02:00
Danny Mösch
8d5700afca
Remove deprecation warning in `identifier_name` rule
...
It was introduced 6 years ago.
2023-05-10 22:20:30 +02:00
Danny Mösch
1fa8e484c4
Add expiring TODO comments on deprecation warnings
2023-05-10 21:44:20 +02:00
Danny Mösch
9e15e37255
Disable `todo` in favor of `expiring_todo`
2023-05-10 21:44:20 +02:00
JP Simard
97259e24d0
release 0.52.0
2023-05-10 15:15:09 -04:00
JP Simard
eb6d50a04c
Update SwiftSyntax to 509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-04-25-b ( #4982 )
2023-05-10 15:02:58 -04:00
Danny Mösch
9c1678968f
Remove deprecation warnings introduced > 2 years ago ( #4972 )
2023-05-10 14:05:28 -04:00
JP Simard
fa32fbc4f0
Minor edits to `unhandled_throwing_task` changelog entry
...
And rule description.
2023-05-10 14:04:42 -04:00
Kyle Bashour
8822d40687
Add `unhandled_throwing_task` rule ( #4958 )
...
This rule will check Task's that are not explicitly annotated with success and
failure types for unhandled try expressions. These trys will silently fail if an
error is thrown.
See this forum thread for more details:
https://forums.swift.org/t/task-initializer-with-throwing-closure-swallows-error/56066
2023-05-10 14:03:01 -04:00
JP Simard
c0cf1bf5c9
Add changelog entry for module split
2023-05-10 13:23:32 -04:00
JP Simard
444653bfd5
Update bazel version to 6.2.0 ( #4981 )
2023-05-10 16:25:34 +00:00
Danny Mösch
9138213121
Mark change as breaking ( #4969 )
2023-05-06 20:46:43 +00:00
Danny Mösch
6fd5f98d38
Add examples for weak variables to `implicitly_unwrapped_optional` rule
2023-05-06 22:46:25 +02:00
Danny Mösch
bc18ff14e3
Add violation markers
2023-05-06 22:46:25 +02:00
Andyy Hope
5e15039554
Move `excludedPaths` out of iteration loop to speed up lint times ( #4955 )
2023-05-06 16:43:33 -04:00
Danny Mösch
7756793356
Add new option to `attributes` rule to influence it for attributes with arguments ( #4855 )
2023-05-05 16:12:01 -04:00
Danny Mösch
f0138ea1df
Add example to proof that shorthand optional bindings work with `unused_declaration` rule ( #4857 )
2023-05-05 15:22:59 -04:00
Danny Mösch
6a2e973de3
Add new `redundant_self_in_closure` rule ( #4911 )
2023-05-05 21:14:14 +02:00
JP Simard
e86c06c390
[SwiftLintCore] Make `focused()` public ( #4959 )
...
So it can be used from SwiftLintBuiltInRules.
I missed this when splitting the SwiftLintFramework module.
2023-05-04 15:07:37 +00:00
JP Simard
6b094dd711
[SwiftSyntax] Update to latest 509.0.0 tag ( #4920 )
...
* [bazel] Remove custom SwiftSyntax BUILD file
Something similar to this has been merged upstream instead now. This
also renames the repo name to SwiftSyntax in preparation for it being in
the BCR
* [SwiftSyntax] Update to latest 509.0.0 tag
https://github.com/apple/swift-syntax/releases/tag/509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-04-25-b
2023-05-03 11:34:26 -04:00
Simon Støvring
9054ec0658
Add test verifying that the `file_header` rule can require an empty file header ( #4928 )
2023-05-01 18:47:37 +02:00
Chris White
71b89e66de
Prepend `warning: ` to error messages ( #4927 )
2023-05-01 18:26:25 +02:00
JP Simard
a7bc9e20c7
Move built-in rules to new SwiftLintBuiltInRules module ( #4950 )
2023-04-27 11:16:01 -04:00
JP Simard
eaf34d7204
Move extra rules into its own module ( #4949 )
...
This will decouple building extra rules from built-in rules so that
making changes in one of those modules doesn't rebuild the other.
2023-04-27 10:37:30 -04:00
JP Simard
86d60400c1
Move core SwiftLint functionality to new SwiftLintCore module
...
Over the years, SwiftLintFramework had become a fairly massive monolith,
containing over 400 source files with both core infrastructure and
rules.
Architecturally, the rules should rely on the core infrastructure but
not the other way around. There are two exceptions to this:
`custom_rules` and `superfluous_disable_command` which need special
integration with the linter infrastructure.
Now the time has come to formalize this architecture and one way to do
that is to move the core SwiftLint functionality out of
SwiftLintFramework and into a new SwiftLintCore module that the rules
can depend on.
Beyond enforcing architectural patterns, this also has the advantage of
speeding up incremental compilation by skipping rebuilding the core
functionality when iterating on rules.
Because the core functionality is always useful when building rules, I'm
opting to import SwiftLintCore in SwiftLintFramework as `@_exported` so
that it's implicitly available to all files in SwiftLintFramework
without needing to import it directly.
In a follow-up I'll also split the built-in rules and the extra rules
into their own modules. More modularization is possible from there, but
not planned.
The bulk of this PR just moves files from `Source/SwiftLintFramework/*`
to `Source/SwiftLintCore/*`. There are some other changes that can't be
split up into their own PRs:
* Change jazzy to document the SwiftLintCore module instead of
SwiftLintFramework.
* Change imports in unit tests to reflect where code was moved to.
* Update `sourcery` make rule to reflect where code was moved to.
* Create a new `coreRules` array and register those rules with the
registry. This allows the `custom_rules` and
`superfluous_disable_command` rule implementations to remain internal
to the SwiftLintCore module, preventing more implementation details
from leaking across architectural layers.
* Move `RuleRegistry.registerAllRulesOnce()` out of the type declaration
and up one level so it can access rules defined downstream from
SwiftLintCore.
2023-04-26 21:10:19 -04:00
JP Simard
740572f049
Move `Version.swift` to SwiftLintCore
2023-04-26 21:10:19 -04:00
JP Simard
3541ef4d02
Import SwiftLintCore in generated tests
...
In preparation for it containing the `superfluous_disable_command` rule.
2023-04-26 21:10:19 -04:00
JP Simard
39a05f2c35
Re-export SwiftLintCore import in SwiftLintFramework
...
Because the core functionality is always useful when building rules, I'm
opting to import SwiftLintCore in SwiftLintFramework as `@_exported` so
that it's implicitly available to all files in SwiftLintFramework
without needing to import it directly.
2023-04-26 21:10:19 -04:00
JP Simard
711d92e26f
Add empty SwiftLintCore module
...
Source files will be added to it in a follow-up commit.
2023-04-26 21:10:19 -04:00
JP Simard
d8dfc3c937
Update rules_xcodeproj to 1.5.1 ( #4948 )
...
Lots of performance optimizations in this release
https://github.com/MobileNativeFoundation/rules_xcodeproj/releases/tag/1.5.1
2023-04-26 21:06:17 -04:00
JP Simard
3a2bb15ca3
Make some SwiftLintFramework declarations public ( #4945 )
...
* Make some SwiftLintFramework declarations public
If built-in rules depend on them.
This will allow separating the rules from the core infrastructure in
separate modules in an upcoming PR.
It also helps formalize the API contract for what should be accessible
to rule implementations.
* Exclude extensions from jazzy
2023-04-26 16:37:25 -04:00
JP Simard
a7e3909c6a
Improve StyleViolation reason formatting validation ( #4946 )
...
So it checks violations for all rules in the registry, not just the
built-in rules.
2023-04-26 18:54:44 +00:00
JP Simard
72c2a5488d
Re-order `CustomRules.swift` ( #4944 )
...
For consistency with other files in this project, which usually have
private extensions at the bottom of the file.
2023-04-26 18:37:40 +00:00
JP Simard
ea56405983
Rename `Request.cursorInfo()` to `cursorInfoWithoutSymbolGraph()` ( #4943 )
...
To avoid conflicting with the `cursorInfo` declared in
SourceKittenFramework.
2023-04-26 18:28:24 +00:00
JP Simard
9c414932d8
Add more documentation comments ( #4942 )
...
In preparation for these declarations to become public.
2023-04-26 14:18:13 -04:00
JP Simard
8a21549ca9
Change `Reachability` to an enum ( #4941 )
...
Since it's already acting as a namespace, might as well make it so it
can't be instantiated and can't have instance properties.
2023-04-26 13:55:17 -04:00
JP Simard
4abcf5f0dd
Remove `SwiftLintFramework` dependency from GeneratedTests target ( #4940 )
...
Since it's available transitively from SwiftLintTestHelpers.
2023-04-26 16:37:23 +00:00
JP Simard
b2a4c9fcb9
Mark `RulesFilter` as `final class` ( #4939 )
...
Since it's not designed to be subclassed.
2023-04-26 16:26:22 +00:00
JP Simard
603fff9a82
Make `Correction` and `CorrectableRule` declarations public ( #4937 )
...
The CLI target shouldn't be importing SwiftLintFramework with
`@_spi(TestHelper)`. If the CLI target needs to access something in
SwiftLintFramework, that declaration should be `public`.
2023-04-26 12:17:10 -04:00
JP Simard
2544dc79d3
Move `CustomRuleTimer` to its own file ( #4938 )
...
And add docs.
2023-04-26 15:56:04 +00:00
Kris Kline
ea6b3b4d64
Update minimum OS versions for Xcode 14.3 ( #4934 )
...
* iOS - 11.0
* MacOS - 10.13
* tvOS - 11.0
* WatchOS - 7.0
2023-04-25 19:51:36 +00:00
Benny Wong
172b8b8a94
Remove `else else` typo ( #4933 )
2023-04-25 18:03:25 +00:00
JP Simard
4c04cdafa7
Introduce SwiftLintTestCase
...
To consistently set up rules before tests
2023-04-25 12:28:50 -04:00
JP Simard
165172e0fa
Introduce a "rule registry" concept
...
This will allow for registering rules that aren't compiled as part of
SwiftLintFramework.
Specifically this will allow us to split the built-in and extra rules
into separate modules, leading to faster incremental compilation when
working on rules since the rest of the framework won't need to be
rebuilt on every compilation.
2023-04-25 12:28:50 -04:00
JP Simard
3f52acd0a2
Make `UnitTestRuleConfiguration` internal ( #4931 )
2023-04-25 13:28:28 +00:00
JP Simard
e14a73438f
Remove SourceKitten from OSSCheck ( #4930 )
...
It looks like there's some non-determinism in how we lint it that was
recently introduced, maybe it's due to some SwiftSyntax update, not
sure.
2023-04-25 09:27:24 -04:00
JP Simard
817de197d5
Clean up `MARK` comments
2023-04-24 15:13:44 -04:00
JP Simard
214a749ace
Extend the custom rules section in the README ( #4926 )
...
To link to a video tutorial and example project for creating custom
rules written in Swift and to outline some of the advantages to using
these over regex custom rules.
2023-04-24 17:04:56 +00:00
JP Simard
fd4f9afb08
Remove AppCode section in README.md ( #4925 )
...
> AppCode is no longer available as a commercial product as of
> December 14, 2022.
From https://blog.jetbrains.com/appcode/2022/12/appcode-2022-3-release-and-end-of-sales-and-support/
2023-04-24 12:44:49 -04:00
Danny Mösch
c241935635
Introduce basic Stack type ( #4922 )
2023-04-23 09:12:35 +00:00
JP Simard
46ff727a13
Update Bazel version to 6.1.2 ( #4918 )
2023-04-21 17:00:53 -04:00
JP Simard
dc89109622
Apply suggested bazel flags ( #4917 )
2023-04-21 16:51:14 -04:00
JP Simard
9c2525139a
Update CryptoSwift to 1.7.1 ( #4916 )
...
To fix Swift 5.8 warnings
2023-04-21 14:15:44 +00:00
JP Simard
d601917e40
Apply minor changelog edits
2023-04-21 09:25:11 -04:00
YoungBin Lee
498b4c8fbe
Correct organization name in README files ( #4913 )
...
Rename 'Ray Wenderlich' to 'Kodeco'.
2023-04-21 05:16:13 +00:00
Danny Mösch
69fadb6918
Remove no-op initializers from structs ( #4912 )
2023-04-20 11:59:37 +02:00
JP Simard
f866ec32b1
Add link to video tutorial demonstrating how to write a rule ( #4910 )
...
https://vimeo.com/819268038
2023-04-19 17:16:27 -04:00
JP Simard
6d51459323
Update Ruby Gems ( #4909 )
...
* danger: 8.6.1 -> 9.2.0
* cocoapods: 1.11.3 -> 1.12.1
* jazzy: 0.14.2 -> 0.14.3
2023-04-19 10:23:21 -04:00
JP Simard
21dc766c93
Exclude new `XCTSpecificMatcherRule` examples from documentation ( #4907 )
2023-04-18 21:45:51 +00:00
JP Simard
0f802f766a
[CI] Remove `update_swift_syntax.yml` ( #4906 )
...
We now manually update SwiftSyntax as needed.
2023-04-18 21:35:43 +00:00
JP Simard
fbbccf9db8
Allow configuring `xct_specific_matcher` with matchers ( #4905 )
...
So that either `one-argument-asserts` or `two-argument-asserts` or both
can be enabled.
The following configuration effectively reverts back to the rule
behavior prior to https://github.com/realm/SwiftLint/pull/3858 :
```yaml
xct_specific_matcher:
matchers:
- two-argument-asserts
```
2023-04-18 20:50:58 +00:00
JP Simard
8b72eb0406
Mark `bazel_skylib` as `dev_dependency = True` ( #4904 )
...
So folks who integrate SwiftLint with Bazel don't need to match this
exact version.
2023-04-18 18:50:56 +00:00
JP Simard
c22d60fac0
Update `UnusedImportRuleExamples` for Swift 5.8 ( #4903 )
2023-04-18 17:58:40 +00:00
Keith Smiley
1892c846b0
Workaround dyld warning about SwiftSyntax classes ( #4901 )
...
This uses a recent but unannounced (also read as private) feature of
dyld where it ignores duplicate Objective-C classes when they're in a
special format in the binary. c8a445f88f/dyld/PrebuiltLoader.cpp (L1660-L1662)
I think this is generally safe because hopefully people aren't actually
using the SwiftSyntax classes through the Objective-C runtime, but if
they are we'd still probably prefer to silence the noise and accept the
UB.
Fixes https://github.com/realm/SwiftLint/issues/4782
2023-04-17 19:55:33 -04:00
Andrew Montgomery
41290a23d3
Remove checks for setUp/tearDown from `overridden_super_call` rule ( #4875 )
2023-04-17 20:18:41 +00:00
Frad LEE
5814ec1a1a
Add architecture detection to Xcode script configuration ( #4873 )
2023-04-17 18:48:06 +00:00
JP Simard
f9b0e9f0af
Update CryptoSwift to 1.7.0 ( #4899 )
2023-04-17 10:37:40 +00:00
Keith Smiley
3ef44cf742
Switch to SwiftPM conditional dependencies API ( #4003 )
...
This API allows us to mostly remove `#if` conditionals which enables
cross compilation from macOS -> Linux. It also removes the thrashing of
Package.resolved if you compile in a docker image.
2023-04-16 20:19:25 +02:00
Danny Mösch
5aed7ce95c
Check first argument label in `reduce_boolean` rule ( #4895 )
2023-04-16 09:58:27 +02:00
Martin Redington
97fd216455
Skip unit tests in `no_magic_numbers` rule ( #4897 )
2023-04-16 09:07:54 +02:00
Danny Mösch
f127ba14dd
Ignore block comments in `let_var_whitespace` rule ( #4889 )
2023-04-16 00:10:03 +02:00
JP Simard
74b82daba0
[CI] Use rbenv to manage Ruby ( #4893 )
...
And pin the Ruby version to 2.7.5. rbenv was installed on all CI
machines using Homebrew, with Ruby 2.7.5 installed and set as the
global version. The `pre-command` script was also updated on all agents
to add rbenv binaries to the path and run `rbenv init`.
Remove rules_ruby integration and just use rbenv and ruby directly.
2023-04-14 16:23:05 +00:00
JP Simard
8c617d7412
[CI] Update Azure Pipelines to run with Swift 5.8 ( #4890 )
...
Linux only because Azure Pipelines doesn't have any
images with macOS 13 or Xcode 14.3 yet.
2023-04-14 14:27:03 +00:00
JP Simard
a4f4680442
Update copyright year for html docs
2023-04-14 10:18:47 -04:00
JP Simard
62b2914271
Update rules_ruby ( #4891 )
...
Just to stay up to date.
2023-04-14 10:11:50 -04:00
JP Simard
1b0f37c6f6
Pin Sourcery version to 2.0.2 ( #4888 )
...
By adding a `tools/sourcery` script that downloads and runs Sourcery via
Bazel.
Previously, unrelated changes might include modifications to the
generated comment headers because contributors' local versions of
Sourcery would be used, which we don't control.
Also move the CI job to Buildkite where the bazel server is usually
already warmed up and running.
2023-04-13 20:09:26 +00:00
JP Simard
5226725689
Fix extra space before member access
2023-04-13 15:12:37 -04:00
JP Simard
e361e14c90
Move changelog entry to the latest section
2023-04-13 15:04:13 -04:00
JP Simard
70a56a1420
Update SwiftSyntax to 04-10 snapshot ( #4887 )
...
https://github.com/apple/swift-syntax/releases/tag/509.0.0-swift-5.9-DEVELOPMENT-SNAPSHOT-2023-04-10-a
2023-04-13 14:04:43 -04:00
Gabriel Féron
409f117da9
Use Ubuntu 20.04 to release Linux binaries ( #4882 )
...
* Use Ubuntu 20.04 to release Linux binaries
Using the latest version of Ubuntu leads to incompatibilities with `glibc` versions from LTS versions.
* Use Ubuntu 20.04 for Azure pipelines
2023-04-13 13:25:43 -04:00
JP Simard
7fe7bb28d9
Update rules_xcodeproj to 1.4.0 ( #4885 )
...
https://github.com/MobileNativeFoundation/rules_xcodeproj/releases/tag/1.4.0
2023-04-13 15:25:17 +00:00
Danny Mösch
bb11e6a0a7
Extract examples to separate file
2023-04-04 20:10:59 +02:00
Danny Mösch
eee97a7b2b
Trigger `prefer_self_in_static_references` rule on types
2023-04-04 20:10:59 +02:00
Danny Mösch
cf1e2e27dc
Use `is` instead of `as` for simple type checks
2023-04-04 20:10:59 +02:00
Sven Münnich
a2facce70c
Fix false positives related to multiline strings in `indentation_width` rule ( #4862 )
2023-04-04 19:27:16 +02:00
Danny Mösch
bd444fcd77
Fix `lower_acl_than_parent` rule rewriter by preserving leading whitespace ( #4861 )
2023-04-03 20:26:46 +00:00
Danny Mösch
ee849bcb10
Remove unused imports ( #4856 )
2023-04-03 19:26:59 +02:00
Danny Mösch
6d4bc78cb4
Add new `superfluous_else` rule ( #4696 )
2023-04-02 12:32:40 +02:00
Danny Mösch
16e2bb0f18
Extend `xct_specific_matcher` rule to check for boolean asserts on (un)equal comparisons ( #3858 )
2023-04-02 12:30:21 +02:00
Kim de Vos
b0cbb440c3
Add new `sorted_enum_cases` rule ( #4845 )
2023-04-02 11:33:20 +02:00
Danny Mösch
58a07eb452
Update SwiftSyntax ( #4852 )
2023-03-31 23:12:31 +02:00
Danny Mösch
82491e6f84
Add Swift version 5.8 ( #4851 )
2023-03-31 22:44:25 +02:00
Danny Mösch
3d15419adb
Fix warnings in Swift 5.8/Xcode 14.3 ( #4850 )
2023-03-31 22:13:20 +02:00
Martin Redington
6a09af169e
Fix crash when parsing apple/swift ( #4828 )
2023-03-31 20:59:47 +02:00
Martin Redington
7dad240ea7
Add a `reporters` subcommand ( #4836 )
2023-03-31 08:09:01 +02:00
Martin Redington
ca43d2359b
Fix unit test configuration ( #4847 )
2023-03-30 22:46:31 +02:00
JP Simard
da27f1c7fd
Add empty changelog section
2023-03-27 12:11:36 -04:00
JP Simard
eb85125a5f
release 0.51.0
2023-03-27 11:44:47 -04:00
JP Simard
62b9c2de7a
Don't run `make clean` automatically on `build`
...
Since when releasing, many steps depend on the `build`, so we don't want
to clean mid-way through releasing.
Explicitly run `make clean` at the start of `make release`.
2023-03-27 11:22:00 -04:00
JP Simard
aeee6325af
Update bazel dependencies ( #4842 )
...
* Update bazel from 6.0.0 to 6.1.1
* Update rules_apple from 2.0.0 to 2.2.0
* Update rules_swift from 1.5.1 to 1.7.1
* Update rules_xcodeproj from 1.1.0 to 1.3.3
2023-03-27 14:36:44 +00:00
Martin Redington
5a91b1e392
Fixed display of optin and correctable ( #4841 )
...
Co-authored-by: Martin Redington <mildm8nnered@gmail.com>
2023-03-27 07:48:51 +02:00
JP Simard
efc5afd5d5
Apply small formatting fixes ( #4840 )
...
* Trim excess trailing and vertical whitespace
* Move `SwiftyTextTable` dependency into `frameworkDependencies`
* Adjust wording in README around analyzer rules in the `opt_in_rules`
section, since analyzer rules can only go in the `analyzer_rules`
section.
2023-03-26 16:09:43 -04:00
Martin Redington
f2d15355be
Add a `summary` table reporter ( #4820 )
2023-03-25 08:28:42 +01:00
Martin Redington
a840058cf5
Add default.profraw to .gitignore and delete obsolete instructions ( #4835 )
...
Co-authored-by: Martin Redington <mildm8nnered@gmail.com>
2023-03-25 08:21:22 +01:00
dependabot[bot]
358bdc89a5
Bump activesupport from 6.1.7.1 to 6.1.7.3 ( #4824 )
...
Bumps [activesupport](https://github.com/rails/rails ) from 6.1.7.1 to 6.1.7.3.
- [Release notes](https://github.com/rails/rails/releases )
- [Changelog](https://github.com/rails/rails/blob/v7.0.4.3/activesupport/CHANGELOG.md )
- [Commits](https://github.com/rails/rails/compare/v6.1.7.1...v6.1.7.3 )
---
updated-dependencies:
- dependency-name: activesupport
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-24 15:27:01 -04:00
강수진
a81a532091
Fix SwiftLint rule count in Korean README ( #4832 )
2023-03-22 20:08:28 +01:00
Martin Redington
6983c813c8
Fix rewriter of `trailing_semicolon` rule wrongly removing trailing comments ( #4818 )
2023-03-13 22:23:35 +00:00
Danny Mösch
fb89ab2fb5
Stop triggering `unused_capture_list` on variables referenced in optional bindings
2023-03-12 14:38:10 +01:00
Danny Mösch
7ac128c83d
Enable `direct_return` rule in the repository
2023-03-12 14:36:07 +01:00
Danny Mösch
06578e5d91
Get rid of some more disabled commands
2023-03-12 00:03:02 +01:00
Danny Mösch
1940e0e2d2
Make custom rule `rule_id` more specific
2023-03-12 00:03:02 +01:00
Danny Mösch
bd77cbcf6e
Add example verifying that `trailing_semicolon` works with trailing comments ( #4808 )
2023-03-11 13:29:38 +00:00
Danny Mösch
1bf2f25e40
Get rid of some disabled commands ( #4807 )
2023-03-11 08:20:47 -05:00
Danny Mösch
7d7bee5eee
Disable deprecated rules ( #4806 )
2023-03-11 12:48:04 +00:00
Martin Redington
31510b662e
Use `all` optin rules facility for SwiftLint's own `.swiftlint.yml` ( #4800 )
2023-03-11 11:59:05 +01:00
Martin Redington
0bd8a7aba6
Add new `blanket_disable_command` rule ( #4731 )
2023-03-07 21:43:53 +01:00
Keith Smiley
084ad9dfd4
Remove unused _SwiftSyntaxMacros library ( #4802 )
...
This one was actually renamed to not have the underscore but it's not
used so we might as well drop it.
2023-03-07 17:54:46 +00:00
Martin Redington
228d53787b
Stop`superfluous_disable_command` from firing when disabled ( #4791 )
2023-03-05 19:21:35 +01:00
1in1
4fee8e6a0c
Add new `duplicate_conditions` rule ( #4771 )
2023-03-05 11:05:23 +01:00
Danny Mösch
4f9a608cf4
Remove duplicate line ( #4797 )
2023-03-04 13:12:59 +00:00
Martin Redington
1c3c62e422
Add new `invalid_swiftlint_command` rule ( #4546 )
2023-03-04 13:53:27 +01:00
Martin Redington
d6e3bbb64d
Add "all" pseudo-rule which enables all opt-in rules ( #4544 )
2023-03-04 13:49:00 +01:00
Danny Mösch
128f37a6b8
Fix whitespace issue in rewriter of `redundant_optional_initialization` rule ( #4795 )
2023-03-04 11:47:24 +00:00
Tony Arnold
cfd9a26e33
Ensure that configuration exclusion rules are respected by the build plugin ( #4757 )
...
We always pass all of the Swift source files in the target to the tool, so we need to ensure that any exclusion rules in the configuration are respected.
2023-03-02 22:26:49 +01:00
David Davies-Payne
a71f588637
Add instructions for disabling Xcode package validation ( #4751 )
2023-02-28 19:40:23 +00:00
Martin Redington
d73d87ac97
Add `include_multiline_strings` option to `indentation_width` rule ( #4785 )
2023-02-26 11:52:29 +01:00
Martin Redington
04791929a7
Improve `identifier_name` documentation ( #4784 )
2023-02-25 20:02:02 +01:00
Danny Mösch
c9b1b961f5
Fix some issues in `direct_return` rule ( #4783 )
2023-02-25 02:48:31 -05:00
Danny Mösch
613e916c39
Use parameter names in description ( #4781 )
2023-02-24 15:55:39 +00:00
JP Simard
e2f3f3ad45
Include `MODULE.bazel` in bazel release archive ( #4779 )
...
So it can be used with bzlmod.
2023-02-22 12:29:26 -05:00
JP Simard
5c94a43352
Update SourceKitten for Bazel without bzlmod ( #4778 )
...
Missed this in #4776 .
2023-02-20 22:32:58 +00:00
JP Simard
183c0aa784
Set `--platform linux/amd64` in `make zip_linux_release`
...
So it works on other architectures (e.g. Apple Silicon)
2023-02-20 17:00:48 -05:00
JP Simard
ed6793f8f1
Fix changelog whitespace formatting
2023-02-20 16:38:40 -05:00
JP Simard
1790ad56dd
Update SourceKitten & Yams ( #4776 )
2023-02-20 15:50:14 -05:00
JP Simard
2f0e537f9b
Update SwiftSyntax to latest development snapshot ( #4759 )
...
* Merge `spacedBinaryOperator` and `unspacedBinaryOperator`
* New contextual keyword enums
* Update for removed `UnavailabilityConditionSyntax`
* Handle how attributes are now defined
This partially reverts commit 325d0ee1e4
.
* Handle removal of `TokenListSyntax`
* Update `Package.swift`
* Extract some SwiftSyntax helpers
* Update to `0.50900.0-swift-DEVELOPMENT-SNAPSHOT-2023-02-06-a`
* Skip attributes with keypath arguments in `attributes` rule
To preserve the rule's existing behavior.
* Limit unowned_variable_capture violations to capture lists
* Add changelog entries
2023-02-20 10:51:31 -05:00
Danny Mösch
393318d903
Add new `direct_return` opt-in rule ( #4717 )
2023-02-19 13:09:41 +01:00
Danny Mösch
f3e5557de9
Stop triggering `strict_fileprivate` rule on protocol implementations ( #4705 )
2023-02-18 13:23:26 +01:00
Mathias Schreck
352ffdfc57
Fix void_return rule to support async and async throws functions ( #4772 )
2023-02-17 21:39:32 +01:00
Thi Doãn
6a9e6776a9
Update BUILD file for SwiftSyntax ( #4768 )
2023-02-16 13:25:16 -05:00
Danny Mösch
ec38c244fd
Refactor rule list documentation ( #4763 )
2023-02-13 21:22:10 +01:00
Vasiliy Kattouf
ad29864d7f
Add markdown local links to listed rules ( #4762 )
2023-02-12 23:22:09 +01:00
Marcelo Fabri
b9e5cfb202
Fix correction on `lower_acl_than_parent` rule ( #4761 )
...
Fixes #4753
2023-02-09 01:47:33 -08:00
Michael S
9c216baf20
Add new `relative-path` reporter ( #4739 )
2023-02-07 23:23:00 +01:00
Marcelo Fabri
7eb479d546
Rewrite MultilineArgumentsRule using SwiftSyntax ( #4750 )
...
* Rewrite MultilineArgumentsRule using SwiftSyntax
* Add examples and changelog
Fixes #3399 , #3605
2023-02-07 02:55:21 -08:00
Danny Mösch
aafc574e90
Allow to pass a rule identifier to the `swiftlint docs` command ( #4710 )
2023-02-07 00:01:52 +01:00
Danny Mösch
5af4291b53
Let Emoji reporter print rule identifier ( #4708 )
2023-02-06 16:28:07 -05:00
Danny Mösch
d3ebfc5567
Let `number_separator` rule trigger on misplaced separators ( #4685 )
2023-02-06 16:22:31 -05:00
Marcelo Fabri
60d0dd8a05
Update SwiftSyntaxRule.swift ( #4749 )
2023-02-06 14:16:18 -05:00
Marcelo Fabri
0163ffd328
Cache folded syntax tree ( #4744 )
2023-02-06 10:39:36 -08:00
JP Simard
eb5712582f
Update rules_xcodeproj to 1.0.1 ( #4748 )
...
https://www.buildbuddy.io/blog/introducing-rules_xcodeproj-1-0
2023-02-06 18:08:11 +00:00
JP Simard
6ea0397620
Replace `if_let_shadowing` with `shorthand_optional_binding` ( #4747 )
...
In `.swiftlint.yml`
2023-02-06 16:12:08 +00:00
Marcelo Fabri
aba0f63704
Speed up class_delegate_protocol rule ( #4743 )
2023-02-05 18:45:24 -08:00
Martin Redington
993f34a96c
Document `allow_zero_lintable_files` and move the `analyzer_rules` section up ( #4741 )
...
Co-authored-by: Martin Redington <mildm8nnered@gmail.com>
2023-02-04 13:43:41 +01:00
Christian Clauss
eaacd9873e
Show how pre-commit can apply fixes and fail on errors ( #4740 )
2023-02-04 13:39:25 +01:00
Roman Stetsenko
843198d241
Use prebuildCommand for SwiftLint plugin ( #4680 )
2023-02-02 19:25:25 +01:00
Danny Mösch
325d0ee1e4
Consider custom attributes in `attributes` rule ( #4616 )
2023-01-31 22:34:11 +01:00
Danny Mösch
5eed8fe91b
Enable `if_let_shadowing` rule and fix all violations ( #4247 )
2023-01-31 22:31:38 +01:00
Jim Puls
60610cef84
Update Package.resolved ( #4736 )
2023-01-31 13:41:26 -05:00
JP Simard
ca09bc5a22
Update rules_xcodeproj & Yams ( #4735 )
...
* rules_xcodeproj: https://github.com/buildbuddy-io/rules_xcodeproj/releases/tag/1.0.0rc1
* Yams: https://github.com/jpsim/Yams/releases/tag/5.0.4
2023-01-31 16:51:16 +00:00
Danny Mösch
0796236031
Use text blocks in reporters if reasonable ( #4733 )
2023-01-30 16:38:07 -05:00
Patrick
651b00eb70
Updated JUnit reporter ( #4725 )
2023-01-30 20:48:29 +01:00
Danny Mösch
500f143c7d
Remove unused code ( #4729 )
2023-01-28 19:50:22 +01:00
JP Simard
81f1dbfd1b
[CI] Stop running "Analyze" job ( #4728 )
...
it's extremely time-consuming, taking 25 minutes lately, and we'll
hopefully have a better solution soon with the upcoming improvements
to dead code detection, taking less than 1 second to run.
```
(1/4) Collecting units and records (0.25s)
(2/4) Collecting protocol conformances (0.26s)
(3/4) Collecting declarations and references (0.04s)
(4/4) Calculating unused declarations (0.05s)
Source/SwiftLintFramework/Extensions/Configuration+IndentationStyle.swift:16:18: error: Unused declaration named 'init(_:)'
Source/SwiftLintFramework/Models/LinterCache.swift:53:13: error: Unused declaration named 'init(cache:location:fileManager:swiftVersion:)'
Source/SwiftLintFramework/Models/SwiftVersion.swift:25:16: error: Unused declaration named 'fiveDotTwo'
Source/SwiftLintFramework/Models/SwiftVersion.swift:27:16: error: Unused declaration named 'fiveDotThree'
Source/SwiftLintFramework/Models/SwiftVersion.swift:31:16: error: Unused declaration named 'fiveDotFive'
Source/SwiftLintFramework/Rules/Lint/CompilerProtocolInitRule.swift:85:5: error: Unused declaration named 'init(protocolName:types:arguments:)'
Found 6 unused declarations (0.61s)
```
2023-01-27 19:51:13 -05:00
JP Simard
0750d5d465
Extract `EnumDeclSyntax.supportsRawValues` helper ( #4727 )
...
I'll want to use this elsewhere shortly.
Also adds `CGFloat` to the raw value types since we were missing that
one.
2023-01-27 16:46:54 -05:00
JP Simard
84c6d200b6
Clean up unused initializers ( #4726 )
...
Found with the upcoming improve dead code detection.
2023-01-27 16:31:56 -05:00
JP Simard
9ac13f078a
Update rules_xcodeproj to 0.12.3 ( #4724 )
...
https://github.com/buildbuddy-io/rules_xcodeproj/releases/tag/0.12.3
2023-01-26 21:24:21 -05:00
JP Simard
c84124d8bc
Enable all tests when using rules_xcodeproj ( #4723 )
...
* Revert "Skip tests requiring runfiles support when testing with rules_xcodeproj (#4694 )"
This reverts commit 040096a641
.
* Enable all tests when using rules_xcodeproj
Turns out we don't need runfiles support
(https://github.com/buildbuddy-io/rules_xcodeproj/issues/828 ) since the
tests run outside the sandbox in Xcode, so we can get the path to these
files from the `BUILD_WORKSPACE_DIRECTORY` environment variable that
`bazel test` sets.
2023-01-26 21:18:05 -05:00
JP Simard
3907772163
Revert "[OSSCheck] Cache git repos ( #4699 )" ( #4718 )
...
This reverts commit fbd9f16955
.
2023-01-23 17:05:15 +00:00
dependabot[bot]
d98fd5386a
Bump activesupport from 6.1.6.1 to 6.1.7.1 ( #4716 )
...
Bumps [activesupport](https://github.com/rails/rails ) from 6.1.6.1 to 6.1.7.1.
- [Release notes](https://github.com/rails/rails/releases )
- [Changelog](https://github.com/rails/rails/blob/v7.0.4.1/activesupport/CHANGELOG.md )
- [Commits](https://github.com/rails/rails/compare/v6.1.6.1...v6.1.7.1 )
---
updated-dependencies:
- dependency-name: activesupport
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-21 09:18:21 +01:00
JP Simard
36c24c822c
Add "fixed releaser" to BCR config
...
So that the publish-to-bcr GitHub app uses my personal fork of
bazel-central-registry as documented in
https://github.com/bazel-contrib/publish-to-bcr/blob/main/templates/README.md#optional-configyml
2023-01-19 21:41:20 -05:00
Keith Smiley
e1fdf17d1b
Add bazel BCR config ( #4713 )
2023-01-19 21:17:21 -05:00
Keith Smiley
23e4db3e5f
Add support for bzlmod ( #4704 )
2023-01-19 17:04:21 -05:00
JP Simard
b4641e7e60
Update rules_xcodeproj to 0.12.2 ( #4709 )
...
https://github.com/buildbuddy-io/rules_xcodeproj/releases/tag/0.12.2
2023-01-19 15:36:47 -05:00
Danny Mösch
341db66f3c
Support Swift version 5.7.3 ( #4711 )
2023-01-19 15:35:41 -05:00
JP Simard
c9791783ba
Update rules_xcodeproj to 0.12.0 ( #4703 )
...
This is the first release to fix running unit tests since 0.10.1.
It should include some performance improvements and bug fixes that will
benefit us.
https://github.com/buildbuddy-io/rules_xcodeproj/releases/tag/0.12.0
2023-01-18 16:14:55 +00:00
JP Simard
dc228d57ac
Update dependencies ( #4702 )
2023-01-17 12:59:32 -05:00
JP Simard
fbd9f16955
[OSSCheck] Cache git repos ( #4699 )
...
By maintaining persistent clones of the repos which are incrementally
synced instead of cloned from scratch on every run.
2023-01-17 12:07:48 -05:00
JP Simard
d120f41181
[CI] Remove 'TSan Runs' job ( #4701 )
...
This frequently crashes and I don't think it's due to a real TSan race.
E.g. https://buildkite.com/swiftlint/swiftlint/builds/4912#0185c098-a803-4525-8df1-827d1c97ed01
```
swiftlint(373,0x1ecdd3a80) malloc: nano zone abandoned due to inability to preallocate reserved vm space.
Linting Swift files in current working directory
1 of 538 [ ] ETA: 0s (13129 files/s)
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
ThreadSanitizer:DEADLYSIGNAL
==373==ERROR: ThreadSanitizer: SEGV on unknown address 0x000000000008 (pc 0x000102cbe380 bp 0x00016f50ee00 sp 0x00016f50edc0 T30753687)
==373==The signal is caused by a UNKNOWN memory access.
==373==Hint: address points to the zero page.
#0 __tsan::ThreadClock::release(__tsan::DenseSlabAllocCache*, __tsan::SyncClock*) <null>:46801128 (libclang_rt.tsan_osx_dynamic.dylib:arm64e+0x2a380)
#1 __tsan::Release(__tsan::ThreadState*, unsigned long, unsigned long) <null>:46801128 (libclang_rt.tsan_osx_dynamic.dylib:arm64e+0x7456c)
#2 swift::runJobInEstablishedExecutorContext(swift::Job*) <null>:46801128 (libswift_Concurrency.dylib:arm64e+0x40588)
#3 swift_job_runImpl(swift::Job*, swift::ExecutorRef) <null>:46801128 (libswift_Concurrency.dylib:arm64e+0x41404)
#4 _dispatch_root_queue_drain <null>:46801128 (libdispatch.dylib:arm64e+0x15f90)
#5 _dispatch_worker_thread2 <null>:46801128 (libdispatch.dylib:arm64e+0x167bc)
#6 _pthread_wqthread <null>:46801128 (libsystem_pthread.dylib:arm64e+0x30c0)
#7 start_wqthread <null>:46801128 (libsystem_pthread.dylib:arm64e+0x1e1c)
==373==Register values:
x[0] = 0x0000000102a53458 x[1] = 0x0000000000000538 x[2] = 0x0000000000000000 x[3] = 0x0000000000000000
x[4] = 0x0000000000000001 x[5] = 0x0000000000000000 x[6] = 0x0095000004220122 x[7] = 0x0000000000000001
x[8] = 0x0000000000000008 x[9] = 0x0000000000000000 x[10] = 0x0000000000000000 x[11] = 0x0000000000000000
x[12] = 0x0000000000000020 x[13] = 0x0000000110904040 x[14] = 0x0000000000000000 x[15] = 0x0000000106251910
x[16] = 0x0000000104190960 x[17] = 0x0000000000200018 x[18] = 0x0000000000000000 x[19] = 0x000000010f5d3488
x[20] = 0x0000000109ca03f0 x[21] = 0x0000000102a53458 x[22] = 0x0000000109ca03f0 x[23] = 0x0000000109cc0078
x[24] = 0x00040c0000fd77c4 x[25] = 0x0000010000000000 x[26] = 0x00000002287898f8 x[27] = 0x0000000000000000
x[28] = 0x000000016f50f0e0 fp = 0x000000016f50ee00 lr = 0x0000000102cbe360 sp = 0x000000016f50edc0
ThreadSanitizer can not provide additional info.
SUMMARY: ThreadSanitizer: SEGV (libclang_rt.tsan_osx_dynamic.dylib:arm64e+0x2a380) in __tsan::ThreadClock::release(__tsan::DenseSlabAllocCache*, __tsan::SyncClock*)+0x174
==373==ABORTING
```
2023-01-17 11:42:46 -05:00
JP Simard
db6aea5d07
Disable remote cache for the "TSan Runs" CI job ( #4700 )
...
I suspect it might be the reason why it occasionally crashes.
2023-01-17 11:24:48 -05:00
JP Simard
876d8fc872
Remove `.swp` file that snuck in ( #4697 )
...
https://github.com/realm/SwiftLint/pull/4657
2023-01-17 08:23:53 -05:00
JP Simard
45c5f06754
Move changelog sections to the latest section ( #4698 )
...
These were introduced after 0.50.3 was released.
2023-01-17 13:16:12 +00:00
JP Simard
040096a641
Skip tests requiring runfiles support when testing with rules_xcodeproj ( #4694 )
...
rules_xcodeproj doesn't support runfiles yet:
https://github.com/buildbuddy-io/rules_xcodeproj/issues/828
2023-01-16 13:09:56 -05:00
JP Simard
f91a2d5310
Revert rules_xcodeproj to 0.10.1 ( #4693 )
...
It looks like later versions can't run tests because of
https://github.com/buildbuddy-io/rules_xcodeproj/issues/1586 .
2023-01-16 17:14:31 +00:00
Danny Mösch
f8f2317bdb
Extract common plugin execution code to method ( #4690 )
2023-01-14 12:35:53 +01:00
Danny Mösch
82249f5ed4
Include recently added option into rule/cache description ( #4688 )
2023-01-13 17:37:29 -05:00
Danny Mösch
78c9ad6f33
Rephrase rule description ( #4686 )
...
"Can't" sounds too hard. The Swift compiler allows multiple enum cases with the same name. It's rather a recommendation.
2023-01-12 18:06:04 +01:00
Danny Mösch
693e504258
Use basic NSRegularExpression type with caching ( #4683 )
2023-01-11 20:28:16 +01:00
Danny Mösch
b66dd13e2f
Ensure negative literals in initializers don't trigger `no_magic_numbers` ( #4679 )
2023-01-11 00:09:53 +01:00
kyounh12
5ec6112ba1
Interpret strings in `excluded` option of `*_name` rules as regex ( #4655 )
2023-01-10 23:29:04 +01:00
Danny Mösch
74dbd52add
Fix/improve some rule descriptions
2023-01-10 22:29:13 +01:00
Danny Mösch
cc44c989b7
Check every used internal violation reason for a pending period
2023-01-10 22:29:13 +01:00
Danny Mösch
e64e82d80d
Get rid of periods finishing rule descriptions
2023-01-10 22:29:13 +01:00
dependabot[bot]
ea8b17dd9c
Bump git from 1.12.0 to 1.13.0 ( #4678 )
...
Bumps [git](https://github.com/ruby-git/ruby-git ) from 1.12.0 to 1.13.0.
- [Release notes](https://github.com/ruby-git/ruby-git/releases )
- [Changelog](https://github.com/ruby-git/ruby-git/blob/master/CHANGELOG.md )
- [Commits](https://github.com/ruby-git/ruby-git/compare/v1.12.0...v1.13.0 )
---
updated-dependencies:
- dependency-name: git
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 17:29:07 -05:00
Danny Mösch
672e19651f
Use configuration raw name expected when reading the configuration
2023-01-08 15:05:43 +01:00
Danny Mösch
67eb330f1c
Add key to severity configuration as a hint for the correct YAML syntax
2023-01-08 15:05:43 +01:00
JP Simard
e6d4ad653c
Pin SwiftSyntax to a tagged version ( #4674 )
...
Specifically this tag:
https://github.com/apple/swift-syntax/releases/tag/0.50800.0-SNAPSHOT-2022-12-29-a
This should make SwiftPM happier about the stability of the pinned
version.
Also switch the CI job to run on macOS to avoid adding Linux-only deps
to the `Package.resolved` file (e.g. CryptoSwift).
2023-01-06 13:10:59 -05:00
JP Simard
100b3eec2a
Update Docker CI job to use `actions/checkout@v3` ( #4675 )
2023-01-06 18:04:50 +00:00
github-actions[bot]
bcfc2c4b6c
Update SwiftSyntax ( #4673 )
...
* Exclude `Documentation.docc` when building SwiftSyntax
* Remove references to `.stringInterpolationAnchor`
Co-authored-by: JP Simard <jp@jpsim.com>
2023-01-06 11:12:17 -05:00
Ethan Wong
68dc0f58d2
List Analyzer rules in an independent section in the rule directory ( #4664 )
2023-01-03 07:18:25 +01:00
Danny Mösch
d6ff2a7f37
Rewrite `explicit_type_interface` rule with SwiftSyntax fixing a false-positive ( #4638 )
2023-01-01 23:23:50 +01:00
Danny Mösch
64d9619a8a
Report violations in all `<scope>_length` rules when error < warning threshold ( #4647 )
2023-01-01 23:15:36 +01:00
github-actions[bot]
470d471e51
Update SwiftSyntax ( #4659 )
...
Co-authored-by: jpsim <jpsim@users.noreply.github.com>
2022-12-26 09:37:51 -05:00
Danny Mösch
5ff40867b3
Apply consistent capitalization to rule names ( #3938 )
2022-12-26 09:32:36 +01:00
Martin Redington
58611e6718
Ignore compiler directives in `opening_brace` rule ( #4658 )
2022-12-25 18:46:16 +01:00
Danny Mösch
c740da48d5
Deprecate `inert_defer` rule in favor of the Swift compiler warning ( #4618 )
2022-12-23 04:07:41 -05:00
Jimmy Arts
eda0d92f44
Make forceExclude work with directly specified files ( #4609 )
2022-12-22 21:15:08 +01:00
Benedek Kozma
d76daf5f62
Deprecate `unused_capture_list` rule in favor of the Swift compiler warning ( #4656 )
2022-12-22 10:33:44 -05:00
JP Simard
1a39194f65
Update rules_xcodeproj to 0.11.0 ( #4653 )
...
https://github.com/buildbuddy-io/rules_xcodeproj/releases/tag/0.11.0
2022-12-21 18:07:55 -05:00
JP Simard
0e53e19cb1
[CI] Increase timeout for `analyze` CI job to 60 minutes ( #4654 )
...
I recently moved CI machines over to use Xcode 14.2 and it's possible
that running SwiftLint analyzer rules now take longer.
2022-12-21 17:37:44 -05:00
JP Simard
3cba460f9a
Update rules_apple to 2.0.0 ( #4652 )
...
https://github.com/bazelbuild/rules_apple/releases/tag/2.0.0
2022-12-21 16:08:44 -05:00
Julio Carrettoni
d3928cb8e8
Update docker_test to swift 5.7 ( #4625 )
2022-12-19 19:12:44 -03:00
JP Simard
a6c3cec8c9
Update to Bazel 6.0.0 ( #4651 )
...
https://www.buildbuddy.io/blog/whats-new-in-bazel-6-0/
2022-12-19 15:12:53 -05:00
Marcelo Fabri
7bd8362dae
Fix false positive on `private_subject` ( #4646 )
...
Fixes #4643
2022-12-19 13:31:34 -03:00
JP Simard
e1cddb710d
Remove remote bazel cache steps from CI instructions ( #4650 )
...
Moved over to BuildBuddy.
2022-12-19 11:02:04 -05:00
github-actions[bot]
4a6387da67
Update SwiftSyntax ( #4649 )
...
Co-authored-by: jpsim <jpsim@users.noreply.github.com>
2022-12-19 09:22:53 -05:00
Danny Mösch
83ee9a89dd
Add Swift version 5.7.2 ( #4648 )
2022-12-17 04:18:21 -05:00
David Steinacher
540003e2a1
Add support for new Quick APIs `aroundEach` and `justBeforeEach` ( #4627 )
2022-12-15 23:29:02 +01:00
Julio Carrettoni
3745704c03
Add rule for single space after period on comments ( #4624 )
2022-12-15 23:27:33 +01:00
github-actions[bot]
33fa42becb
Update SwiftSyntax ( #4644 )
...
Co-authored-by: jpsim <jpsim@users.noreply.github.com>
2022-12-14 11:17:34 -05:00
github-actions[bot]
25c3fb161d
Update SwiftSyntax ( #4639 )
...
* `ObjcKeyPathExprSyntax` -> `MacroExpansionExprSyntax`
* Fix `#selector()` and add a regression test
Co-authored-by: JP Simard <jp@jpsim.com>
2022-12-14 10:52:47 -05:00
JP Simard
53ee4a955d
Fix `make release`
...
`make package` has a dependency on `make clean` so this was removing
the bazel release artifacts.
2022-12-09 14:42:20 -05:00
JP Simard
40fb3796cb
Add empty changelog section
2022-12-09 14:41:42 -05:00
JP Simard
a876e860ee
release 0.50.3
2022-12-09 14:12:02 -05:00
JP Simard
4c406459bd
Set first changelog entry header to `Main` again
2022-12-09 14:10:55 -05:00
JP Simard
4ddeb22b6d
Fix `Package.swift`
2022-12-09 14:08:08 -05:00
JP Simard
ff06e0ed00
release 0.50.2
2022-12-09 13:49:24 -05:00
github-actions[bot]
6734a64554
Update SwiftSyntax ( #4636 )
...
Co-authored-by: jpsim <jpsim@users.noreply.github.com>
2022-12-09 13:25:09 -05:00
JP Simard
73a64d674c
Fix rewrite issue with `comma` rule ( #4635 )
2022-12-09 12:56:50 -05:00
github-actions[bot]
7f8eb9de77
Update SwiftSyntax ( #4629 )
...
Co-authored-by: jpsim <jpsim@users.noreply.github.com>
2022-12-07 17:44:23 -05:00
Danny Mösch
609418f702
Skip `defer` statements in `#if` block if it is not itself the last statement ( #4617 )
2022-12-06 02:22:03 -05:00
Danny Mösch
4adabd8e4b
Print a warning for Analyzer rules misplaced in the configuration ( #4620 )
2022-12-05 18:03:54 -05:00
Danny Mösch
93d0d8fa7f
Fix configuration parsing error in `unused_declaration` rule ( #4619 )
2022-12-05 23:11:19 +01:00
JP Simard
4dfef014ab
Build with `--swiftcopt=-warnings-as-errors` when using Bazel ( #4622 )
2022-12-05 11:33:02 -05:00
JP Simard
95d56e4130
Use `raw` in SwiftSyntaxBuilder string interpolation ( #4623 )
...
Fixing build warnings to account for
https://github.com/apple/swift-syntax/pull/1090 .
2022-12-05 11:26:04 -05:00
JP Simard
7f9dd69c62
Move changelog entries to correct sections
2022-12-05 10:33:29 -05:00
github-actions[bot]
ac44fe23b6
Update SwiftSyntax ( #4621 )
...
Co-authored-by: jpsim <jpsim@users.noreply.github.com>
2022-12-05 08:40:45 -05:00
Marcelo Fabri
60128ab196
Don’t trigger shorthand_operator inside operator declaration ( #4613 )
...
Fixes #4611
2022-12-02 02:00:44 -05:00
Martin Redington
7a8b2d1dab
Add `test_parent_class` option to more test rules ( #4262 )
2022-12-01 18:56:13 +01:00
Ryan Aveo
92304cdd98
Fix building tests in Xcode ( #4607 )
...
Co-authored-by: JP Simard <jp@jpsim.com>
2022-11-30 10:33:33 -05:00
Tony Arnold
ab143685a4
Use a binary target for the build tool plugin ( #4603 )
...
* Use a binary target for the build tool plugin
* Merge `push_version` and `release` make commands
Instead of running `make push_version "0.2.0: Tumble Dry"` and then
`make release`, now run `make release "0.2.0: Tumble Dry"`, which will
build the release artifacts and update/push the new version to GitHub.
This allows the artifacts to use the new version, update the artifact
bundle checksum in the package manifest, then tag the release.
The Releasing.md instructions were updated to reflect this new workflow.
* Add `SwiftLintSourcePlugin` source plugin for SwiftPM
* Add changelog entry
* Remove SwiftLintSourcePlugin for now
* Build from Source on Linux
* Use a lower-level method of checking if a file is accessible
This shouldn’t trigger sandbox violations, I hope…
* Prevent an infinite recursion of the filesystem root
* Remove unnecessary logging
* Quieten the output so that Xcode only prints violations
* Break up comment to avoid line length warning
* Fix capitalization of Glibc import
Co-authored-by: JP Simard <jp@jpsim.com>
2022-11-29 18:10:47 -05:00
github-actions[bot]
9cb1069090
Update SwiftSyntax ( #4605 )
...
Co-authored-by: jpsim <jpsim@users.noreply.github.com>
2022-11-29 15:30:56 -05:00
JP Simard
e405d3d583
Fix `update-swift-syntax.sh` script ( #4604 )
2022-11-29 15:07:37 -05:00
Steffen Matthischke
97ba82d740
Fix empty_enum_arguments false positive when called expression is an identifier ( #4600 )
2022-11-28 17:20:34 -05:00
JP Simard
d8d5e5bb43
Add empty changelog section
2022-11-28 09:20:39 -05:00
JP Simard
28a4aa2195
release 0.50.1
2022-11-25 11:38:16 -05:00
JP Simard
28e2a1b022
Fix configuration description for some vertical whitespace rules ( #4594 )
...
Before: `N/A`
After: `warning, only_enforce_before_trivial_lines: false`
2022-11-25 11:18:41 -05:00
JP Simard
c1c5e5f722
Add test cases for https://github.com/realm/SwiftLint/issues/4565 ( #4593 )
2022-11-25 11:12:48 -05:00
JP Simard
60ad710b7f
Fix `type_name` regression when using backticks ( #4592 )
...
Fixes https://github.com/realm/SwiftLint/issues/4571
2022-11-25 10:57:05 -05:00
JP Simard
5a7d3ade02
Lint Plugins directory ( #4591 )
2022-11-25 15:51:09 +00:00
JP Simard
12c8bb369e
Fix false positives in `unused_closure_parameter` when using backticks ( #4590 )
...
Fixes https://github.com/realm/SwiftLint/issues/4588
2022-11-25 07:29:31 -05:00
Tony Arnold
f088bbde15
Only lint Swift source files within the provided target ( #4406 )
...
* Only lint Swift source files within the provided target
* Restore plugin display name to “SwiftLint”
* Xcode targets don’t always conform to the SourceModuleTarget
Use a “baser” way to get at the Swift sources of the current target
* Use the cache path as the outputFiles
This prevents the warning we’re seeing in Xcode on every build, but shouldn’t interfere with the re-run logic
* Look for configuration files manually in the project directory and parents
* Check if the file is readable, not just that it exists
* Move the Path helper into a separate file
* Fix a wayward apostrophe
Signed-off-by: Tony Arnold <tony@thecocoabots.com>
* Add an entry to the CHANGELOG
Signed-off-by: Tony Arnold <tony@thecocoabots.com>
Signed-off-by: Tony Arnold <tony@thecocoabots.com>
2022-11-24 18:38:41 -05:00
JP Simard
e9c1128b86
Move SwiftPM CI job to Buildkite ( #4589 )
...
We have 6 CI machines now and these should run faster on bare metal
machines with lots of stuff already cached, like starting with an
existing git repo.
2022-11-24 17:58:09 +00:00
JP Simard
4ccf9eebb4
Fix line count calculation for multiline string literals ( #4587 )
...
Fixes https://github.com/realm/SwiftLint/issues/4585
Update body length rule thresholds for SwiftLint
2022-11-24 16:40:51 +00:00
JP Simard
f6de471b5f
Fix false positives in `closure_spacing` ( #4584 )
...
Fixes https://github.com/realm/SwiftLint/issues/4582
2022-11-24 10:30:40 -05:00
JP Simard
0f68a0a0cb
Fix `update-swift-syntax.sh` ( #4586 )
...
I forgot to update this in https://github.com/realm/SwiftLint/pull/4570
2022-11-24 10:26:51 -05:00
JP Simard
ac21584224
Fix `minimum_fraction_length` handling in `number_separator` ( #4583 )
...
Fixes https://github.com/realm/SwiftLint/issues/4576
Before it would apply the `minimum_length` parameter to the
`minimal_fractional_length` setting if the latter wasn't set.
2022-11-24 14:19:20 +00:00
Steffen Matthischke
907c80f84c
Fix lower_acl_than_parent false positives when the nominal parent is an extension ( #4575 )
2022-11-24 08:08:23 -05:00
JP Simard
fd502b4526
Add new `local_doc_comment` rule ( #4581 )
...
Moving the validation of doc comments in local scopes out of
`orphaned_doc_comment` and into a new opt-in `local_doc_comment` rule.
Addresses https://github.com/realm/SwiftLint/issues/4573 .
2022-11-23 17:50:18 -05:00
JP Simard
a6c4ea9614
Makefile: use bazel in more places ( #4580 )
...
Previously, it took a very long time to run `make release` since it had
to clean build everything.
With bazel, I'm more confident in incremental builds being solid, so it
now just takes a few seconds if there's anything cached, which is often
the case.
2022-11-23 21:41:28 +00:00
JP Simard
571ad33ceb
Add `universal_swiftlint` universal macOS binary ( #4579 )
...
With architectures for x86_64 and arm64 for portable distribution.
2022-11-23 11:33:38 -05:00
JP Simard
6af9175386
Update swift-argument-parser to 1.2.0 ( #4572 )
2022-11-21 15:33:00 +00:00
JP Simard
fe4ec3521e
Update `Package.swift` to `swift-tools-version:5.7` ( #4570 )
...
We already require Swift 5.7 as of SwiftLint 0.50.0.
2022-11-21 15:14:25 +00:00
JP Simard
1dbde3d9c3
Update SourceKitten to 0.33.1 ( #4569 )
...
To make SwiftPM happy about the package being set to a stable release.
2022-11-21 09:52:23 -05:00
github-actions[bot]
cc49e82348
Update SwiftSyntax ( #4567 )
...
Co-authored-by: jpsim <jpsim@users.noreply.github.com>
2022-11-21 09:15:01 -05:00
JP Simard
4408250920
Fix building with `swift build -c release` ( #4563 )
...
Which previously tried to build the SwiftLintTestHelpers module,
which is a test-only module.
This should fix building with precommit and Mint, both of which assume
you can build the CLI targets in a Swift package with the
`swift build -c release` command.
2022-11-20 20:59:39 +00:00
JP Simard
85e59c706a
Disable `prefer_self_in_static_references` in SwiftLint ( #4557 )
...
I find this rule to not help readability for this project at least,
where `Version(value: "0.50.0")` is a lot more descriptive than
`Self(value: "0.50.0")`.
2022-11-19 09:23:55 -05:00
JP Simard
cdd891a4a2
release 0.50.0
2022-11-18 14:43:44 -05:00
JP Simard
e5b1944ae6
Reorder changelog entries
2022-11-18 14:43:21 -05:00
github-actions[bot]
cd291b043a
Update SwiftSyntax ( #4556 )
2022-11-18 14:41:07 -05:00
JP Simard
8cdbb50cbf
Update rules_xcodeproj
2022-11-16 16:22:25 -05:00
JP Simard
ba8899714d
Reduce visibility of custom rules ( #4553 )
2022-11-16 16:14:50 -05:00
JP Simard
4f652a68e7
Move XCTestHelpers to TestCaseAccessibilityRule.swift ( #4552 )
...
it's only used in that file
2022-11-16 14:31:00 -05:00
JP Simard
953ee620f7
Refactor ExecutableInfo ( #4551 )
...
To improve how it renders in jazzy-generated docs.
2022-11-16 14:07:39 -05:00
JP Simard
18f9a0e3a6
Write some docs for internal APIs ( #4550 )
...
These should be useful when writing rules, but also may become public
API in the future.
2022-11-16 13:58:55 -05:00
JP Simard
0362cd07b8
Fix jazzy CodeClimateReporter capitalization ( #4549 )
2022-11-16 13:16:05 -05:00
github-actions[bot]
9d2ec3dc8d
Update SwiftSyntax ( #4547 )
...
Co-authored-by: jpsim <jpsim@users.noreply.github.com>
2022-11-13 19:35:15 -05:00
JP Simard
04d1184904
Remove structure cache ( #4541 )
2022-11-10 14:53:16 -05:00
JP Simard
4bd7da32ea
Reduce visibility of rules to be `internal` ( #4533 )
...
There's no reason to expose these publicly and this will make it nicer
to move to a new module outside of the core SwiftLint functionality.
2022-11-09 11:01:26 -05:00
JP Simard
901f05cd4f
Update rules_apple to 1.1.3 ( #4537 )
2022-11-09 10:59:52 -05:00
JP Simard
ca0813c605
Update Bazel to 5.3.2 ( #4536 )
...
Latest stable release: https://github.com/bazelbuild/bazel/releases/tag/5.3.2
Run OSSCheck if `.bazelversion` changes
2022-11-09 10:47:55 -05:00
github-actions[bot]
ac7833aaf4
Update SwiftSyntax ( #4535 )
...
Co-authored-by: jpsim <jpsim@users.noreply.github.com>
2022-11-08 23:01:13 -05:00
github-actions[bot]
5fceb213d9
Update SwiftSyntax ( #4529 )
...
Co-authored-by: jpsim <jpsim@users.noreply.github.com>
2022-11-08 10:24:02 -05:00
JP Simard
2928dab4ec
Fix running update-swift-syntax.sh locally
2022-11-08 10:05:45 -05:00
JP Simard
0c828e35fb
Improve automated Swift Syntax update PR messages
2022-11-08 09:52:20 -05:00
Danny Mösch
3864ecc12f
Fix indentation in error message ( #4528 )
2022-11-07 14:47:14 -05:00
github-actions[bot]
fe141cd3b6
Update SwiftSyntax ( #4527 )
...
Diff: e1f771ea8a...4fa6e6b0ff
2022-11-07 10:42:36 -05:00
Marcelo Fabri
eaf7db1250
Rewrite `object_literal` rule with SwiftSyntax ( #4525 )
2022-11-06 20:42:00 -08:00
Marcelo Fabri
6c7e2107ae
Rewrite `nslocalizedstring_key` with SwiftSyntax ( #4523 )
2022-11-06 19:12:53 -08:00
Danny Mösch
1edef5ebdc
Trigger `prefer_self_in_static_references` rule on constructor calls ( #4519 )
2022-11-06 14:55:28 +01:00
Danny Mösch
7e8a3ae2ac
Introduce `onlyElement` property on `Collection` ( #4518 )
2022-11-06 07:37:44 -05:00
Marcelo Fabri
45ac3dcdff
Rewrite `required_enum_case` with SwiftSyntax ( #4521 )
2022-11-06 01:26:11 -08:00
Marcelo Fabri
1c675bc993
Rewrite `balanced_xctest_lifecycle` with SwiftSyntax ( #4520 )
2022-11-06 00:05:32 -07:00
Marcelo Fabri
fc0c0c7f5b
Rewrite `pattern_matching_keywords` with SwiftSyntax ( #4490 )
2022-11-05 23:16:59 -07:00
Marcelo Fabri
22522254df
Validate shorthand option binding in `self_binding` rule ( #4514 )
...
* Validate shorthand option binding in `self_binding` rule
* Fix CHANGELOG
2022-11-05 21:32:09 -07:00
Danny Mösch
9a706ba371
Trigger `prefer_self_in_static_references` rule in computed property blocks ( #4517 )
2022-11-06 00:19:48 +01:00
Danny Mösch
d4ea19e434
Trigger `prefer_self_in_static_references` rule on key paths ( #4516 )
2022-11-05 13:39:27 +01:00
Danny Mösch
eb3d502ad7
Rephrase rule description letting it no longer refer to classes only ( #4515 )
2022-11-05 07:13:24 -04:00
Danny Mösch
65874dc40f
Rewrite `prefer_self_in_static_references` with SwiftSyntax ( #4504 )
2022-11-05 11:46:33 +01:00
JP Simard
759408fdb5
Update SwiftSyntax ( #4506 )
...
This update pulls in https://github.com/apple/swift-syntax/pull/1050 ,
which fixes a memory leak, reducing memory usage by up to 3x and
improves lint times by 20%-50% in my tests.
2022-11-04 06:05:38 -04:00
Craig Siemens
ec5124d939
Rewrite `multiline_arguments_brackets` with SwiftSyntax ( #4512 )
...
Fix false-positives when a function call has a single line closure.
2022-11-03 21:57:27 -04:00
JP Simard
05e06d1945
Allow passing a commit to `update-swift-syntax.sh` ( #4509 )
...
E.g.
```console
$ ./tools/update-swift-syntax.sh e19c5f2909127ce4537d6f8981919aba4645ce4e
```
2022-11-03 16:05:09 -04:00
John Szumski
6fcdd8077f
Adds NSError to the list of types in discouraged_direct_init. ( #4508 )
2022-11-03 13:52:30 -04:00
Danny Mösch
32152646f3
Use `Self` in constructor calls ( #4505 )
2022-11-02 22:50:22 +00:00
JP Simard
e97119efec
Migrate `orphaned_doc_comment` to use SwiftSyntax classifications ( #4461 )
2022-11-02 15:55:47 +00:00
JP Simard
fce8283843
Fix & clean up Dockerfile ( #4502 )
...
We no longer need `_InternalSwiftSyntaxParser`, but we do need
`libswiftCore.so`.
Fixes https://github.com/realm/SwiftLint/issues/4501
Add a more useful validation test at the end of the Dockerfile.
In addition to running `swiftlint version`, also actually run the linter
which will exercise the SourceKit codepaths.
2022-11-02 10:28:55 -04:00
JP Simard
f1f6a3c4a0
Add `ByteSourceRange.toSourceKittenByteRange()` helper ( #4500 )
...
This will be useful for other rules too.
2022-11-01 14:13:29 -04:00
César Pinto Castillo
c56e19a0c2
Fix SwiftLint support on Xcode Cloud ( #4485 )
...
Fixes #4484 by checking the process environment for all the expected
environment variables set by Xcode Cloud.
2022-11-01 13:00:50 -04:00
JP Simard
3800ad32bf
Sort list of rules migrated to SwiftSyntax in changelog ( #4499 )
2022-10-31 13:07:53 -04:00
JP Simard
79e3c8bd4a
Add special handling for https://github.com/apple/swift/issues/61817 ( #4498 )
2022-10-31 09:58:36 -04:00
github-actions[bot]
6ad4a704f5
Update SwiftSyntax ( #4497 )
2022-10-31 09:49:40 -04:00
Marcelo Fabri
20bfe264f5
Rewrite `overridden_super_call` and `prohibited_super_call` with SwiftSyntax ( #4493 )
...
* Rewrite `overridden_super_call` with SwiftSyntax
* Rewrite `prohibited_super_call` too
2022-10-30 20:28:25 -07:00
Marcelo Fabri
697eaa73dd
Rewrite `private_subject` rule with SwiftSyntax ( #4495 )
2022-10-30 18:41:57 -07:00
Marcelo Fabri
5144cccb57
Revert "[OSSCheck] Cache repos ( #4456 ) ( #4477 )" ( #4494 )
...
This reverts commit 6b5352feac
.
2022-10-30 17:46:53 -07:00
Marcelo Fabri
98e9c2f1f4
Fix SwiftVersionTests when using Xcode 14.2 ( #4492 )
2022-10-30 19:50:49 -04:00
Henry
63c043664d
Add new `no_magic_numbers` rule ( #4265 )
2022-10-30 15:28:20 +01:00
JP Simard
a18436d4d6
Rewrite `optional_enum_case_matching` with SwiftSyntax ( #4488 )
2022-10-28 19:30:33 +00:00
JP Simard
a5c44605af
Update to rules_xcodeproj 0.10.0 ( #4486 )
...
Mostly has optimizations: https://github.com/buildbuddy-io/rules_xcodeproj/releases/tag/0.10.0
2022-10-28 14:17:03 -04:00
JP Simard
b7f621c239
Make `update-swift-syntax.sh` script portable ( #4487 )
2022-10-28 14:16:48 -04:00
JP Simard
d551cb8c16
Update SwiftSyntax ( #4480 )
...
Moves syntax classifications to a new IDEUtils module.
2022-10-28 09:23:06 -04:00
JP Simard
1b59a3f168
Cache location converters ( #4481 )
...
This is 2%-12% faster according to OSSCheck
2022-10-26 12:37:16 -04:00
JP Simard
6b5352feac
[OSSCheck] Cache repos ( #4456 ) ( #4477 )
...
This should speed up OSSCheck runs considerably.
In my local testing, cloning repos goes from 77s to 29s on a 100 Mbps
connection.
2022-10-26 10:58:23 -04:00
JP Simard
9a305dd2e6
Update CI setup instructions ( #4479 )
2022-10-26 10:25:06 -04:00
github-actions[bot]
7738f0c0a5
Update SwiftSyntax ( #4476 )
...
Co-authored-by: jpsim <jpsim@users.noreply.github.com>
2022-10-24 17:10:17 -04:00
JP Simard
374130bb56
Update SwiftSyntax on a weekly scheduled CI job ( #4475 )
2022-10-24 16:37:29 -04:00
Marcelo Fabri
d37465ad37
Rewrite `vertical_parameter_alignment` with SwiftSyntax ( #4466 )
...
* Rewrite `vertical_parameter_alignment` rule with SwiftSyntax
* Validate inits
2022-10-24 12:56:48 -07:00
Marcelo Fabri
50c85ef5c1
Rewrite `explicit_top_level_acl` with SwiftSyntax ( #4450 )
2022-10-24 11:31:12 -07:00
Marcelo Fabri
fa6db3cca7
Rewrite `collection_alignment` rule with SwiftSyntax ( #4472 )
2022-10-24 10:51:31 -07:00
JP Simard
96925d480e
Revert "[OSSCheck] Cache repos ( #4456 )" ( #4473 )
...
This reverts commit f0f46a45eb
.
This might need more error handling / recovery:
https://github.com/realm/SwiftLint/pull/4456#issuecomment-1288792588
2022-10-24 06:26:52 -04:00
Marcelo Fabri
31ea58381c
Add example for #3558 ( #4471 )
...
Fixes #3558
2022-10-24 06:14:30 -04:00
Marcelo Fabri
95838aa230
Add example for #2008 ( #4470 )
...
Fixes #2008
2022-10-24 05:32:56 -04:00
Marcelo Fabri
f8d505a225
Add example for #3945 ( #4469 )
...
Fixes #3945
2022-10-24 09:23:37 +00:00
Marcelo Fabri
7a8de1c966
Add example for #2782 ( #4468 )
...
Fixes #2782
2022-10-24 09:22:31 +00:00
Marcelo Fabri
7a3d0d55a0
Add example for #3022 ( #4467 )
...
Fixes #3022
2022-10-24 08:56:23 +00:00
Marcelo Fabri
1c6b6c67e0
Rewrite `duplicated_key_in_dictionary_literal` with SwiftSyntax ( #4396 )
2022-10-23 23:11:17 -07:00
Marcelo Fabri
87bebb6744
Rewrite `test_case_accessibility` with SwiftSyntax ( #4446 )
2022-10-23 17:39:45 -07:00
Marcelo Fabri
7f5b189c1f
Rewrite `override_in_extension` with SwiftSyntax ( #4463 )
2022-10-23 17:38:40 -07:00
Marcelo Fabri
c1f2b615e2
Rewrite `redundant_optional_initialization` with SwiftSyntax ( #4409 )
2022-10-23 20:30:29 -04:00
Marcelo Fabri
5d1906456b
Rewrite `xct_specific_matcher` with SwiftSyntax ( #4462 )
2022-10-23 19:17:29 -04:00
Marcelo Fabri
53752f58ad
Rewrite `redundant_set_access_control` with SwiftSyntax ( #4395 )
2022-10-23 15:30:01 -07:00
Marcelo Fabri
c98ffcc940
Rewrite `convenience_type` rule with SwiftSyntax ( #4452 )
2022-10-23 15:28:55 -07:00
Marcelo Fabri
351c8be2e0
Rewrite `return_arrow_whitespace` with SwiftSyntax ( #4413 )
2022-10-23 15:06:14 -07:00
JP Simard
cb79584c7d
Migrate `comment_spacing` to use SwiftSyntax classifications ( #4460 )
2022-10-23 17:39:38 -04:00
Marcelo Fabri
def404259f
Add more repos to oss-check ( #4453 )
2022-10-23 14:21:02 -07:00
JP Simard
de7996f5c7
Rewrite `discarded_notification_center_observer` with SwiftSyntax ( #4459 )
2022-10-23 20:35:09 +00:00
JP Simard
b4f45aa55e
Move TSan Runs CI job to Buildkite ( #4457 )
...
Now that we have more Buildkite machines, these should be faster than
running on Azure Pipelines.
Also remove the `//bazel:xcode_config` configurations since they should
no longer be in use.
2022-10-23 13:05:28 -04:00
JP Simard
f0f46a45eb
[OSSCheck] Cache repos ( #4456 )
...
This should speed up OSSCheck runs considerably.
In my local testing, cloning repos goes from 77s to 29s on a 100 Mbps
connection.
2022-10-23 12:20:11 -04:00
JP Simard
1ee5154687
Update SwiftSyntax to `fa7ff05` ( #4455 )
...
There's a new SwiftParserDiagnostics module and the rewriter visit
function signatures changed.
2022-10-23 11:56:22 -04:00
JP Simard
401d0f7929
Update SwiftSyntax to `60c7037` ( #4454 )
...
This has changes to how comments are associated to nodes.
See https://github.com/apple/swift-syntax/pull/985
2022-10-23 11:15:27 -04: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
60054da0f7
Rewrite `prefer_self_type_over_type_of_self` with SwiftSyntax ( #4451 )
2022-10-23 06:06:16 -07:00
Marcelo Fabri
35fcf55198
Rewrite `reduce_into` rule with SwiftSyntax ( #4447 )
2022-10-23 07:58:48 -04:00
Marcelo Fabri
cee4af098f
Migrate `prefer_zero_over_explicit_init` to SwiftSyntax ( #4448 )
2022-10-23 04:53:00 -07:00
Marcelo Fabri
9c8708bc01
Extract common SwiftSyntax extensions ( #4445 )
2022-10-23 00:54:18 -07:00
Marcelo Fabri
7b1099a33d
Rewrite `prefixed_toplevel_constant` with SwiftSyntax ( #4425 )
2022-10-21 13:11:40 -07:00
JP Simard
359699cea7
Report memory usage when `--benchmark` is specified ( #4442 )
...
With the memory increase related to
https://github.com/apple/swift-syntax/issues/921 ,
I wanted a way to quickly know how much memory was being used by
SwiftLint.
Here's how much memory it took to lint SwiftLint itself at various
versions in the last few weeks:
* 0.49.1: 223 MB
* 0.50.0-rc.1: 356 MB
* 0.50.0-rc.2: 444 MB
* main (458916174
): 464 MB
```console
$ swiftlint --progress --benchmark
Linting Swift files in current working directory
529 of 529 [==============================] ETA: 0s (121 files/s)
Done linting! Found 0 violations, 0 serious in 529 files.
Memory used: 464 MB
$ swiftlint --progress --benchmark
Linting Swift files in current working directory
529 of 529 [==============================] ETA: 0s (16220 files/s)
Done linting! Found 0 violations, 0 serious in 529 files.
Memory used: 55.8 MB
```
2022-10-21 19:04:43 +00:00
JP Simard
4589161742
Rewrite `redundant_objc_attribute` with SwiftSyntax ( #4441 )
2022-10-21 18:28:21 +00:00
JP Simard
5af8e3dd68
Rewrite `lower_acl_than_parent` with SwiftSyntax ( #4432 )
...
And fix violations in SwiftLint.
2022-10-21 09:31:10 -04:00
Marcelo Fabri
1fb04902c0
Rewrite `multiline_parameters` rule with SwiftSyntax ( #4438 )
2022-10-21 09:08:27 +00:00
Marcelo Fabri
0dfc7a85b5
Rewrite `required_deinit` rule with SwiftSyntax ( #4439 )
2022-10-21 08:33:54 +00:00
Marcelo Fabri
a4fbec355c
Validate protocols in `type_name` rule ( #4433 )
...
Fixes #4430
2022-10-21 00:11:18 -07:00
Marcelo Fabri
8f3a23e1a9
[oss-check] Add Pocket-Casts ( #4436 )
2022-10-20 19:04:43 -07:00
Marcelo Fabri
ead4ca9b56
Revert "Add Automattic/pocket-casts-ios to oss-check ( #4434 )" ( #4435 )
...
This reverts commit 2d76e43068
.
2022-10-20 18:54:10 -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
2d76e43068
Add Automattic/pocket-casts-ios to oss-check ( #4434 )
2022-10-20 16:51:44 -07:00
JP Simard
e84430f222
Update SwiftSyntax ( #4431 )
2022-10-20 13:16:00 -04:00
Marcelo Fabri
469a3aa87a
Rewrite `type_name` rule with SwiftSyntax ( #4428 )
2022-10-20 09:22:39 -07:00
Marcelo Fabri
59ad84f6e9
Add ns_number_init_as_function_reference rule ( #4414 )
2022-10-20 09:15:17 -07:00
Marcelo Fabri
fd722892e5
Rewrite `notification_center_detachment` with SwiftSyntax ( #4422 )
2022-10-20 09:14:51 -07:00
Marcelo Fabri
c46fd55711
Migrate `file_name` rule to SwiftSyntax ( #4423 )
2022-10-20 09:14:08 -07:00
Marcelo Fabri
2929e35183
Rewrite `single_test_class` rule with SwiftSyntax ( #4424 )
2022-10-20 09:13:23 -07:00
Marcelo Fabri
533917dced
Rewrite `raw_value_for_camel_cased_codable_enum` with SwiftSyntax ( #4427 )
2022-10-20 08:23:32 -07:00
JP Simard
25c9d34f5a
Update SwiftSyntax ( #4429 )
2022-10-20 09:21:14 -04:00
Marcelo Fabri
d11dc2b321
Add changelog for https://github.com/realm/SwiftLint/pull/4421
2022-10-19 23:24:16 -07:00
Marcelo Fabri
62c8985a3e
Make `Quick*` rules more permissive ( #4421 )
...
Fixes #4420
2022-10-19 16:08:35 -07:00
JP Simard
230688848e
Update CI docs ( #4419 )
...
To reflect the need to install `bazelisk`.
2022-10-19 14:14:47 +00:00
JP Simard
eb8971a933
Update CI docs ( #4418 )
...
Needs the `HOME` environment variable to bet set with some machines.
2022-10-19 09:10:36 -04:00
JP Simard
016831d471
Update CI machine setup instructions ( #4416 )
2022-10-19 07:49:18 -04:00
Marcelo Fabri
93b016bca3
Migrate `unavailable_function` to SwiftSyntax ( #4387 )
2022-10-18 20:19:27 -07:00
Marcelo Fabri
bf716d7089
Rewrite `unused_capture_list` with SwiftSyntax ( #4412 )
2022-10-18 20:16:39 -07:00
Marcelo Fabri
d3274565a1
Migrate `compiler_protocol_init` rule to SwiftSyntax ( #4392 )
2022-10-18 20:14:00 -07:00
Marcelo Fabri
04d7ce05ca
Rewrite `joined_default_parameter` with SwiftSyntax ( #4411 )
2022-10-18 20:12:56 -07:00
Marcelo Fabri
bda8487ed2
Rewrite `prefer_nimble` rule with SwiftSyntax ( #4410 )
2022-10-18 01:42:08 -07:00
Danny Mösch
a8bc9e9b42
Let more rules rely on SwiftSyntaxRule's defaults ( #4401 )
2022-10-18 02:23:39 -04:00
Marcelo Fabri
286e59a0e6
Fix false positive in `nsobject_prefer_isequal` rule ( #4408 )
...
Fixes #4404
2022-10-17 22:26:37 -07:00
Marcelo Fabri
db910946dc
Simplift `DiscouragedNoneNameRule` implementation ( #4407 )
2022-10-18 04:43:40 +00:00
JP Simard
1837ae59cb
Rewrite `legacy_objc_type` with SwiftSyntax ( #4372 )
2022-10-17 17:29:09 -04:00
Marcelo Fabri
03848ce583
Make `DiscouragedNoneNameRule` opt-in again ( #4403 )
...
I mistakenly made it enable by default when rewriting it
2022-10-17 17:01:42 -04:00
JP Simard
e9f2248072
Remove dead code in `DiscouragedDirectInitRule.swift` ( #4402 )
2022-10-17 18:25:02 +00:00
Marcelo Fabri
9a9629c1e8
Rewrite `discouraged_direct_init` with SwiftSyntax ( #4397 )
2022-10-17 10:47:46 -07:00
JP Simard
1b86aa7eeb
Simplify `SwitchCaseAlignmentRule` ( #4399 )
...
By using `ReasonedRuleViolation`, `SwiftSyntaxRule` and `makeVisitor()`.
2022-10-17 10:59:07 -04:00
JP Simard
8ec6e0eefc
Update SwiftSyntax ( #4398 )
...
https://github.com/apple/swift-syntax/pull/938 was impacting some
corrections in Lyft's codebase.
2022-10-17 09:42:02 -04:00
Marcelo Fabri
937228d1ba
Add `function_parameter_count` to CHANGELOG
2022-10-17 00:44:43 -07:00
Marcelo Fabri
0504d2c3f9
Migrate `function_parameter_count` to SwiftSyntax ( #4394 )
2022-10-17 00:44:17 -07:00
Marcelo Fabri
07be57027a
Add more rewritten rules to CHANGELOG
2022-10-16 23:55:42 -07:00
Marcelo Fabri
844b7c02dd
Rewrite `trailing_comma` rule with SwiftSyntax ( #4385 )
2022-10-16 23:36:11 -07:00
Marcelo Fabri
b4ec2d360d
Rewrite `unused_control_flow_label` with SwiftSyntax ( #4339 )
2022-10-16 22:58:01 -07:00
Marcelo Fabri
89c227ecaa
Migrate `weak_delegate` rule to SwiftSyntax ( #4389 )
...
* Migrate `weak_delegate` rule to SwiftSyntax
* Remove unused declarations
2022-10-16 22:57:42 -07:00
Marcelo Fabri
6f4b75b0f6
Migrate `legacy_constructor` to SwiftSyntax ( #4386 )
2022-10-16 22:56:25 -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
Marcelo Fabri
56a23448c3
Migrate `unused_enumerated` to SwiftSyntax ( #4391 )
2022-10-16 22:34:26 -07:00
Marcelo Fabri
bb1de21059
Convert `enum_case_associated_values_count` to SwiftSyntax ( #4393 )
2022-10-16 22:34:12 -07:00
Marcelo Fabri
89c24cd52d
Rewrite `fatal_error_message` rule with SwiftSyntax ( #4230 )
2022-10-16 20:52:09 -04:00
Danny Mösch
0fbd03cf2b
Require visitors to exist ( #4383 )
2022-10-16 18:40:12 +02:00
Marcelo Fabri
8b96aa0585
Make UnavailableConditionRule conform to SwiftSyntaxRule ( #4388 )
2022-10-16 07:49:36 -07:00
Marcelo Fabri
7ff3094821
Support .focused() in keys for corrections ( #4384 )
2022-10-16 07:50:10 -04: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
9959f971f9
Add way to preprocess syntaxTree in SwiftSyntaxRule ( #4381 )
...
* Add way to preprocess syntaxTree in SwiftSyntaxRule
* Update Source/SwiftLintFramework/Protocols/SwiftSyntaxRule.swift
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
* Update Source/SwiftLintFramework/Protocols/SwiftSyntaxRule.swift
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
2022-10-16 01:40:02 -07:00
Danny Mösch
dcf03f5987
Fix compilation errors ( #4380 )
2022-10-15 22:49:16 -04:00
Marcelo Fabri
860b027005
Migrate `private_over_fileprivate` to SwiftSyntax ( #4376 )
2022-10-15 14:49:16 -07:00
Marcelo Fabri
4aa9588454
Rewrite `function_default_parameter_at_end` with SwiftSyntax ( #4320 )
...
* Rewrite `function_default_parameter_at_end` with SwiftSyntax
* Fix oss-check issues
* Handle optional closures
* Handle other closure types
* Fix violation
* Handle @autoclosure
2022-10-15 14:48:59 -07:00
Marcelo Fabri
37bf2c9168
Rewrite `discouraged_none_name` with SwiftSyntax ( #4377 )
...
* Rewrite `discouraged_none_name` with SwiftSyntax
* Handle `none`
2022-10-15 14:48:38 -07:00
Danny Mösch
bd8c9e5bcb
Provide syntax visitor base class allowing for convenient skipping of declaration nodes ( #4310 )
2022-10-15 19:03:49 +02:00
Marcelo Fabri
510cb39b11
Rewrite `quick_discouraged_pending_test` with SwiftSyntax ( #4378 )
2022-10-15 04:21:38 -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
Marcelo Fabri
e74e11533c
Rewrite `valid_ibinspectable` rule with SwiftSyntax ( #4322 )
...
* Rewrite `valid_ibinspectable` rule with SwiftSyntax
* Fix false positives
2022-10-14 20:32:03 -07:00
Danny Mösch
a7ff8a8d76
Rename `if_let_shadowing` rule to `shorthand_optional_binding` ( #4334 )
2022-10-14 21:47:37 +00:00
JP Simard
7585aef910
Rewrite `reduce_boolean` with SwiftSyntax ( #4375 )
2022-10-14 07:03:30 -04:00
JP Simard
f04e28cbf8
Rewrite `switch_case_alignment` with SwiftSyntax ( #4373 )
2022-10-14 10:06:54 +00:00
JP Simard
39bb05f7d1
Rewrite "body length" rules with SwiftSyntax ( #4370 )
...
- `closure_body_length`
- `function_body_length`
- `type_body_length`
2022-10-14 03:50:39 -04:00
JP Simard
7624059caa
Rewrite `unused_closure_parameter` with SwiftSyntax ( #4371 )
2022-10-14 03:35:51 -04:00
JP Simard
fa6bf50a22
Rethink body line count calculation ( #4369 )
...
A long-standing limitation with SourceKit's "editor open" request is
that we weren't able to get certain tokens, such as braces, brackets and
parentheses.
This meant that this code block would be counted as two lines:
```swift
print(
"hi"
)
```
because the trailing `)` would be treated as a whitespace line.
This meant that our "body length" family of rules that measure the
effective line count of declarations like functions, types or closures
would often significantly under-count the number of content lines in a
body.
Now with SwiftSyntax, we can get all tokens, including the ones
SourceKit was previously ignoring, so we can get much more accurate line
counts when ignoring whitespace and comments.
In addition, we weren't very thorough in how we measured body length.
As an exercise, how many lines long would you say the body of this
function is?
```swift
func hello() {
print("hello")
}
```
Does the body span one line or three lines?
I propose that we consistently ignore the left and right brace lines
when calculating the body line count of these scopes so that we measure
body line counts like this:
```swift
// 1 line
{ print("foo") }
// 1 line
{
}
// 1 line
{
print("foo")
}
// 2 lines
{
let sum = 1 + 2
print(sum)
}
```
Now with those changes in place, in order to keep the default
configuration thresholds to similar levels as before, we need to adjust
them slightly. Here's what I'm suggesting:
|Rule|Before|After|
|-|-|-|
|closure_body_length|20/100|30/100|
|function_body_length|40/100|50/100|
|type_body_length|200/350|250/350|
This is a pretty significant breaking change and I suspect we'll hear
from users who are surprised that some of their declarations now exceed
the rule limits, but I believe this new approach to calculating body
lines is more correct and intuitive compared to what we've had until
now.
OSSCheck is also going to report a bazillion changes with this, which is
expected given the scope of this change.
2022-10-14 03:16:26 -04:00
JP Simard
5c3d4c1dab
Rewrite `legacy_hashing` with SwiftSyntax ( #4367 )
2022-10-13 16:27:54 +00:00
JP Simard
02b5a034d2
Rewrite `is_disjoint` with SwiftSyntax ( #4368 )
2022-10-13 12:22:57 -04:00
JP Simard
48fde2321f
Rewrite `contains_over_first_not_nil` & `last_where` with SwiftSyntax ( #4366 )
...
Replace `MemberAccessExprSyntax.functionCallBase` with
`ExprSyntax.asFunctionCall` so we can use it in more places.
Move `TokenKind.isEqualityComparison` into `SwiftSyntax+SwiftLint.swift`
2022-10-13 15:59:30 +00:00
JP Simard
8d29b21ecb
Rewrite `sorted_first_last` & `first_where` with SwiftSyntax ( #4365 )
...
Add a `functionCallBase` helper.
2022-10-13 15:30:22 +00:00
JP Simard
3bae16bee5
Rewrite `contains_over_filter_is_empty` with SwiftSyntax ( #4364 )
2022-10-13 10:45:40 -04:00
JP Simard
33f6ee1f36
Update SwiftSyntax ( #4363 )
...
Noteworthy:
* https://github.com/apple/swift-syntax/pull/912
* https://github.com/apple/swift-syntax/pull/932
2022-10-13 10:28:00 -04:00
JP Simard
de0b91cd5a
Print violations in realtime if progress with an output file ( #4362 )
2022-10-13 06:23:24 +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
JP Simard
2f300502c0
Fix changelog formatting ( #4361 )
2022-10-13 00:36:25 -04:00
Danny Mösch
9db88947b9
Fix bugs when auto-correcting content given via stdin ( #4212 )
...
Fixes #4211 .
Fixes #4234 .
Fixes #4347 .
2022-10-13 00:34:48 -04:00
Marcelo Fabri
99436906cd
Rewrite `self_in_property_initialization` with SwiftSyntax ( #4343 )
2022-10-12 20:58:57 -07:00
JP Simard
7653b2d635
Update link to video presentation in readme ( #4360 )
...
This link has had a broken video resource for years.
The video was just re-published.
2022-10-12 22:49:45 -04:00
Danny Mösch
b4e01ba1b4
Disregard whitespace differences in `identical_operands` rule ( #4331 )
2022-10-12 23:38:00 +02:00
JP Simard
b9653e3e1b
Replace `swift run` with `swift build --product` ( #4357 )
2022-10-12 15:51:10 -04:00
JP Simard
9aaeff67d0
Add `SyntaxProtocol.isContainedIn(regions:locationConverter:)` helper ( #4356 )
2022-10-12 19:50:32 +00:00
JP Simard
1a7f03bbc5
Rewrite `redundant_discardable_let` with SwiftSyntax ( #4355 )
2022-10-12 15:27:03 -04:00
JP Simard
b849234572
Remove `Configuration.FileGraph.Vertix.configurationString` property ( #4354 )
...
It's unused and for large configuration files this uses unnecessary
memory.
2022-10-12 17:16:27 +00:00
JP Simard
0282bf1923
Remove optionality in getting syntax tree and source location converter ( #4353 )
...
Parsing does not throw errors.
See https://github.com/apple/swift-syntax/pull/912 .
2022-10-12 12:50:17 -04:00
JP Simard
4b04e528af
Revert "Run TSan job on Azure Pipelines with Bazel ( #4130 )" ( #4350 )
...
This reverts commit 848ec452c3
.
This appears to be slower most of the time.
2022-10-12 14:26:45 +00:00
JP Simard
602070164b
Reduce memory usage ( #4349 )
...
When linting SwiftLint, this brings memory usage down by around 20%,
going from 372MB to 297MB.
This is achieved by removing the unused `RebuildQueue` and by clearing
cached data associated with files after processing them.
Depends on https://github.com/jpsim/SourceKitten/pull/749 .
2022-10-12 09:39:36 -04:00
JP Simard
87e9757af2
Update SwiftSyntax ( #4346 )
...
I think there might have been changes impacting the `static_operator`
rule, so I want to look more into those here.
Remove workaround for https://github.com/apple/swift-syntax/issues/888
2022-10-11 21:12:29 -04:00
Marcelo Fabri
81ee297908
Rewrite `unused_setter_value` rule with SwiftSyntax ( #4342 )
2022-10-11 13:08:40 -07:00
JP Simard
016c7b6abd
[Bazel] Fix CryptoSwift compiler warnings ( #4345 )
...
Pulls in https://github.com/krzyzanowskim/CryptoSwift/pull/989
2022-10-11 14:22:22 -04:00
Marcelo Fabri
6998d8af23
Migrate `shorthand_operator` rule to SwiftSyntax ( #4336 )
...
* Migrate `shorthand_operator` rule to SwiftSyntax
* Remove unneeded imports
2022-10-10 21:28:55 -07:00
Marcelo Fabri
4da2ff1118
Rewrite `operator_whitespace` rule with SwiftSyntax ( #4335 )
2022-10-10 14:12:03 -07:00
Marcelo Fabri
05d98b84cf
Rewrite `quick_discouraged_focused_test` with SwiftSyntax ( #4338 )
2022-10-10 14:11:37 -07:00
Marcelo Fabri
ec05864880
Rewrite `nslocalizedstring_require_bundle` with SwiftSyntax ( #4337 )
2022-10-10 14:11:28 -07:00
Marcelo Fabri
b938a4e07d
Convert `number_separator` rule to SwiftSyntax ( #4333 )
2022-10-09 21:03:57 -07:00
Marcelo Fabri
ca7510a394
Migrate `static_operator` rule to SwiftSyntax ( #4271 )
...
* Migrate `static_operator` rule to SwiftSyntax
* PR feedback
2022-10-08 01:49:15 -07:00
Marcelo Fabri
04bd091810
Migrate `legacy_multiple` rule to SwiftSyntax ( #4317 )
2022-10-07 23:49:14 -07:00
Danny Mösch
82e916db15
Extend SyntaxProtocol to avoid wrapping ( #4332 )
2022-10-07 19:41:08 -04:00
Danny Mösch
957208c44b
Make `nsobject_prefer_isequal` rule work for nested classes ( #4329 )
2022-10-08 00:21:16 +02:00
JP Simard
fe6a930bd4
Use os_unfair_lock instead of NSLock on Darwin ( #4330 )
2022-10-07 20:42:22 +00:00
Marcelo Fabri
8bcf8713e9
Convert `discouraged_assert` rule to SwiftSyntax ( #4316 )
2022-10-07 13:40:23 -07:00
Marcelo Fabri
d913c8e63b
Rewrite `legacy_random` rule with SwiftSyntax ( #4318 )
2022-10-07 13:35:13 -07:00
Marcelo Fabri
b01e1504a1
Rewrite `prohibited_interface_builder` with SwiftSyntax ( #4321 )
2022-10-07 13:33:49 -07:00
JP Simard
3ac518ce69
Only build `swiftlint` target in Makefile ( #4327 )
...
Otherwise this tries to build the SwiftLintTestHelpers module in release
mode, which fails.
Also, to build the actual executable CLI, we can't just
`swift build --target=swiftlint` because that doesn't produce a CLI,
just the object file for the binary. So we have to `swift run`.
2022-10-07 16:50:56 +00:00
JP Simard
0c06b7f65f
Fix jpsim GitHub URL in changelog
2022-10-07 12:14:21 -04:00
JP Simard
1a76a882ca
Ignore incorrect keypath parser diagnostics ( #4325 )
...
Works around https://github.com/apple/swift-syntax/issues/888
2022-10-07 10:33:13 -04:00
JP Simard
f34169575c
Update rules_apple to 1.1.2 ( #4324 )
...
https://github.com/bazelbuild/rules_apple/releases/tag/1.1.2
2022-10-07 10:22:23 -04:00
JP Simard
9c53c94736
Update rules_xcodeproj to 0.9 ( #4323 )
...
https://github.com/buildbuddy-io/rules_xcodeproj/releases/tag/0.9.0
2022-10-07 10:14:46 -04:00
Marcelo Fabri
515587fb9f
Convert `strict_fileprivate` rule to SwiftSyntax ( #4319 )
2022-10-07 02:11:32 -07:00
Marcelo Fabri
f174a55c94
Migrate `explicit_enum_raw_value` rule to SwiftSyntax ( #4281 )
...
* Migrate `explicit_enum_raw_value` rule to SwiftSyntax
* Handle nested enums
2022-10-07 00:56:15 -07:00
Marcelo Fabri
c0a4dd1be7
Rewrite IdenticalOperandsRule with SwiftSyntax ( #3894 )
...
* Rewrite IdenticalOperandsRule with SwiftSyntax
* Use folding algorithm from swift-format
* Add workaround for debug builds
* Update implementation after rebasing
* Use SwiftOperators
* Remove focused
2022-10-07 00:55:41 -07:00
JP Simard
1533e72fd4
Specify `@SwiftLint` workspace in opt_wrapper.bzl load ( #4314 )
2022-10-06 16:59:24 -04:00
JP Simard
549c71a27c
Introduce LegacyFunctionRuleHelper ( #4312 )
2022-10-06 16:48:51 -04:00
Keith Smiley
367389a489
[bazel] For SwiftSyntax to compile with optimizations ( #4311 )
...
This avoids potential stack overflows and slowness when just working on
SwiftLint itself with bazel. These compiles take a lot longer but as
long as you're not updating swift-syntax that should be a 1 time penalty
2022-10-06 15:54:41 -04:00
JP Simard
ef248f6529
Remove Signal from OSSCheck ( #4313 )
...
It's misbehaving for some reason. It'd be good if anyone wanted to look
into that.
2022-10-06 15:40:18 -04:00
JP Simard
a6c90dd942
Rewrite `legacy_cggeometry_functions` with SwiftSyntax ( #4309 )
2022-10-06 15:16:49 -04:00
Danny Mösch
2a95f1bde9
Add tests for `fileprivate` to `private_outlet` rule ( #4308 )
2022-10-06 19:13:25 +02:00
JP Simard
5ba9d60f8d
Rewrite `legacy_nsgeometry_functions` with SwiftSyntax ( #4307 )
2022-10-06 12:46:27 -04:00
Danny Mösch
8345545865
Make `private_unit_test` rule correctable ( #4293 )
2022-10-06 18:03:03 +02:00
JP Simard
d6fd754679
Rewrite `contains_over_range_nil_comparison` with SwiftSyntax ( #4225 )
...
Use SwiftOperators.
2022-10-06 01:18:31 -04:00
JP Simard
a8d3813cc7
Fix Dockerfile to account for new test modules ( #4306 )
2022-10-06 00:36:04 -04:00
JP Simard
5ae1d98596
Create new GeneratedTests and IntegrationTests test targets ( #4304 )
...
* Move generated rule tests to a dedicated GeneratedTests target
* Move integration tests to a dedicated IntegrationTests target
This will improve bazel cacheability by having fewer tests depend on all
lint inputs, which are only needed by the integration tests.
2022-10-06 00:10:04 -04:00
JP Simard
d3fd234883
Fix Dockerfile to account for SwiftLintTestHelpers ( #4305 )
2022-10-05 23:53:14 -04:00
JP Simard
503f8c506b
Move ExtraRulesTests to its own target & directory ( #4300 )
...
Also create a SwiftLintTestHelpers test target.
2022-10-05 23:36:46 -04:00
JP Simard
8470b65ae9
Simplify analyze bazel test ( #4303 )
...
By removing SourceAndTestFiles since those files should all be covered
by LintInputs.
2022-10-05 23:25:54 -04:00
JP Simard
4552facb7e
[LegacyConstantRule] Remove unused patterns ( #4302 )
...
We now just need these patterns for the mapping of legacy to new.
2022-10-05 22:42:09 -04:00
JP Simard
c29e1673dd
Rewrite `legacy_constant` with SwiftSyntax ( #4299 )
2022-10-05 21:55:48 -04:00
JP Simard
cfabd8ec99
Organize `Tests/BUILD` with comments ( #4301 )
2022-10-05 21:40:12 -04:00
JP Simard
91d4a42687
Loosen correction location assertions ( #4297 )
...
With SwiftSyntax rewriters, the visitors get called with the new nodes
after previous mutations have been applied, so it's not straightforward
to translate those back into the original source positions.
So only check the first locations.
2022-10-05 20:51:46 -04:00
JP Simard
7af26f0f77
[CI] Increase TSan test timeout to 1,000 seconds (~16 minutes) ( #4298 )
...
We're starting to hit this timeout.
2022-10-05 20:45:07 -04:00
Marcelo Fabri
c087e79437
[oss-check] Add DuckDuckGo and Signal ( #4275 )
2022-10-05 19:00:37 -04:00
JP Simard
54ec0c9b28
Rewrite `trailing_semicolon` with SwiftSyntax ( #4296 )
2022-10-05 18:46:14 -04:00
JP Simard
3834e52ac4
Rewrite `empty_parameters` with SwiftSyntax ( #4295 )
2022-10-05 18:26:57 -04:00
JP Simard
5d9a72b2a5
Make `allow_private_set` allow `fileprivate(set)` too ( #4294 )
...
As was previously the case.
2022-10-05 17:32:28 -04:00
Danny Mösch
af222a5754
Ignore static methods in `private_unit_test` rule ( #4292 )
...
Static methods cannot be tests.
2022-10-05 21:00:06 +00:00
JP Simard
54ccc39e72
Update SwiftSyntax ( #4290 )
...
Just staying up to date here.
There's no need to frequently update, but given that we just updated to
trunk, I wanted to make sure we can update without issues.
2022-10-05 16:28:56 -04:00
JP Simard
8b578ebf36
Update changelog entry for rules rewritten using SwiftSyntax ( #4291 )
2022-10-05 16:11:04 -04:00
JP Simard
2eb764d0c9
Update Dockerfile for plugin support ( #4289 )
2022-10-05 15:34:55 -04:00
JP Simard
13c45a5c15
Add resolved issues to plugin changelog entry ( #4288 )
2022-10-05 15:31:11 -04:00
Johannes Ebeling
3fd1573c57
Make SwiftLint available as a build tool plugin ( #4176 )
...
* ✨ (spm) add build tool plugin definition for swiftlint
* 📝 (changelog) add changelog item for the plugin
* 🐛 (cache) define cache path explicitly to avoid issues during build without issues
* 🎨 minor code cleanup
* 📝 document usage with Xcode as well as Swift packages
2022-10-05 15:28:19 -04:00
JP Simard
6d75645f67
[CI] Disable xcodebuild tests ( #4287 )
...
This is failing very often now due to FB11648454.
Given that we run these tests on macOS via SwiftPM and Bazel as well,
I'm satisfied with the amount of coverage we have on our tests without
this.
2022-10-05 15:26:14 -04:00
Danny Mösch
8eec5e6997
Rewrite `private_unit_test` with SwiftSyntax ( #4285 )
2022-10-05 21:15:25 +02:00
JP Simard
44382ea397
Avoid making SourceKit requests to get parser diagnostics ( #4286 )
...
By using SwiftSyntax instead, we avoid the overhead of a SourceKit
request, which has a significant impact if none of the rules being
corrected use SourceKit.
2022-10-05 15:38:11 +00:00
JP Simard
41b8834a13
Rewrite `private_outlet` with SwiftSyntax ( #4228 )
2022-10-05 11:29:01 -04:00
Marcelo Fabri
a40cc70478
Migrate `no_extension_access_modifier` to SwiftSyntax ( #4270 )
...
* Migrate `no_extension_access_modifier` to SwiftSyntax
* PR feedback
2022-10-05 00:56:42 -04:00
Marcelo Fabri
1cbf3caae1
Migrate `anonymous_argument_in_multiline_closure` to SwiftSyntax ( #4279 )
2022-10-04 20:57:22 -07:00
JP Simard
0f9705901b
Add column for SourceKit usage to `rules` command ( #4284 )
2022-10-04 18:52:03 +00:00
Vasiliy Kattouf
129a55fb74
Add ability to filter rules for `generate-docs` subcommand ( #4195 )
...
Added rules filtering options, like in the `rules` subcommand.
<img width="880" alt="generate-docs--help" src="https://user-images.githubusercontent.com/7829589/189372666-2f5aba62-57a1-49dc-9155-c60f9e085984.png ">
To achieve reuse with `rules` subcommand:
- extracted filtering logic into `RulesFilter` (and write tests)
- extracted filtering command line parameters into `RulesFilterOptions: ParsableArguments`
2022-10-04 18:45:52 +00:00
Marcelo Fabri
c70510c3ea
Migrate `strong_iboutlet` to SwiftSyntax ( #4277 )
2022-10-04 10:03:33 -07:00
JP Simard
6bfecb8fcc
Rewrite `nsobject_prefer_isequal` with SwiftSyntax ( #4283 )
2022-10-04 16:34:24 +00:00
JP Simard
db20dbb4a3
Replace mutating for-in with `reduce(into:)` ( #4282 )
2022-10-04 11:47:27 -04:00
JP Simard
46649c8662
Rewrite `explicit_init` with SwiftSyntax ( #4223 )
2022-10-04 11:20:00 -04:00
JP Simard
1662a38922
Rewrite `ibinspectable_in_extension` with SwiftSyntax ( #4227 )
2022-10-04 09:28:46 -04:00
JP Simard
18ab68859c
Rewrite `contains_over_filter_count` with SwiftSyntax ( #4226 )
2022-10-04 09:14:27 -04:00
Danny Mösch
ab3f070222
Introduce `SeverityBasedRuleConfiguration` to avoid custom `makeViolation`s ( #4274 )
2022-10-04 07:39:07 +02:00
Marcelo Fabri
e3f1b56129
Convert `duplicate_enum_cases` rule to SwiftSyntax ( #4263 )
2022-10-03 13:20:43 -07:00
Marcelo Fabri
26ca731cf0
Migrate `deployment_target` rule to SwiftSyntax ( #4268 )
2022-10-03 10:18:56 -07:00
Marcelo Fabri
8926596da0
Migrate `closure_parameter_position` to SwiftSyntax ( #4264 )
2022-10-03 10:18:43 -07:00
Marcelo Fabri
647819eedc
Migrate `switch_case_on_newline` to SwiftSyntax ( #4269 )
2022-10-03 09:28:29 -07:00
Marcelo Fabri
f37ea8acc4
Migrate `no_fallthrough_only` rule to SwiftSyntax ( #4266 )
2022-10-03 09:28:14 -07:00
Marcelo Fabri
ac91f7bfa0
Migrate `private_action` rule to SwiftSyntax ( #4267 )
2022-10-03 09:27:29 -07:00
Marcelo Fabri
462f741065
Rewrite `redundant_string_enum_value` with SwiftSyntax ( #4243 )
2022-10-02 17:29:55 -07:00
Marcelo Fabri
268415893d
Rewrite protocol_property_accessors_order with SwiftSyntax ( #4237 )
...
* Rewrite protocol_property_accessors_order with SwiftSyntax
* PR feedback
2022-10-02 17:29:04 -07:00
JP Simard
2388e49190
Use SwiftSyntax's new SwiftParser ( #4216 )
2022-10-01 15:05:36 -04:00
JP Simard
b2caef7202
Generate Swift Syntax Dashboard in documentation ( #4260 )
...
This is a useful overview of where the migration effort stands and what
rules can be migrated next.
2022-10-01 11:29:10 -04:00
Danny Mösch
2efd538d37
Explain where to get syntax kinds for custom rules from ( #4246 )
2022-09-30 20:23:05 +02:00
Benjamin Kramer
0fe3404494
Add configuration `only_enforce_before_trivial_lines` to `vertical_whitespace_closing_braces` rule ( #3941 )
...
Vertical whitespace may be important for readability when the line
with the closing brace is not a trivial one (e.g. `} else if ... {`).
The configuration allows not enforcing the rule in such cases.
2022-09-29 20:26:51 +02:00
Danny Mösch
da75cdca40
Remove instructions for Atom editor ( #4255 )
...
Atom editor will be sunset at the end of the year.
2022-09-29 06:49:35 +02:00
JP Simard
86f6023d13
Update CryptoSwift to 1.6.0 release ( #4258 )
2022-09-28 23:37:54 -04:00
JP Simard
afb46dc76d
Remove anyobject_protocol from configuration ( #4257 )
...
It's been deprecated and the compiler catches these now.
2022-09-28 23:23:06 -04:00
Marcelo Fabri
a40488feaf
Rewrite `inert_defer` rule with SwiftSyntax ( #4242 )
2022-09-28 19:57:00 -07:00
JP Simard
d2c638b5e4
[bazel] Enable WMO in `release` configuration ( #4252 )
...
Enabling WMO can make SwiftLint up to 90% faster in my testing, and
matches what SwiftPM does when building with `swift buid -c release`.
2022-09-27 21:56:17 -04:00
JP Simard
86a176d4c6
[bazel] Fix release config ( #4253 )
2022-09-27 21:39:29 -04:00
JP Simard
73def99b49
[bazel] Define a `release` configuration ( #4251 )
...
This will be used to put release configurations, like WMO.
2022-09-27 21:34:27 -04:00
JP Simard
fd7afedfcf
Update SwiftSyntax & internal parser for Swift 5.7 ( #4203 )
...
Require Swift 5.7 to compile
2022-09-26 14:11:39 +00:00
Danny Mösch
c6eec8072c
Move method ( #4238 )
2022-09-25 12:31:24 -04:00
Marcelo Fabri
a4c46f624d
Rewrite `no_space_in_method_call` with SwiftSyntax ( #4236 )
2022-09-25 02:55:00 -07:00
Marcelo Fabri
734eceada0
Rewrite empty_parentheses_with_trailing_closure with SwiftSyntax ( #4235 )
2022-09-25 02:54:29 -07:00
JP Simard
4fb5ebe19b
Docker: Update to Swift 5.7 & Ubuntu Jammy ( #4241 )
...
And apply workaround for https://github.com/apple/swift/issues/59961 to
all commands.
2022-09-24 15:09:41 -04:00
JP Simard
bb309de9df
Pin Swift Docker image to 5.6.3-focal ( #4240 )
2022-09-24 13:56:41 -04:00
Danny Mösch
7be6f866fe
Add new `if_let_shadowing` rule ( #4206 )
2022-09-22 19:27:45 +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
Danny Mösch
95ffaed655
Filter out compiler argument not understood by SourceKit in Xcode 14 ( #4210 )
2022-09-20 23:24:40 +02:00
JP Simard
7b1de2f9cd
Rewrite `dynamic_inline` with SwiftSyntax ( #4218 )
2022-09-20 20:07:24 +00:00
JP Simard
49665a9ec7
Rewrite `fallthrough` with SwiftSyntax ( #4224 )
2022-09-20 15:56:57 -04:00
Danny Mösch
0ea26edd4f
Skip autocorrecting usage of `NSIntersectionRect` ( #4213 )
2022-09-20 07:09:05 +02:00
Danny Mösch
2efa085dd4
Make `willMove` a lifecycle method in `type_contents_order` rule ( #4201 )
2022-09-19 23:27:15 +02:00
dahlborn
f3d367f667
Add `LibraryContentProvider` to `file_types_order` rule ( #4209 )
2022-09-19 22:15:41 +02:00
JP Simard
345a904055
Rewrite `empty_enum_arguments` with SwiftSyntax ( #4221 )
2022-09-19 20:12:21 +00:00
JP Simard
0808f2508b
Fix typo in example ( #4222 )
2022-09-19 15:51:21 -04:00
JP Simard
8d500d1a63
Rewrite `empty_collection_literal` with SwiftSyntax ( #4220 )
2022-09-19 12:39:35 +02:00
JP Simard
992cc9afe3
Rewrite `discouraged_object_literal` with SwiftSyntax ( #4219 )
2022-09-19 10:24:22 +00:00
Danny Mösch
49ace1729f
Add Swift 5.6.3 to version test ( #4207 )
2022-09-14 23:20:51 +02:00
Danny Mösch
38e71f7a10
Enhance docs for `type_name` rule ( #4197 )
2022-09-10 10:54:13 -04:00
tillhainbach
a9ec894caf
Add exceptions to `weak_delegate` rule ( #3599 )
2022-09-10 10:07:43 -04:00
Chris Brakebill
9db303e3a3
Respect 'validates_start_with_lowercase' for function names in `identifier_name` rule ( #4188 )
2022-09-09 23:36:55 +02:00
JP Simard
4b1bb38fc3
Include the configured `bind_identifier` in `self_binding` violation ( #4196 )
...
As suggested in https://github.com/realm/SwiftLint/pull/4146#issuecomment-1241793057
2022-09-09 16:08:26 +00:00
Marcelo Fabri
623bc8ea73
Add multiple_closures_with_trailing_closure to changelog
2022-09-08 19:34:37 +02:00
Marcelo Fabri
baf5647e2b
Rewrite `multiple_closures_with_trailing_closure` with SwiftSyntax ( #4193 )
2022-09-08 19:34:06 +02:00
JP Simard
ea574bd640
Update changelog to reflect rules rewritten with SwiftSyntax ( #4191 )
2022-09-08 05:50:58 +00:00
JP Simard
837f46479f
Rewrite `toggle_bool` with SwiftSyntax ( #4190 )
2022-09-08 05:27:44 +00:00
JP Simard
c6f3d0a6af
Rewrite `xctfail_message` with SwiftSyntax ( #4189 )
2022-09-08 00:03:44 -04:00
JP Simard
8c5d3cbfc8
Use Xcode 14 RC1 on CI ( #4186 )
...
https://twitter.com/XcodeReleases/status/1567607977900929024
2022-09-07 22:58:15 -04:00
Danny Mösch
311a724c3c
Get rid of optional return value ( #4187 )
2022-09-07 18:18:34 -04:00
Danny Mösch
6b393b1b53
Re-delegate to ArrayInitRule ( #4185 )
2022-09-07 21:14:45 +00:00
JP Simard
4234664671
Rewrite `anyobject_protocol` with SwiftSyntax & deprecate ( #4170 )
2022-09-07 19:40:34 +00:00
JP Simard
8cd025112d
Rewrite `block_based_kvo` with SwiftSyntax ( #4171 )
2022-09-07 15:16:22 -04:00
JP Simard
efbe4d9f0f
Rewrite `discouraged_optional_boolean` with SwiftSyntax ( #4179 )
2022-09-07 15:15:38 -04:00
JP Simard
4a239a695e
Rewrite `array_init` rule with SwiftSyntax ( #4175 )
2022-09-07 15:15:10 -04:00
JP Simard
bc7792ecd6
Rewrite `empty_string` with SwiftSyntax ( #4177 )
2022-09-07 13:59:15 -04:00
JP Simard
958cc20a9f
Rewrite `redundant_nil_coalescing` with SwiftSyntax ( #4182 )
2022-09-07 13:29:06 -04:00
JP Simard
117ef7f0e2
Rewrite `flatmap_over_map_reduce` with SwiftSyntax ( #4178 )
2022-09-07 13:23:51 -04:00
JP Simard
0d03221281
Rewrite `class_delegate_protocol` with SwiftSyntax ( #4172 )
2022-09-07 12:20:47 -04:00
JP Simard
80c8e5d37a
Rewrite `closing_brace` with SwiftSyntax ( #4173 )
2022-09-07 12:20:26 -04:00
JP Simard
9060d3f8e8
Rewrite `force_try` with SwiftSyntax ( #4181 )
2022-09-07 11:18:01 -04:00
JP Simard
eb30be3826
Add `SourceKitFreeRule` conformance to `FileNameNoSpaceRule` ( #4180 )
2022-09-07 10:36:57 -04:00
JP Simard
2a8d536857
Remove delegation of TypesafeArrayInitRule to ArrayInitRule ( #4174 )
...
In preparation for rewriting `ArrayInitRule` with SwiftSyntax.
2022-09-07 01:34:58 -04:00
Ryan Cole
c34955ca64
Add `accessibility_trait_for_button` rule ( #3989 )
2022-09-06 21:44:09 +00:00
Danny Mösch
e459c4ae9b
Exclude `weak_delegate` rule from autocorrection ( #4153 )
2022-09-06 22:56:51 +02:00
Marcelo Fabri
75a6d14788
Update CHANGELOG.md
2022-09-06 09:25:55 -07:00
Marcelo Fabri
e2900c4a7e
Rewrite `untyped_error_in_catch` with SwiftSyntax ( #4163 )
2022-09-06 09:25:06 -07:00
Marcelo Fabri
dd94d4ec53
Rewrite `computed_accessors_order` with SwiftSyntax ( #4165 )
2022-09-06 09:24:54 -07:00
Marcelo Fabri
1e7e0d6301
Remove references to ImplicitlyUnwrappedOptional type ( #4166 )
2022-09-06 09:01:22 -07:00
JP Simard
4b8a68072b
Call `super.visit` in `SyntaxRewriter` overrides ( #4167 )
...
As discussed in https://github.com/realm/SwiftLint/pull/4159#discussion_r962841482
2022-09-06 13:52:40 +00:00
JP Simard
26465f21ce
Add methods from SE-0348 to `UnusedDeclarationRule` ( #4168 )
...
https://github.com/apple/swift-evolution/blob/main/proposals/0348-buildpartialblock.md
2022-09-06 09:45:34 -04:00
Marcelo Fabri
b29c07e07e
Update CHANGELOG.md
2022-09-05 20:33:01 -07:00
Marcelo Fabri
622d48bd0a
Convert `unneeded_break_in_switch` to SwiftSyntax ( #4164 )
2022-09-05 20:32:29 -07:00
Marcelo Fabri
b9e6a9aed8
Rewrite unneeded_parentheses_in_closure_argument with SwiftSyntax ( #4159 )
2022-09-05 06:12:33 -04:00
Marcelo Fabri
6c0413077c
Rewrite unowned_variable_capture with SwiftSyntax ( #4161 )
2022-09-05 05:38:29 -04:00
Marcelo Fabri
772e5f5806
Delegate Location init for AbsolutePosition to existing one ( #4162 )
2022-09-05 01:47:25 -04:00
Marcelo Fabri
c7c4e0a1f3
Rewrite `implicit_getter` rule with SwiftSyntax ( #4160 )
...
* Rewrite `implicit_getter` rule with SwiftSyntax
* Handle different reason messages
* Add changelog + implicit return
2022-09-05 01:28:25 -04:00
Marcelo Fabri
ca2d3a874f
Rewrite `large_tuple` rule with SwiftSyntax ( #4156 )
...
* Rewrite `large_tuple` rule with SwiftSyntax
* Add changelog, remove import
* Update Source/SwiftLintFramework/Rules/Metrics/LargeTupleRule.swift
Co-authored-by: JP Simard <jp@jpsim.com>
Co-authored-by: JP Simard <jp@jpsim.com>
2022-09-05 01:10:59 -04:00
Marcelo Fabri
79347a1728
Rewrite ForceUnwrappingRule using SwiftSyntax ( #4155 )
2022-09-04 02:08:26 -07:00
Marcelo Fabri
c1650e6918
Add `excludes_trivial_init` for `missing_docs ( #4152 )
...
Fixes #4107
2022-09-03 22:11:57 -07:00
JP Simard
c26c40d31f
Set `.bazelversion`
...
To avoid this issue: https://github.com/bazelbuild/bazelisk/issues/220
2022-09-02 10:46:17 -04:00
JP Simard
93158a609e
Update rules_xcodeproj to 0.7.1
2022-09-02 10:39:59 -04:00
JP Simard
a3b70a0ffb
Update rules_apple/rules_swift to 1.1.1 ( #4150 )
...
https://github.com/bazelbuild/rules_apple/releases/tag/1.1.1
https://github.com/bazelbuild/rules_swift/releases/tag/1.1.1
2022-09-02 14:34:58 +00:00
JP Simard
e381a7d684
Update bazel version in readme
2022-09-02 10:10:09 -04:00
JP Simard
abad253310
Add empty changelog section
2022-09-01 12:43:37 -04:00
JP Simard
57dc1c9532
release 0.49.1
2022-09-01 12:32:19 -04:00
JP Simard
d72877a34f
Move changelog entry
2022-09-01 12:29:13 -04:00
JP Simard
ea41b9fd09
Rename default branch from `master` to `main` ( #4116 )
2022-09-01 07:09:46 -04:00
JP Simard
e0f23fa8e9
Add `--progress` flag to lint and analyze commands ( #4147 )
...
Inspired by https://github.com/jkandzi/Progress.swift
```
4948 of 29100 [===== ] ETA: 44s (540 files/s)
```
Demo:
[](https://asciinema.org/a/517985 )
2022-08-31 18:26:17 -04:00
JP Simard
4bc6588f38
Add `--output` option to lint and analyze commands ( #4148 )
...
To write to a file instead of to stdout.
Addresses https://github.com/realm/SwiftLint/issues/4048
2022-08-31 17:34:37 -04:00
JP Simard
d14cf598fd
Add SwiftSyntaxBuilder to SwiftLintFramework Bazel deps ( #4149 )
...
Even though we don't use this ourselves yet, it's useful to expose this
so that users with custom rules can access it.
2022-08-31 11:31:37 -04: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
JP Simard
f032c82b59
Fix link in comments ( #4145 )
2022-08-29 14:29:20 -04:00
JP Simard
c8a66e7070
Add changelog entry for https://github.com/realm/SwiftLint/pull/4143 ( #4144 )
2022-08-29 12:59:23 -04:00
Martin Hosna
f32bc1f337
RedundantDiscardableLetRule should not produce warning when used with async ( #4143 )
...
handle situation with async let _ = ....
let can not be removed from "async let _ = ..." because removing it produces invalid swift syntax
Co-authored-by: Martin Hosna <mhosna@samepage.io>
2022-08-29 12:56:35 -04:00
JP Simard
fc3b143973
Rename `script` directory to `tools` ( #4141 )
...
And move the Danger bazel config there
2022-08-29 01:16:20 -04:00
JP Simard
4119c27857
Fix typo
2022-08-29 00:33:51 -04:00
JP Simard
a9e5a644bb
Remove rbenv/ruby setup from CONTRIBUTING.md ( #4140 )
...
It's no longer needed as of https://github.com/realm/SwiftLint/pull/4138
2022-08-28 23:54:47 -04:00
JP Simard
501142d3e7
Update gems ( #4139 )
2022-08-29 03:29:37 +00:00
JP Simard
ea6ca3e8dd
[CI] Use `ci.bazelrc` in Azure Pipelines
2022-08-28 23:00:17 -04:00
JP Simard
0fd9a112b4
[CI] Run Danger with Bazel ( #4138 )
...
It'd be nice to avoid needing to maintain rbenv on CI
2022-08-28 22:58:39 -04:00
JP Simard
eb14f5283c
Speed up Analyze CI job ( #4136 )
...
By merging `write_swiftpm_yaml` into analyze test
2022-08-28 22:35:42 -04:00
JP Simard
cd9bd5f9fd
Make duplicate_imports rule documentation deterministic ( #4137 )
2022-08-28 18:27:12 -04:00
Danny Mösch
9875ab904b
Print autocorrected STDIN input to STDOUT ( #4132 )
2022-08-28 23:17:20 +02:00
JP Simard
7412205b6c
[CI] Use Xcode 13.4.1 on Azure Pipelines ( #4134 )
2022-08-28 14:42:57 -04:00
JP Simard
8dbc0e4cbf
Update Azure Pipelines to use 'ubuntu-latest' for Linux jobs
2022-08-28 14:20:11 -04:00
JP Simard
ccac242f3a
Update CI setup instructions again
2022-08-28 14:15:28 -04:00
JP Simard
dcb5bf438d
Support `user.bazelrc`
...
So devs can put extra bazel flags in there
2022-08-28 14:09:22 -04:00
JP Simard
fdcdcf76d1
Use bazel remote cache on Buildkite ( #4133 )
2022-08-28 14:07:10 -04:00
JP Simard
05461c8525
Update `CONTRIBUTING.md` with new CI steps for Bazel remote cache
2022-08-28 12:37:02 -04:00
JP Simard
848ec452c3
Run TSan job on Azure Pipelines with Bazel ( #4130 )
2022-08-28 10:51:58 -04:00
Danny Mösch
bf9bf83143
Migrate EmptyXCTestMethodRule to SwiftSyntax fixing some false-positives ( #4129 )
2022-08-27 03:02:05 -04:00
JP Simard
d9ec625601
Add empty changelog section
2022-08-26 11:08:56 -04:00
JP Simard
ef36201e6b
release 0.49.0
2022-08-26 10:48:09 -04:00
JP Simard
5a30991fa4
Add SwiftSyntax rule helpers ( #4126 )
...
This cuts down on the boilerplate involved in writing SwiftSyntax-based
rules. May not be significant right now since most rules are still built
with SourceKit, but as we migrate more rules moving forward, this should
make it easier for rule authors to write rules that behave performantly
and correctly.
2022-08-26 14:46:32 +00:00
JP Simard
aebded15ba
Fix changelog formatting
2022-08-26 10:16:16 -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
JP Simard
9cfd3dc978
Update CI to use Xcode 14 beta 6 ( #4125 )
...
Only used for the TSan CI job right now, which was previously using
Xcode 14 beta 5.
https://twitter.com/XcodeReleases/status/1562130365191315457
2022-08-23 15:31:25 -04:00
JP Simard
c73f68683a
Update rules_apple to 1.1.0 ( #4124 )
...
https://github.com/bazelbuild/rules_apple/releases/tag/1.1.0
2022-08-23 15:17:38 -04:00
JP Simard
cf764e7b90
Fix hang after linting or analyzing on Linux ( #4123 )
...
Fixes https://github.com/realm/SwiftLint/issues/4117
2022-08-23 13:45:10 -04:00
JP Simard
83bf37e642
Add `SwiftLintFile.isTestFile` ( #4122 )
2022-08-23 12:04:30 -04:00
JP Simard
7259c02ee5
Teach `--compile-commands` to parse SwiftPM yaml files ( #4119 )
...
And move analyze CI job to Bazel
Which will benefit from caching previous results,
so if we make a PR that doesn't impact the analysis
results (i.e. changelog or docs) we might be able to
skip running this at all.
2022-08-23 11:01:13 -04:00
JP Simard
68983d7da2
Enable Bazel disk cache ( #4120 )
...
Set to `~/.bazel_cache`. https://bazel.build/remote/caching#disk-cache
2022-08-23 07:58:31 -04:00
JP Simard
2960ae6a7a
Test with thread sanitizer in Buildkite using Bazel ( #4115 )
...
This will allow for the test to be skipped if it's already cached,
speeding up CI runs.
2022-08-22 19:21:54 -04:00
JP Simard
69f3a3b4b7
Refactor bazel release rule
...
Moving the signature file generation from the Makefile to the bazel rule
2022-08-22 12:26:22 -04:00
Danny Mösch
f3e2c0b7bb
Replace manual backtracking by location information from the captured group ( #4111 )
2022-08-19 20:14:19 +02:00
JP Simard
e8f738b39c
Automate producing release tarballs for Bazel ( #4113 )
2022-08-19 17:26:21 +00:00
Danny Mösch
6dc2ef937e
Add trigger markers to examples ( #4110 )
2022-08-18 22:15:11 +00:00
JP Simard
0e3f3de17f
Set CHANGELOG header back to 'Master'
...
And update bazel ref in readme to point to `0.49.0-rc.2`.
2022-08-18 16:35:21 -04:00
JP Simard
dd55f59207
release 0.49.0-rc.2
2022-08-18 13:31:47 -04:00
JP Simard
c1de2ef087
Fix changelog formatting
2022-08-18 13:27:35 -04:00
Kotaro Suto
78949c1b99
Fix broken correction for `explicit_init` rule ( #4109 )
2022-08-18 17:17:52 +00:00
chrisjf
1ef15f3bb7
Update documentation for multiline_arguments_brackets and multiline_literal_brackets ( #4098 )
...
- added two triggering examples that are a common style, to make it immediately obvious that they trigger the rules
- also fixed a spelling mistake throughout the examples for the multiline_literal_brackets rule ("Gryffindor" is now correctly spelt)
2022-08-18 09:53:52 +02:00
Kotaro Suto
3aa249b8a1
Fix first_where false negative ( #4105 )
2022-08-17 00:06:32 +00:00
JP Simard
c2be5b18b4
Only check `sourcekitdFailed` for SourceKit-based rules ( #4104 )
...
And only warn once if it's disabled.
This check is expensive and as more rules move away from SourceKit to
SwiftSyntax, it's increasingly common for rules to not use SourceKit at
all.
In addition, SourceKit crashes used to be a lot more common but I
haven't seen one myself in quite a while.
2022-08-16 16:46:55 +00:00
JP Simard
f6fc4727b6
Skip OSSCheck if binary hasn't changed ( #4103 )
2022-08-16 16:07:36 +00:00
JP Simard
73c88c3af0
Add `version --verbose` command ( #4102 )
...
Prints out something like this on macOS:
```
Version: 0.49.0-rc.1
Build ID: B43931F3-D096-3704-B41C-FC40673A3F96
```
This can be used to determine if two `swiftlint` executables are
identical.
2022-08-16 14:12:44 +00:00
JP Simard
ac23f2e89a
Log time spent in each custom rule ( #4100 )
2022-08-15 22:03:06 -04:00
JP Simard
781034bd78
Revert "Clear bazel caches" ( #4099 )
...
This reverts commit fe43d6ecd4
.
2022-08-15 21:39:38 -04:00
JP Simard
13703c4466
Update SourceKitFreeRules ( #4097 )
...
None of these rules use SourceKit
2022-08-16 00:56:03 +00:00
JP Simard
0a3ebdbd37
[Bazel] Define minimum OS versions ( #4096 )
...
This helps when building with Xcode 14.
2022-08-15 16:34:50 -04:00
JP Simard
408ba29951
Integrate with rules_xcodeproj ( #4095 )
2022-08-15 16:22:47 -04:00
JP Simard
3037946bbc
Migrate ClosureSpacingRule to SwiftSyntax ( #4092 )
...
Fixes #4090 . Continued from #4091 .
2022-08-15 18:27:43 +00:00
sarastro-nl
d1a1485af6
enable glob for includePaths ( #4093 )
2022-08-15 13:54:49 +00:00
Danny Mösch
ef515ac45e
Fix false positive in `yoda_condition` rule basing it on SwiftSyntax ( #4089 )
2022-08-14 16:30:09 -04:00
JP Simard
15970311e1
Update CHANGELOG header to say "Master" again
2022-08-12 11:08:49 -04:00
JP Simard
35df4ba6a1
Update bazel ref in readme
2022-08-12 11:07:05 -04:00
JP Simard
6f03036591
release 0.49.0-rc.1
2022-08-12 09:49:13 -04:00
JP Simard
dec9ecbf0b
Add note in changelog about upcoming default branch rename ( #4088 )
2022-08-12 09:46:11 -04:00
JP Simard
5e1eaea148
Improve Buildkite grouping ( #4086 )
...
Reference: https://buildkite.com/docs/pipelines/managing-log-output
2022-08-12 00:02:13 -04:00
JP Simard
21ba7c8280
Update SourceKitten to 0.33.0 ( #4085 )
...
https://github.com/jpsim/SourceKitten/releases/tag/0.33.0
2022-08-11 21:04:32 +00:00
JP Simard
a163638214
Clean up .swiftlint.yml
...
By removing references to deleted files
2022-08-11 14:48:43 -04:00
Danny Mösch
9eb6dd016c
Let Sourcery always run independent of changed files ( #4084 )
2022-08-11 16:28:17 +00:00
Timofey Solonin
557c5b5948
Make `duplicate_imports` rule correctable ( #4014 )
...
Also fix reporting of redundant violations when more than one duplicate is present.
2022-08-11 18:19:26 +02:00
Danny Mösch
c1b74cd752
Rename test classes ( #4083 )
2022-08-11 07:33:11 +02:00
Danny Mösch
a02d4a76cb
Remove references to ManuallyTestedExamplesRule protocol ( #4082 )
...
Follow-up of d730e0b3fa
.
2022-08-10 21:42:10 +00:00
JP Simard
dd4aefd23a
Danger: Clarify that changelog entries are for user-facing changes only
2022-08-10 17:30:47 -04:00
JP Simard
73f4c3e991
Clarify that changelog entries are for user-facing changes only
2022-08-10 17:29:45 -04:00
Danny Mösch
d730e0b3fa
Let all example verification tests be generated by Sourcery ( #4076 )
2022-08-10 22:49:28 +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
adec1c76ee
Show Bazel test errors on CI
2022-08-10 15:03:44 -04:00
JP Simard
8f620ccd0b
Bump SourceKitten bazel ref ( #4080 )
...
To avoid a compiler warning when building with Xcode 14 beta 5
2022-08-10 14:30:41 -04:00
JP Simard
481da28f1e
Remove internal changelog entries
2022-08-10 13:36:58 -04:00
Sara Tavares
f8e1b178d6
chore(typo): fix typo on test ( #4078 )
2022-08-10 13:36:03 -04:00
Sara Tavares
436a6f3484
chore(typo): fix typo on func ( #4077 )
2022-08-10 13:35:42 -04:00
Danny Mösch
449190d324
Verify examples in rules by default and enforce explicit exclusion ( #4065 )
...
A rule must conform to ManuallyTestedExamplesRule to skip generation of a test for its examples.
2022-08-09 22:32:09 +02:00
JP Simard
1ac0419eb6
Fix failing Swift 5.7 test ( #4075 )
...
Seems like `CGPoint` moved from the `CoreGraphics` module to the
`CoreFoundation` module.
2022-08-09 16:44:05 +00:00
JP Simard
a97718f4c6
Replace incrementer dispatch queue with an actor ( #4073 )
...
To support this, we first must use an async entrypoint to the CLI, which
we do by changing the lint and analyze commands to conform to
`AsyncParsableCommand`.
The in order to map over the closures with suspension points, we pull in
CollectionConcurrencyKit as a new dependency.
This change does not touch SwiftLintFramework, only the CLI target.
2022-08-09 13:06:08 +00:00
JP Simard
ec8ba17388
Use `@main` attribute ( #4072 )
...
This will allow us to have an async entrypoint and use structured
concurrency features in the future.
2022-08-09 03:48:12 +00:00
JP Simard
2b00164081
Remove uses of `Result` in CLI target ( #4071 )
...
Which will make it easier to adopt some structured concurrency features
in the future.
2022-08-08 23:04:20 -04:00
JP Simard
f39323160c
Remove availability check ( #4070 )
...
Since SwiftLint now requires macOS 12 or higher to run.
2022-08-09 02:28:32 +00:00
JP Simard
235264bb7e
Stop building Docker images for Swift 5.5 ( #4068 )
...
Follow-up to https://github.com/realm/SwiftLint/pull/4037
2022-08-07 22:03:45 -04:00
JP Simard
cc7c400e81
Run bazel tests in sandbox on CI
...
By setting `IN_PROCESS_SOURCEKIT=1` as `--test_env`
2022-08-07 22:00:10 -04:00
JP Simard
8b8b3d0738
Run all tests with Bazel ( #4067 )
...
Other than the one test case that uses paths with spaces in them which
Bazel doesn't support.
2022-08-07 16:56:45 -04: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
cdb87e3869
Verify all examples provided in rule descriptions ( #4061 )
2022-08-04 23:06:37 +02:00
JP Simard
c50b42c183
Rewrite CommaRule with SwiftSyntax ( #4062 )
...
Making it about 10x faster, finding some previously missed cases and
fixing some previously wrong corrections.
This pulls in the `Collection.windows(ofCount:)` function from Swift
Algorithms.
2022-08-04 04:29:38 +00:00
JP Simard
ee655a920c
Fix changelog entry placement
2022-08-03 23:14:37 -04:00
Or Eliyahu
19eda14df1
Fix false positives in duplicated_key_in_dictionary_literal rule ( #4057 )
2022-07-31 21:07:15 +02:00
Danny Mösch
54a8435479
Use specific failure messages in extended tests ( #4058 )
2022-07-31 14:45:47 +02:00
JP Simard
1dab8181b8
Fix bazel extra rules tests on Linux ( #4056 )
2022-07-29 19:34:54 +00:00
JP Simard
8b90623b38
[Bazel] Set up tests ( #4055 )
...
Run with `bazel test --spawn_strategy=standalone //Tests/...`
Consumers who define rules via `swiftlint_extra_rules` can run tests for
their custom rules too:
```
./bazelw test \
--spawn_strategy=standalone \
@SwiftLint//Tests:ExtraRulesTests
```
2022-07-28 19:14:03 +00:00
JP Simard
b70c92c34c
Fix `PrimaryRuleList.stencil` ( #4053 )
2022-07-28 13:23:02 -04:00
JP Simard
340fce43c8
Update bazel ref in readme ( #4052 )
2022-07-28 13:19:19 -04:00
JP Simard
6c5f53ef66
Add micro-optimization to commands cache ( #4050 )
...
Speeds up overall lint time by ~2% for Lyft's iOS monorepo.
2022-07-28 15:44:34 +00:00
JP Simard
949ab6289a
[Bazel] Update SourceKitten
2022-07-27 11:04:45 -04:00
Steve Madsen
4d8abec16e
Make comma_inheritance rule opt-in ( #4047 )
2022-07-27 17:01:11 +02:00
Danny Mösch
68d88ded61
Check in build that Sourcery generated files are up-to-date ( #4035 )
2022-07-26 20:50:05 +02:00
JP Simard
9e485266be
Run OSSCheck when bazel files change ( #4046 )
2022-07-26 14:49:02 -04:00
Marcelo Fabri
3a64518119
Fix false positive in self_in_property_initialization ( #4044 )
...
* Fix false positive in self_in_property_initialization
Fixes #4041
* Update CHANGELOG.md
Co-authored-by: JP Simard <jp@jpsim.com>
Co-authored-by: JP Simard <jp@jpsim.com>
2022-07-26 11:41:09 -07:00
JP Simard
29cd97e59c
Bump SourceKitten ( #4045 )
2022-07-26 14:30:02 -04:00
JP Simard
c0f9f2175b
Add support for native custom rules ( #4039 )
...
This change makes it possible to add native custom rules when building
SwiftLint via Bazel (possible as of
https://github.com/realm/SwiftLint/pull/4038 ).
First, add a local bazel repository where custom rules will be defined
to your project's `WORKSPACE`:
```python
local_repository(
name = "swiftlint_extra_rules",
path = "swiftlint_extra_rules",
)
```
Then in the extra rules directory, add an empty `WORKSPACE` and a
`BUILD` file with the following contents:
```python
filegroup(
name = "extra_rules",
srcs = glob(["*.swift"]),
visibility = ["//visibility:public"],
)
```
To add a rule (for example, `MyPrivateRule`) add the following two
files:
```swift
// ExtraRules.swift
func extraRules() -> [Rule.Type] {
[
MyPrivateRule.self,
]
}
```
```swift
// MyPrivateRule.swift
import SourceKittenFramework
import SwiftSyntax
struct MyPrivateRule: ConfigurationProviderRule {
var configuration = SeverityConfiguration(.error)
init() {}
static let description = RuleDescription(
identifier: "my_private_rule",
name: "My Private Rule",
description: "This is my private rule.",
kind: .idiomatic
)
func validate(file: SwiftLintFile) -> [StyleViolation] {
// Perform validation here...
}
}
```
Then you can reference the rule in your configuration or source files as
though they were built in to the official SwiftLint repo.
This means that you have access to SwiftLintFramework's internal API.
We make no guarantees as to the stability of these internal APIs,
although if you end up using something that gets removed please reach
out and we'll make a best effort to maintain some level of support.
This PR also improves the linter cache on macOS to make it correctly
invalidate previous results when custom native rules are edited. This
even works when doing local development of SwiftLint, where previous it
was necessary to use `--no-cache` when working on SwiftLint, now the
cache should always work.
Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>
2022-07-26 13:56:22 -04:00
JP Simard
7155af1981
[CI] Move `oss-check` to use Bazel ( #4043 )
...
Which should improve the CI times thanks to Bazel's improved build
caching.
2022-07-26 12:10:06 -04:00
JP Simard
ffc6379828
Fix rendering issue in readme
...
GitHub doesn't render this as a code block, it renders the backticks.
2022-07-26 09:56:13 -04:00
JP Simard
fe652e8c8a
Update Makefile to drop support for Swift 5.5
2022-07-26 09:45:16 -04:00
JP Simard
8ee7485c8a
Fix changelog
2022-07-26 08:05:29 -04:00
JP Simard
24735ef4d3
Add support for building with Bazel ( #4038 )
2022-07-26 07:09:02 -04:00
JP Simard
05ac3c9d75
Require macOS 12 & Swift 5.6 ( #4037 )
...
This will unblock using Swift Concurrency features and updating to the
latest versions of Swift Argument Parser.
This won't drop support for linting projects with an older toolchain /
Xcode selected, as long as SwiftLint was _built_ with 5.6+ and is
_running_ on macOS 12+. So the main breaking change for end users here
is requiring macOS 12 to run.
However, the upside to using Swift Concurrency features is worth the
breaking change in my opinion. Also being able to stay on recent Swift
Argument Parser releases.
2022-07-26 03:55:36 -04:00
JP Simard
09837b7bab
Add empty changelog section
2022-07-26 03:53:03 -04:00
JP Simard
22fb9eb9e5
release 0.48.0
2022-07-26 03:34:06 -04:00
JP Simard
617f83c81d
Add note about dropping support for Swift 5.5 / macOS 11
2022-07-26 03:30:35 -04:00
JP Simard
f81972e98c
Apply minor stylistic edits to `OperatorUsageWhitespaceRule`
2022-07-26 03:23:35 -04:00
JP Simard
c53dc0ce17
Move changelog entry to correct section
2022-07-26 03:10:41 -04:00
Danny Mösch
1c7b8b7dcb
Run Sourcery enabling automatic test for ModifierOrderRule ( #4034 )
2022-07-24 14:11:09 -04:00
Danny Mösch
4aa38957c3
Enable auto-test for rule ( #4033 )
2022-07-24 08:24:11 -04:00
Craig Siemens
c5aa8065d1
Update `nimble_operator` to suggest the (in)equal operator instead of `beNil()` ( #4025 )
2022-07-14 13:44:29 -04:00
DCherish
c95670edd2
Fix Korean README ( #4020 )
2022-07-11 08:08:13 +02:00
DCherish
69dc18135a
Update Korean README ( #4018 )
2022-07-09 17:51:03 +02:00
Danny Mösch
a51be7bcce
Refactor deployment target configuration to avoid duplications ( #4017 )
2022-07-06 17:07:15 -04:00
Ruby
37f95d996e
fix typo in README ( #4016 )
2022-07-06 15:32:09 +02:00
Taha Bebek
e34f49695b
Support extension targets in `deployment_target` rule ( #4011 )
2022-07-05 22:41:56 +02:00
Koki Hirokawa
25ed3d2d26
Support `UIEdgeInsets` type in `prefer_zero_over_explicit_init` rule ( #4008 )
2022-06-29 21:28:47 +02:00
Marcelo Fabri
45a03dec20
Add back `void_function_in_ternary` rule ( #3956 )
2022-06-27 09:41:52 -07: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
Danny Mösch
1faea36a22
Do not trigger unavailable_condition rule if other #(un)available checks are involved ( #4002 )
2022-06-24 22:58:02 +02:00
Danny Mösch
a20a75d422
Fix various shortcomings in relative path computation ( #4005 )
2022-06-24 02:25:37 -04:00
Danny Mösch
04972a39da
Look for call expressions which are not wrapped into an argument ( #3977 )
...
This makes the added test cases work in Xcode 13.2 where the wrapping does not happen.
The call expression is the first substructure in the dictionary, while in Xcode 13.3
it's an argument containing the call expression.
2022-06-19 13:39:07 -04:00
Danny Mösch
634406a30a
Fix violation message in untyped_error_in_catch rule ( #4001 )
...
It was just "warning". Now it is the description of the rule (default).
2022-06-19 13:09:33 -04:00
Danny Mösch
0d070a8c8c
Update result builder methods in unused_declaration rule fixing some false-positives ( #4000 )
2022-06-19 11:59:23 +02:00
Marcelo Fabri
71db511003
Remove Alcatraz from README
...
This hasn't been properly supported for years. Fixes https://github.com/realm/SwiftLint/issues/3782
2022-06-15 10:18:54 -07:00
Danny Mösch
86e765c418
Deprecate the `--path` option in favor of the positional `paths` argument ( #3952 )
...
There is no real benefit for this option. Files and folders to lint/analyze
can be passed to `swiftlint` as last arguments. There cannot be multiple
`--path` arguments. If there is more than one only the last path is considered.
2022-06-14 23:10:28 +02:00
Liam
64f656cb46
Update README.md ( #3995 )
2022-06-14 21:17:07 +02:00
Danny Mösch
323a249f70
Make `for_where` independent of order in structure dictionary ( #3979 )
2022-06-14 13:55:12 -04:00
Marcelo Fabri
4382ef49b9
Use URL(fileURLWithPath:isDirectory) to avoid file system call ( #3976 )
2022-05-26 21:54:23 +02:00
Jaehong Kang
809dcc6bdc
Prevent crash for private types named `_` in `type_name` rule ( #3972 )
2022-05-10 19:15:44 +02:00
Danny Mösch
ca9217d5e1
Ignore array types if their associated `Index` is accessed ( #3970 )
2022-05-07 19:11:53 -04:00
Marcelo Fabri
f880b66cbf
Rewrite `operator_usage_whitespace` with SwiftSyntax ( #3962 )
2022-05-06 16:48:57 -07:00
Dennis Hong
ea6cc50890
Fix Korean grammar errors ( #3967 )
2022-05-02 07:22:15 +02:00
Marcelo Fabri
ebc77391bc
Add workaround to avoid stack overflow in debug ( #3963 )
2022-05-01 14:57:28 -07:00
Danny Mösch
bc7917be04
Use explicit link command ( #3966 )
2022-05-01 12:32:14 -04:00
JP Simard
3a4afce623
[CI] Update to Xcode 13.3.1 ( #3961 )
...
* [CI] Update to Xcode 13.3.1
* Update jazzy
2022-04-27 11:31:01 -04:00
Danny Mösch
a27c7da7e2
Allow custom attributes on lines directly before let/var declarations ( #3943 )
2022-04-26 22:00:44 +02:00
JP Simard
113b2985de
Add empty changelog section
2022-04-25 12:40:04 -04:00
JP Simard
e497f1f5b1
release 0.47.1
2022-04-25 11:31:09 -04:00
JP Simard
11dff81247
Remove extra trailing space in changelog
2022-04-25 11:24:56 -04:00
JP Simard
f0d6c54574
[CONTRIBUTING] Add note to install bundler on CI machines
2022-04-25 11:21:15 -04:00
Ryan Cole
43c84146db
Add accessibility_label_for_image rule ( #3862 )
...
Warns if a SwiftUI Image does not have an accessibility label and is not hidden from accessibility. When this is the case, the image's accessibility label defaults to the name of the image file causing a poor UX.
2022-04-18 10:40:51 +02:00
Marcelo Fabri
5f44d3f306
Add comma_inheritance_rule rule ( #3954 )
...
Fixes #3950
2022-04-17 04:47:02 -07:00
Marcelo Fabri
1752587b7b
Add unavailable_condition rule ( #3953 )
...
Fixes #3897
2022-04-17 03:30:53 -07:00
Marcelo Fabri
a786e310a3
Add back return_value_from_void_function rule ( #3882 )
2022-04-16 16:53:11 -07:00
Danny Mösch
291b500269
Analyze all files listed in the command even if the `--path` option is used ( #3951 )
2022-04-15 10:36:29 -04:00
coffmark
564c6ddb55
Lint all files listed in the command even if the `--path` option is used ( #3923 )
2022-04-13 15:13:08 -04:00
Danny Mösch
870a7be2f4
Revert "Enable `typesafe_array_init` rule in repository" ( #3948 )
...
This reverts commit 42a2932883
.
See #3942 for the reasons behind the revert.
2022-04-12 15:28:07 -04:00
JP Simard
bdb548e1c0
Add a few more possible future Swift versions ( #3946 )
...
So tests don't fail on whatever the next Swift releases are.
2022-04-12 11:59:34 -04:00
coffmark
23fe6f4a39
[Test] fix Swift5.6.1 version ( #3944 )
2022-04-12 11:23:51 -04:00
Chris Hale
9beef23175
Throw error on bad expiring todo date format ( #3626 )
2022-04-11 21:20:05 +02:00
Danny Mösch
42a2932883
Enable `typesafe_array_init` rule in repository ( #3942 )
2022-04-10 11:42:58 -04:00
dependabot[bot]
5d7394be0e
Bump cocoapods-downloader from 1.4.0 to 1.6.3 ( #3937 )
...
Bumps [cocoapods-downloader](https://github.com/CocoaPods/cocoapods-downloader ) from 1.4.0 to 1.6.3.
- [Release notes](https://github.com/CocoaPods/cocoapods-downloader/releases )
- [Changelog](https://github.com/CocoaPods/cocoapods-downloader/blob/master/CHANGELOG.md )
- [Commits](https://github.com/CocoaPods/cocoapods-downloader/compare/1.4.0...1.6.3 )
---
updated-dependencies:
- dependency-name: cocoapods-downloader
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-05 20:41:14 -04:00
Marcelo Fabri
0fbf010ea4
Only skip autocorrect on files with errors ( #3933 )
...
* Only skip autocorrect on files with errors
* Use other kind of warning so tests succeed on Linux
* Update CHANGELOG.md
Co-authored-by: JP Simard <jp@jpsim.com>
Co-authored-by: JP Simard <jp@jpsim.com>
2022-04-05 10:59:50 -07:00
JP Simard
cb5fa0425d
Move Analyze CI job to Buildkite ( #3919 )
...
We now have two Buildkite agents thanks to a newly added M1 Mac mini
from MacStadium. Running the analyze job should be considerably faster
than the VMs that run on Azure Pipelines, although still slower than
if we were to run them with Xcode 13.2.1 because of the performance
regressions described in https://github.com/realm/SwiftLint/issues/3920 .
2022-04-05 12:05:38 -04:00
JP Simard
5897598ba8
[CONTRIBUTING] Add CI section
2022-04-05 11:28:49 -04:00
JP Simard
e92a3aeae9
fixup! fixup! Add `--in-process-sourcekit` command line flag
2022-03-31 12:49:12 -04:00
JP Simard
4c14678d77
fixup! Add `--in-process-sourcekit` command line flag
2022-03-31 11:42:42 -04:00
Juozas Valančius
a28516d5e8
Create `.artifactbundle` during release
2022-03-31 09:52:22 -04:00
Juozas Valančius
62cc0f1a32
Add `--in-process-sourcekit` command line flag
2022-03-31 09:46:21 -04:00
JP Simard
89ebac11d5
Fix analyzer rules with Xcode 13.3 ( #3921 )
...
* Fix analyzer rules with Xcode 13.3
Looks like starting with Xcode 13.3 / Swift 5.6, cursor info requests
started canceling in-flight requests, so we need to pass
`key.cancel_on_subsequent_request: false` to bypass that.
Analyzer rules on Swift 5.6 are extremely slow, however. Not really
usable right now.
* Run analyzer rules one file at a time
* Add changelog entry
2022-03-28 11:58:34 -04:00
Danny Moesch
fa2a0bab6c
Move StringView.byteOffset into generally accessible extension ( #3917 )
2022-03-25 07:27:50 +01:00
JP Simard
a773c3ec21
Apply minor changes to the syntactic sugar rewrite ( #3915 )
...
* Improve docstrings for `StringView+SwiftSyntax.swift`
* Move changelog entry to correct section & reword
* Change parameter type from `Int` to `ByteCount`
* Move AbsolutePosition / ByteCount conversion to internal API
* Only warn once if syntax tree cannot be parsed
* Move Syntactic Sugar examples to a dedicated file
* Change SyntacticSugarRuleVisitor from SyntaxAnyVisitor to SyntaxVisitor
* Add `SugaredType` enum to help with the implement `SyntacticSugarRule`
2022-03-24 10:27:05 -04:00
JP Simard
9ace4bbb73
Don't pass `--path` to bundle install ( #3918 )
...
> [DEPRECATED] The `--path` flag is deprecated because it relies on
> being remembered across bundler invocations, which bundler will no
> longer do in future versions. Instead please use
> `bundle config set path 'vendor/bundle'`, and stop using this flag
2022-03-24 10:12:32 -04:00
Danny Moesch
a801bbc83b
Add new type-safe ArrayInitRule ( #3914 )
...
The idea of this new Analyzer rule is to filter the calls of `map` before they are passed on to the classic ArrayInitRule which does the detailed checking of the lambda function block. The rule makes sure that only the `map` function is considered that is defined by the `Sequence` protocol.
2022-03-23 22:29:50 +01:00
JP Simard
83a86870bb
Fix false positives in `unused_closure_parameter` ( #3916 )
...
When using parameters with backticks.
2022-03-23 16:57:23 -04:00
Paul Taykalo
d756541204
Rewrite SyntacticSugarRule using SwiftSyntax ( #3866 )
...
Rewrite SyntacticSugarRule with SwiftSyntax
2022-03-23 18:30:43 +02:00
JP Simard
206ff10e6e
Add empty changelog section
2022-03-23 11:34:40 -04:00
JP Simard
e5791ec16c
release 0.47.0
2022-03-23 10:58:54 -04:00
Paul Taykalo
1616023b63
Add ability to run only one(focused) example ( #3911 )
...
* Add ability to focus on a specific test example
* Update CHANGELOG.md
Co-authored-by: JP Simard <jp@jpsim.com>
* Update CONTRIBUTING.md
Co-authored-by: JP Simard <jp@jpsim.com>
Co-authored-by: JP Simard <jp@jpsim.com>
2022-03-22 19:21:25 +02:00
JP Simard
702b36a781
Revert strip on Docker
2022-03-18 21:01:50 -04:00
JP Simard
e06da98b6b
fixup! fixup! Strip binary when building for release
2022-03-18 20:54:07 -04:00
JP Simard
a59be8092d
fixup! Strip binary when building for release
2022-03-18 20:44:53 -04:00
JP Simard
91b58c6cbe
Strip binary when building for release
...
Shaves ~32% off the binary size.
Brings the universal fat binary on macOS from 86MB to 58MB.
2022-03-18 20:43:55 -04:00
Danny Moesch
12cda68ce2
Fix some typos and improve wording/style ( #3910 )
2022-03-18 17:42:25 -04:00
JP Simard
24bf129268
Run OSSCheck when Package.swift changes ( #3909 )
2022-03-18 17:13:21 -04:00
JP Simard
a256fa2c8c
Bump SwiftSyntax to latest release ( #3907 )
...
Fixes https://github.com/realm/SwiftLint/issues/3906
Going from 0.50600.0 to 0.50600.1
2022-03-18 11:59:35 -04:00
JP Simard
21bb280068
Build additional Docker image with Swift 5.5 ( #3904 )
...
* Build additional Docker image with Swift 5.5
* Build `swiftlint_linux_swift_5_5.zip`
2022-03-17 17:27:05 -04:00
JP Simard
c44a3f4ff9
Add a changelog entry for `IN_PROCESS_SOURCEKIT`
2022-03-17 15:06:24 -04:00
JP Simard
402fe69f59
Add changelog entry for `IN_PROCESS_SOURCEKIT`
2022-03-17 15:05:11 -04:00
JP Simard
87d21e44e6
Edit wording in build phase Homebrew instructions
2022-03-17 13:31:04 -04:00
Michael Henry
a129163053
Update applesilicon x brew fix Instruction ( #3903 )
2022-03-17 13:22:09 -04:00
JP Simard
de3569cb3b
Update SwiftSyntax to 0.50600.0 ( #3901 )
...
Uses SwiftSyntax 5.5 on Linux when building with Swift 5.5. We use the 5.6 version of
SwiftSyntax when building with Swift 5.5 and 5.6 on macOS because we statically link
`lib_InternalSwiftSyntaxParser` thanks to
https://github.com/keith/StaticInternalSwiftSyntaxParser/releases/tag/5.6 .
This keeps SwiftLint binaries portable across machines on macOS, regardless of
_where_ or even _if_ `lib_InternalSwiftSyntaxParser` is installed.
* Run TSan CI job with `--configuration release` to avoid stack overflows
* Add Swift 5.6 CI job
* Fix linker settings
2022-03-17 13:19:48 -04:00
JP Simard
ca2712aaee
Make linux zip from GitHub's remote Docker image
...
Locally I had trouble building the image on both my previous Intel MacBook Pro
and my new M1 Max MacBook Pro.
2022-03-16 11:05:09 -04:00
Marcelo Fabri
0e5d838765
Support #unavailable in deployment_target rule ( #3898 )
...
Fixes #3896
2022-03-16 10:41:04 -04:00
JP Simard
84bc2174af
Bump dependencies ( #3900 )
...
SourceKitten: 0.31.1 to 0.32.0
SWXMLHash: 5.0.2 to 6.0.0
Also prevent swift-argument-parser from being updated to 1.1.0 which is
incompatible with our macOS version support.
2022-03-15 17:17:42 -04:00
Marcelo Fabri
db2721f78e
Require Swift 5.0 in runtime ( #3886 )
...
* Require Swift 5.0 in runtime
* Fix violation
* Enable legacy_rule by default
* Update changelog
* Fix changelog after rebase
* More cleanup
2022-03-11 14:01:27 -08:00
JP Simard
c664c4f9e6
Move Buildkite pipeline config to repo ( #3893 )
...
These were previously defined in Buildkite itself.
2022-03-11 16:27:17 -05:00
JP Simard
1abc50304c
Use alternate implementation of glob with globstar support ( #3892 )
...
Adapted from https://gist.github.com/efirestone/ce01ae109e08772647eb061b3bb387c3
The implementation from Pathos seems buggy.
Fixes https://github.com/realm/SwiftLint/issues/3891
2022-03-11 13:24:39 -05:00
Fumito Nakazawa
2ae22d06a2
Support recursive globs ( #3843 )
...
ref: https://github.com/realm/SwiftLint/issues/3789
## Overview
Support glob recursive by using [Pathos](https://github.com/dduan/Pathos )
- Introduce Pathos
- Replace glob logic
- Fix some test cases
2022-03-10 21:56:43 -05:00
JP Simard
92e199649d
Fix make package command ( #3890 )
2022-03-10 20:00:49 -05:00
JP Simard
3273cef42b
Prevent empty files from triggering rule violations ( #3885 )
...
There are many valid cases to have an empty Swift source files, and these
shouldn't trigger violations.
2022-03-09 16:09:11 -05:00
JP Simard
eeba297f33
[Docs] Remove "experimental" label for analyzer rules ( #3884 )
...
These have been fairly stable for over two years at this point.
2022-03-09 14:45:09 -05:00
Marcelo Fabri
b619154905
Automatically enforce min Swift version for all rules ( #3881 )
...
* Automatically enforce min Swift version for all rules
* Fix violations
2022-03-09 11:44:56 -08:00
tobias
811ca32c6d
`class_delegate_protocol`: Add line break separator for protocol inheritance
...
clause to match format style with curly brackets on new line
2022-03-09 14:37:47 -05:00
JP Simard
0691a2e7e4
release 0.46.5
2022-03-08 16:35:33 -05:00
JP Simard
ebaa6d2182
Add workaround for https://github.com/CocoaPods/CocoaPods/issues/11185
2022-03-08 16:33:17 -05:00
JP Simard
0f3de846d8
push to HEAD in `make push_version`
2022-03-08 16:18:20 -05:00
Danny Moesch
6fa8ff6070
Exclude examples with complex language constructs from the rule documentation ( #3880 )
2022-03-08 16:04:51 -05:00
Marcelo Fabri
f9b9c35c1f
Fix regression in `trailing_closure` rule with Swift 5.6 ( #3879 )
...
Fixes #3848
2022-03-08 12:52:07 -08:00
JP Simard
2ae6a55ba4
Fix regression in `unused_import` rule when using Swift 5.6 ( #3878 )
...
Fixes https://github.com/realm/SwiftLint/issues/3849
2022-03-08 13:15:39 -05:00
JP Simard
28dd673c48
Use SwiftSyntax visitor to parse commands ( #3872 )
...
* Cache SwiftSyntax syntax trees
* Use SwiftSyntax visitor to parse commands
* Update changelog entry
* Cache commands
2022-03-08 12:33:06 -05:00
Keith Smiley
0830eca24c
Add -I to _InternalSwiftSyntaxParser on Linux ( #3873 )
...
Since `_InternalSwiftSyntaxParser` isn't in the search paths when building with the `-static-stdlib` flag, we have to manually pass an include path so the swift compiler discovers it. Unfortunately we cannot just pass `-I/usr/lib/swift` because that results in duplicate library errors since the libraries we're linking statically also live there as shared libraries. This first symlinks the module definition to the root of the checkout and uses `.` for the `-I`. Any temporary path could be used instead.
2022-03-08 08:49:24 -08:00
Marcelo Fabri
678c3483ed
Fix regression in `last_where` rule with Swift 5.6 ( #3874 )
...
Fixes #3847
2022-03-08 07:53:56 -05:00
Marcelo Fabri
3f24998be5
Fix `closure_parameter_position` rule with Swift 5.6 ( #3871 )
...
Fixes #3845
2022-03-07 13:23:31 -08:00
Marcelo Fabri
f19555f707
Fix `empty_parentheses_with_trailing_closure` with Swift 5.6 ( #3870 )
...
Fixes #3846
2022-03-07 13:39:57 -05:00
JP Simard
a43e52aa91
Integrate Swift Syntax in the `force_cast` rule ( #3867 )
...
We've tried adding Swift Syntax support to SwiftLint in the past but had to turn it off in https://github.com/realm/SwiftLint/pull/3107 due to distribution and portability issues.
With https://github.com/keith/StaticInternalSwiftSyntaxParser it should be possible to avoid those issues by statically linking the internal Swift syntax parser so it's available no matter where users have Xcode installed on their computer.
By removing all calls to SourceKit (collecting comment commands + checking the current Swift version), there's a really significant performance improvement.
| Framework | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| SourceKit | 517.8 ± 8.3 | 505.5 | 531.1 | 6.59 ± 0.43 |
| SwiftSyntax | 78.6 ± 5.0 | 72.6 | 92.1 | 1.00 |
In practice, the SourceKit overhead will continue being there for as long as any rule being run is still looking up the SwiftLint syntax map though.
2022-03-07 12:51:24 -05:00
JP Simard
be1f8596e4
Require Swift 5.5 to build SwiftLint ( #3869 )
...
* Disable Swift 5.4 CI jobs
* Remove SwiftLintFramework podspec
I couldn't find a single use in GitHub's search: https://github.com/search?q=SwiftLintFramework+filename%3APodfile+language%3ARuby+language%3ARuby&type=Code
Just not worth maintaining anymore.
* Change package swift tools version to 5.5
* Update docker_test to use Swift 5.5 image
* Clean up old Swift versions in SwiftVersionTests
Even though these older Swift versions should still be supported, these tests
can't be built against those versions so they're useless.
* Run docker commands with `--platform linux/amd64`
* Remove LinuxMain
It looks like tests are discovered dynamically on Linux as of recent
SwiftPM versions.
2022-03-07 12:15:03 -05:00
JP Simard
d84be10e66
Add emmpty changelog section
2022-03-07 11:22:38 -05:00
JP Simard
f3712b2b93
release 0.46.4
2022-03-07 11:15:27 -05:00
JP Simard
ee7eee32b5
release 0.46.3
2022-03-07 11:15:03 -05:00
Marcelo Fabri
ff4249856e
Fix false positive in `EmptyEnumArgumentsRule` with Swift 5.6 ( #3868 )
...
Fixes #3850
2022-03-07 11:10:15 -05:00
JP Simard
02675a9c09
Fix typo in doc comment: delimeter -> delimiter
2022-03-07 09:27:28 -05:00
Goran Blažič
7b7754ad3b
Ignore MARK in multiline comment ( #3844 )
...
Fixes #1749 and #3841
2022-03-04 11:33:12 -05:00
JP Simard
7f9f41aa36
Fix changelog entry position
2022-03-03 12:53:16 -05:00
JP Simard
54a24638a2
Print minimum_fraction_length in description even when unset
2022-03-03 12:49:11 -05:00
Danny Moesch
d77d23cbeb
Add option to exclude examples from the rule documentation ( #3834 )
...
The option can be used if an example has mainly been added as another test case, but is not suitable
as a user example. User examples should be easy to understand. They should clearly show where and
why a rule is applied and where not. Complex examples with rarely used language constructs or
pathological use cases which are indeed important to test but not helpful for understanding can be
hidden from the documentation with this option.
2022-03-02 10:55:42 -05:00
Danny Moesch
0e7b588d50
Ignore meta class types in `prefer_self_in_static_references` rule ( #3832 )
2022-03-02 10:52:12 -05:00
JP Simard
e6c92f5958
Add empty changelog section
2022-02-22 16:29:32 -05:00
JP Simard
9c81e1a93a
release 0.46.3
2022-02-22 15:29:40 -05:00
JP Simard
932e8f4996
Fix changelog formatting
2022-02-22 15:26:22 -05:00
Takuhiro Muta
867fc1a34c
Update CryptoSwift to 1.4.3 ( #3861 )
2022-02-19 12:48:11 -05:00
HA Pors
8d0aeb995d
Generate fingerprint with relativefile ( #3860 )
...
* Change fingerprint generation to use relativeFile instead of location in order to support CI/CD on multiple machines.
* Created copy of location with relativeFile instead of file to generate fingerprint.
Co-authored-by: Henk Pors <hpors@anwb.nl>
2022-02-17 08:29:16 -08:00
JP Simard
51d97a2037
Add 5.5.3 to `testDetectSwiftVersion()`
2022-02-15 09:24:40 -05:00
Natan Rolnik
fe905f8ae9
Fix default rules section in documentation ( #3857 )
...
While browsing the rules documentation, I noticed **many** rules were both in the Default Rules and in the Opt In Rules section.
After looking into it, the docs of the `drop(while predicate: (Element) throws -> Bool` function states:
A closure that takes an element of the sequence as its argument and returns true if the element should be skipped or false if it should be included. **Once the predicate returns false it will not be called again.**
This caused the `defaultRuleDocumentations` array to contain almost all `ruleDocumentation`.
2022-02-15 06:23:05 -08:00
Greg
c09b6fe3ad
fix typo ( #3837 )
2022-02-02 15:31:06 -05:00
JP Simard
1864d77f37
Fix testDetectSwiftVersion() test when running with Swift 5.6
2022-01-30 13:35:13 -05:00
Danny Moesch
f9be00421e
Rename values for "Enabled by default" property ( #3833 )
2022-01-29 13:35:09 -05:00
JP Simard
2f2a4ad680
[ClosureEndIndentationRule] Fix crash with Swift 5.6 ( #3831 )
...
Fixes https://github.com/realm/SwiftLint/issues/3830
2022-01-27 17:36:31 -05:00
JP Simard
f8909b5c0f
Add empty changelog section
2022-01-27 09:46:32 -05:00
JP Simard
b4a54f32df
release 0.46.2
2022-01-27 09:16:25 -05:00
JP Simard
23b5c2b0ec
Fix changelog formatting
2022-01-27 09:04:43 -05:00
Steven
09f6f1bc83
Fix `class_delegate_protocol` false positives when using `where` clause ( #3829 )
2022-01-27 06:03:53 -08:00
JP Simard
b107180cf5
[CI] Fix codecov integration ( #3828 )
...
This has been broken since we removed the Xcode project in #3414 over a
year ago.
2022-01-25 15:13:14 -08:00
JP Simard
d65a708f29
Add Swift 5.5 / Xcode 13.2.1 CI jobs ( #3827 )
...
And lint the SwiftLint podspec in addition to the SwiftLintFramework one
2022-01-25 14:33:59 -08:00
JP Simard
068f6037fe
[CI] Move back to Azure Pipelines ( #3826 )
...
Yesterday I started moving SwiftLint's CI jobs from Azure Pipelines to
GitHub Actions, which has nicer integrations with GitHub's web UI and
feels nicer & more lightweight overall.
However, GitHub Actions has a serious limitation compared to Azure
Pipelines, which is that it only has 5x macOS job concurrency vs Azure's
10x ([see Twitter](https://twitter.com/simjp/status/1326592600393068546 )).
This leads to significant queuing when merging PRs or pushing to PRs in
a short span, which is the main way I work on SwiftLint when catching up
on PR/issue backlog every few months.
A quick timing check showed that a PR using Azure Pipelines (#3825 ) took
26m 47s vs GitHub Actions (#3824 ) took 32m 31s. These PRs were opened at
a time when no other CI jobs were running, so even though Azure
Pipelines already took 6 minutes less to run than GitHub Actions, that
difference would be even larger if there had been other PRs triggering
CI jobs at the same time.
So I think the best move for the project for the time being is to stay
with Azure Pipelines for its CI. If GitHub ever increases its macOS
concurrency to match Azure Pipelines's 10x we can explore this again.
2022-01-25 13:56:58 -08:00
JP Simard
c5ea00c2d7
Fix CI badges
2022-01-24 23:41:58 -05:00
JP Simard
4525e9999b
Move remaining CI jobs to GitHub Actions ( #3822 )
...
Analyze, TSan, Xcode & Docs
2022-01-24 20:29:33 -08:00
JP Simard
006bb2a85e
Sort implicit return configuration description ( #3823 )
...
To make the output deterministic
2022-01-24 17:13:12 -08:00
JP Simard
83560fffa7
Move SwiftLint Analyze CI job to GitHub Actions ( #3820 )
2022-01-24 16:25:39 -08:00
JP Simard
0c731e72da
Bump Xcode version used by jazzy CI job ( #3821 )
2022-01-24 16:00:22 -08:00
JP Simard
2bd54cf3ce
Move CocoaPods CI jobs to GitHub Actions ( #3819 )
2022-01-24 15:24:42 -08:00
JP Simard
4c3bb24a04
Move SwiftPM CI jobs to GitHub Actions ( #3818 )
2022-01-24 14:59:14 -08:00
JP Simard
db3422b69a
Move changelog entry from breaking to bug fixes
2022-01-24 13:31:49 -05:00
JP Simard
6ce4766517
Fix pkg installer ( #3817 )
2022-01-24 18:26:52 +00:00
Danny Moesch
a94d120839
Ignore `prefer_self_in_static_references` rule in extensions generally ( #3813 )
2022-01-24 09:57:57 -08:00
Danny Moesch
0f55447956
Use pre-defined set of extension kinds ( #3814 )
2022-01-24 09:55:01 -08:00
JP Simard
b91b56c14d
Add empty changelog section
2022-01-21 17:11:56 -05:00
JP Simard
61c5351978
release 0.46.1
2022-01-21 16:59:57 -05:00
JP Simard
31872aaa3f
Re-add 'weak_delegate' rule as opt-in
...
After feedback from users: https://github.com/realm/SwiftLint/pull/3809#issuecomment-1018859093
2022-01-21 16:57:13 -05:00
JP Simard
17779cbfd4
release 0.46.0
2022-01-21 15:57:48 -05:00
JP Simard
73e6cef0c2
Add changelog entry for Docker
2022-01-21 15:52:31 -05:00
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
JP Simard
3d1821d3c0
Revert "Publish a multi-platform Docker image"
...
This reverts commits 76dae19b1c
&
11e86babc7
.
2022-01-21 15:38:21 -05:00
JP Simard
76dae19b1c
fixup! Publish a multi-platform Docker image
2022-01-21 15:36:14 -05:00
JP Simard
11e86babc7
Publish a multi-platform Docker image
2022-01-21 15:33:00 -05:00
JP Simard
fb7755adf5
Minor edits to changelog entries
2022-01-21 14:55:01 -05:00
JP Simard
e3f232ec28
Fix `convenience_type` false positives when using actors ( #3812 )
...
Fixes https://github.com/realm/SwiftLint/issues/3761 .
2022-01-21 19:54:59 +00:00
JP Simard
d534a30a78
Fix OSSCheck ( #3810 )
...
Maybe can fix cases like these: https://github.com/realm/SwiftLint/pull/3803#issuecomment-1008461939
2022-01-21 18:09:59 +00:00
JP Simard
341ec2a907
Remove 'weak_delegate' rule ( #3809 )
...
This was very prone to false positives and not worth keeping.
The identifier will stick around for a release to ease the migration.
2022-01-21 17:56:59 +00:00
Sergei
aff3536bb8
Fix the regex for expiring-todos. ( #3803 )
...
- Make "middle part" `.*` not so greedy with `?`.
- Use `(?!` negative look-ahead to improve matching.
- Added corresponding unit tests.
Co-authored-by: Sergei Shirokov <sshirokov@malwarebytes.com>
2022-01-21 17:42:17 +00:00
Francisco Javier Trujillo Mata
c52d4cde8d
Add usage of Docker into the Readme ( #3808 )
2022-01-21 08:28:19 -08:00
Ikko Ashimine
640efba68d
Fix typo: implict -> implicit
2022-01-21 11:05:21 -05:00
Andrés Cecilia Luque
af59581b66
Fix specifying the cachePath from command line ( #3797 )
2022-01-21 08:01:48 -08:00
Ikko Ashimine
3d7775de11
Fix typo in CommentSpacingRule.swift ( #3795 )
...
charcter -> character
2022-01-21 07:47:14 -08:00
Ethan Wong
5fd8ef38c1
Fix malformed doc for rule "InclusiveLanguage".
2022-01-21 10:45:15 -05:00
Ethan Wong
bb37a253e2
Add rule identifiers in 'Rule Directory' documentation page.
2022-01-21 10:43:09 -05:00
JP Simard
f38083998d
Update docker.yml
2022-01-21 07:39:47 -08:00
Francisco Javier Trujillo Mata
a2ada88fd1
Upload Docker Image in to Github Container ( #3791 )
2022-01-21 07:38:47 -08:00
Paul Williamson
9e37d0fa44
Prevent false triggering of `unused_closure_parameter` when using list bindings ( #3799 )
2022-01-21 07:35:12 -08:00
Sam Soffes
09d912ca37
Update README.md ( #3778 )
...
Since Homebrew installs to a path that isn't in Xcode's path by default, we need to add to the path to support the default location Homebrew installs SwiftLint on Apple Silicon.
From https://stackoverflow.com/a/66003612/118631
2022-01-21 07:02:14 -08:00
grosem
c90c329f12
Allow unused_setter_value for overrides ( #3653 )
...
Fixes #2585
2022-01-20 22:53:18 +00:00
Ezequiel França
2408839be3
Updating Readme to replace autocorrect by fix ( #3779 )
2021-12-16 14:08:29 +00: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
JP Simard
559685823e
Add empty changelog section
2021-11-29 17:04:02 -05:00
JP Simard
95349376fd
release 0.45.1
2021-11-29 16:47:21 -05:00
JP Simard
4f82adf018
Move changelog entry
2021-11-29 16:44:30 -05:00
iressler
3da6502bac
Fix false positive in legacy_objc_type when a non-legacy Objective-C type name begins with a legacy Objective-C type name. ( #3752 )
2021-11-29 12:36:27 -08:00
Hannes Ljungberg
ed79195cf5
Add support for pre-commit ( #3714 )
2021-11-29 11:09:43 -08:00
Danny Mösch
050473a0e1
Add optional prefer_self_in_static_references rule ( #3732 )
2021-11-29 18:42:53 +00:00
Kaitlin Mahar
5429ff642c
Fix false positives with async closures for large_tuple rule ( #3754 )
2021-11-29 18:06:15 +00:00
Benny Wong
210874f4d8
Documentation: Separate out default rules vs opt in rules in rule list ( #3758 )
2021-11-29 17:50:14 +00:00
Ikko Ashimine
d97bf0951e
Fix typo in StrictFilePrivateRule.swift ( #3737 )
...
occurences -> occurrences
2021-11-29 09:47:17 -08:00
Bas Broek
119f9d7f91
Expand README url ( #3755 )
...
From https://realm.github.io/SwiftLint/index.html , this would route to `https://realm.github.io/SwiftLint/Source/SwiftLintFramework/Rules `, which does not exist. Explicitly link to GitHub.
2021-11-29 09:21:50 -08:00
JP Simard
2544d7b945
[unused_import] Fix SwiftShims being considered a used import ( #3766 )
2021-11-29 17:07:38 +00:00
JP Simard
5a98458d94
Add more Swift versions to testDetectSwiftVersion()
2021-11-01 11:39:34 -04:00
JP Simard
292642a815
Add empty changelog section
2021-10-18 12:16:41 -04:00
JP Simard
99465e659f
release 0.45.0
2021-10-18 11:57:37 -04:00
JP Simard
8c3b51ea75
Fix up changelog
2021-10-18 11:54:41 -04:00
Paul Taykalo
b519753fd6
Speedup analyzer rules ( #3747 )
2021-10-18 08:40:15 -07:00
Paul Taykalo
13e1bf709d
Update linux version on CI to Ubuntu 18.04 ( #3742 )
2021-10-15 08:40:40 -07:00
Paul Taykalo
945efde5f5
Prevent multiple recalculations of capture groups ranges ( #3745 )
2021-10-15 02:38:18 +03: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
uhooi
b621fb128f
Bump Swift Argument Parser and SourceKitten ( #3733 )
2021-10-05 22:00:14 -04: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
Naruki Chigira
e4ff164f64
Fix redundant_optional_initialization autocorrect ( #3717 )
...
* Fix autocorrect for redundant_optional_initialization in case observer's brace exists.
2021-09-30 23:15:53 +00:00
Marcelo Fabri
b63a60df14
Fix false positive in unneeded_break_in_switch ( #3725 )
...
Fixes #3724
2021-09-29 12:00:08 -07:00
Marcelo Fabri
4052c43f16
Make rule more generic and rename it
2021-09-29 10:28:39 -07:00
Marcelo Fabri
cfa3dff7fe
Fix unrelated test
2021-09-29 10:28:39 -07:00
Marcelo Fabri
2674d367f9
Fix violation
2021-09-29 10:28:39 -07:00
Marcelo Fabri
eb3a405930
Remove unused function
2021-09-29 10:28:39 -07:00
Marcelo Fabri
68bfc13941
Add add_target_in_variable_declaration_closure rule
2021-09-29 10:28:39 -07: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
Atsuto Yamashita
db229aa221
fix typo in ExplicitTopLevelACLRule.swift ( #3716 )
2021-09-12 19:45:32 -04:00
Atsuto Yamashita
67ba092912
fix a typo of changelog.md ( #3715 )
2021-09-12 06:46:01 -04:00
JP Simard
4d3217f959
Run CI with Xcode 13 & Swift 5.5 ( #3711 )
...
Currently Xcode 13 beta 5, will switch to GM when available.
2021-09-10 09:24:39 -07:00
JP Simard
888619912f
Run CI with Xcode 12.5.1 & Swift 5.4 ( #3710 )
...
And require Swift 5.4 or Xcode 12.5 or later to build SwiftLint.
2021-09-10 08:32:02 -07:00
JP Simard
f9be1e1ac3
Add empty changelog section
2021-09-10 07:18:51 -04:00
JP Simard
e820e750b0
release 0.44.0
2021-09-09 17:59:13 -04:00
Gonzalo RH
9c9e3f54ab
Updated README to mach swift-argument-parser's array parsing strategy. ( #3698 )
2021-09-09 14:15:21 -07:00
JP Simard
986d98c475
Fix tests on Swift 5.5 / Xcode 13 ( #3709 )
2021-09-09 21:11:22 +00:00
JP Simard
e6301c0d66
Fix changelog formatting
2021-09-09 16:12:09 -04:00
Wolfgang Lutz
7420248c0f
Make Analyzer instructions more clear ( #3708 )
...
Instructions originally posted by @timothycosta in https://github.com/realm/SwiftLint/issues/3634#issuecomment-845611219
2021-09-09 12:42:20 -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
Adam Wolf
6953fe268e
Fix improper handling of `\ ` in Xcode build logs
2021-09-01 17:08:29 -04:00
Kane Cheshire
55b62cccb3
Updated file name to match type
2021-08-24 00:19:35 -07:00
Kane Cheshire
4a293632c2
Named rule correctly for Sourcery to work properly
2021-08-24 00:19:35 -07:00
Marcelo Fabri
b1307de785
Update CHANGELOG.md
2021-08-16 02:24:22 -07:00
Marcelo Fabri
50b6992852
Fix issues with explicit_type_interface on Swift 5.4
...
Fixes #3615
2021-08-16 02:23:28 -07: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
Marcelo Fabri
1401d56195
#3664 , but for CN
2021-08-16 02:18:32 -07:00
Marcelo Fabri
01b9488c16
#3664 , but for KR
2021-08-16 02:18:13 -07:00
Adam Wolf
83e1bee22b
Fix misleading env variable example in README ( #3664 )
2021-08-16 02:17:30 -07:00
iressler
9aff1e0a8e
This change addresses a false negative case in the RedundantOptionalInitializationRule. ( #3671 )
2021-08-16 02:01:17 -07:00
dependabot[bot]
bc2563175c
Bump addressable from 2.7.0 to 2.8.0 ( #3675 )
...
Bumps [addressable](https://github.com/sporkmonger/addressable ) from 2.7.0 to 2.8.0.
- [Release notes](https://github.com/sporkmonger/addressable/releases )
- [Changelog](https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md )
- [Commits](https://github.com/sporkmonger/addressable/compare/addressable-2.7.0...addressable-2.8.0 )
---
updated-dependencies:
- dependency-name: addressable
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-20 06:35:11 -07:00
Ikko Ashimine
81eb0d9b1f
Fix typo in ClosureSpacingRule.swift ( #3669 )
...
occurences -> occurrences
2021-07-06 10:41:59 -07:00
Marcelo Fabri
9939c536d5
Add anonymous_argument_in_multiline_closure opt-in rule ( #3659 )
...
* Add anonymous_argument_in_multiline_closure opt-in rule
* Restrict match to the closure
* Fixes
2021-06-17 17:03:19 -07:00
Steven Grosmark
300bf77967
Improve `file_length` warnings when excluding comments ( #3654 )
...
* Improve `file_length` warnings when excluding comments
* Update changelog
* Update Source/SwiftLintFramework/Rules/Metrics/FileLengthRule.swift
Co-authored-by: Yegor Chsherbatykh <ego1309@yandex.ru>
Co-authored-by: Steven Grosmark <steven.grosmark@ww.com>
Co-authored-by: Yegor Chsherbatykh <ego1309@yandex.ru>
2021-06-17 11:11:17 -07:00
Marcelo Fabri
147f43c1bf
Update CHANGELOG.md
2021-05-24 12:06:26 -07:00
Kane Cheshire
6367ff20c8
Updated triggering examples to indicate where the violation should occur
2021-05-24 12:05:29 -07:00
Kane Cheshire
50169fb556
Removed unused import causing CI to fail
2021-05-24 12:05:29 -07:00
Kane Cheshire
92f76057cf
Updated CHANGELOG.md
2021-05-24 12:05:29 -07:00
Kane Cheshire
9c5d3b3c6f
Tidy up
2021-05-24 12:05:29 -07:00
Kane Cheshire
3536a86ba1
Added more non-triggering examples
2021-05-24 12:05:29 -07:00
Kane Cheshire
881bd244da
Updated swiftlint.yml
2021-05-24 12:05:29 -07:00
Kane Cheshire
91b125b001
Ran sourcery + tidied up
2021-05-24 12:05:29 -07:00
Kane Cheshire
d6223893ed
Moved description back
2021-05-24 12:05:29 -07:00
Kane Cheshire
d7aeea39d9
Adding examples/tests
2021-05-24 12:05:29 -07:00
Kane Cheshire
0dd96d249e
Uses correct enumcase instead of enum
2021-05-24 12:05:29 -07:00
Kane Cheshire
538764278b
Adding new DisallowNoneCase rule
2021-05-24 12:05:29 -07:00
Marcelo Fabri
c1d1390f8f
Update CHANGELOG.md
2021-05-21 14:34:50 -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
fa06f10c04
Update CHANGELOG
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
Seth Friedman
14ab9fe775
Fix CHANGELOG bad merge from colon violation fix ( #3639 )
...
The PR for this change was really old, so when it was merged in it was put under 0.43.1.
In actuality, it's a master change.
2021-05-21 04:15:42 +00: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
Roger Oba
242151776f
Update number of rules. ( #3630 )
2021-05-13 10:48:53 -07:00
Steven
625cd180ae
Fix `type_contents_order` initializer detection ( #3622 )
2021-05-10 09:56:21 -04:00
Dan Loman
dd672b4b0c
[bug fix] expiring todo regex ( #3597 )
...
* Add failing tests
* Fix regex to allow non-zero-padded dates
* Update changelog
* Update CHANGELOG.md
2021-05-02 17:12:52 -04:00
Valentin Knabel
ebb51ed6f7
Add vscode extension to README.md ( #3568 )
2021-05-02 16:12:15 -04:00
Marcelo Fabri
4e3c87e2f3
Fix false positive in `empty_enum_arguments` ( #3616 )
...
Fixes #3562
2021-04-28 20:25:05 -07:00
Marcelo Fabri
a10158c475
Add duplicated_key_in_dictionary_literal rule ( #3613 )
2021-04-28 17:25:08 -07:00
Dylan Maryk
5a3844401b
Fix missing comma in description ( #3588 )
2021-04-27 22:51:37 -07:00
Iulian Onofrei
d712e77bab
Add contributing screenshot with better example arguments ( #3604 )
...
Add a screenshot that shows the `--no-cache` argument, because this is
what should be used in most cases, since the cache is enabled by
default, so the debugger won't stop in the implementation of a rule on a
subsequent run.
Also update the second screenshot from the same macOS version (Big Sur)
for consistency.
2021-04-27 22:48:12 -07:00
Keith Smiley
7976b74615
Add test functions with parameters to TestCaseAccessibilityRule ( #3612 )
...
If a function starts with `test` but takes some parameters, it is not
actually a test.
2021-04-26 20:04:04 +00:00
JP Simard
deb7ffb355
Update ruby gems for Apple Silicon support
2021-04-25 08:42:21 -04:00
dependabot[bot]
86b6392aa2
Bump kramdown from 2.3.0 to 2.3.1 ( #3585 )
...
Bumps [kramdown](https://github.com/gettalong/kramdown ) from 2.3.0 to 2.3.1.
- [Release notes](https://github.com/gettalong/kramdown/releases )
- [Changelog](https://github.com/gettalong/kramdown/blob/master/doc/news.page )
- [Commits](https://github.com/gettalong/kramdown/commits )
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-29 14:10:37 -07:00
JP Simard
4039eff984
Release 0.43.1
2021-03-15 13:13:51 -04:00
JP Simard
60ec029e1b
Re-add --format flag to reformat Swift files using SourceKit ( #3573 )
...
Missed during the migration from Commandant to swift-argument-parser in
https://github.com/realm/SwiftLint/pull/3465 .
Fixes https://github.com/realm/SwiftLint/issues/3571 .
2021-03-15 11:15:09 -04:00
Stephen Williams
c1b77f8e0a
Rename the “File Line Length” rule to just “File Length”
2021-03-08 09:29:51 -05:00
JP Simard
058869f446
Require Swift 5.3 or higher to build ( #3553 )
...
* Require Swift 5.3 or higher to build
* Remove Swift Version Support tables from readmes
These weren't exactly accurate because SwiftLint should still work with
older Swift versions long after we update the minimum version of Swift
needed to _build_ the tool. So I doubt this table was very helpful to
anyone.
2021-03-04 18:07:04 +00:00
JP Simard
ca559c70df
Add empty changelog section
2021-03-03 16:14:58 -05:00
JP Simard
da2ca76953
release 0.43.0
2021-03-03 16:01:42 -05:00
JP Simard
e47fb60c7a
Regenerate Sourcery output
2021-03-03 15:41:50 -05:00
JP Simard
92061e84b5
Merge pull request #3550 from realm/fix-oss-check-noise
...
Fix OSSCheck noise
2021-03-03 15:10:40 -05:00
JP Simard
aa32742abf
Revert OSSCheck changes for faster debugging
2021-03-03 14:43:37 -05:00
JP Simard
027f130e8c
fixup! Fix OSSCheck noise
2021-03-03 11:36:09 -05:00
JP Simard
8b145d4ba4
Merge pull request #3549 from realm/fix-parsing-xcode-logs-for-analyzer-rules-for-target-names-with-spaces
...
Fix parsing xcode logs for analyzer rules for target names with spaces
2021-03-03 11:35:02 -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
JP Simard
eec4c58e1f
Fix parsing xcode logs for analyzer rules for target names with spaces
2021-03-03 10:36:22 -05:00
László Kustra
87d4accb39
Add "Capture non-constant variable" rule
2021-03-02 16:11:33 -05:00
JP Simard
fa1154c9a8
Merge pull request #3547 from realm/file-false-negatives-in-unused_declaration
...
File false negatives in unused_declaration
2021-03-02 12:05:02 -05:00
JP Simard
0a0fb1e71b
File false negatives in unused_declaration
...
When a declaration refers to an Objective-C type but doesn't have an
explicit `@objc` attribute.
It would have the string `@objc` embedded in its USR. So add a space so
we only trigger this condition when there's an explicit `@objc`
attribute in the declaration source code.
The triggering example added here didn't trigger before this change.
2021-03-02 11:36:06 -05:00
Otavio Cordeiro
fd97e2259c
Merge pull request #3495 from otaviocc/oc/xctests_setup_teardown
...
Add opt-in rule balanced_xctest_lifecycle
2021-03-01 02:40:46 +01:00
Otavio Cordeiro
24122e1325
Rename Rule to BalancedXCTestLifecycleRule
2021-03-01 01:29:16 +01:00
Otavio Cordeiro
a6a5e633d0
Add support to unbalanced teardown methods
2021-03-01 01:18:30 +01:00
Otavio Cordeiro
7c1b5ff757
Update CHANGELOG after git rebase
2021-02-28 23:49:27 +01:00
Otavio Cordeiro
a4820f49c2
Update CHANGELOG after git rebase
2021-02-28 23:48:06 +01:00
Otavio Cordeiro
3fbc482a2e
Add MARKs
...
to trigger a new build.
2021-02-28 23:48:06 +01:00
Otavio Cordeiro
cdd877c289
Add examples for static setUp and tearDown
2021-02-28 23:48:06 +01:00
Otavio Cordeiro
bd4dcd5b23
Add required_xctest_tearddown opt-in rule
2021-02-28 23:48:05 +01:00
JP Simard
9d02cec17f
Merge pull request #3543 from realm/feature/fix-changelog-typo
...
Fix typo in changelog
2021-02-26 17:22:08 -05:00
Frederick Pietschmann
3d0c87738c
Fix typo in changelog
2021-02-26 23:09:54 +01:00
JP Simard
43083f6537
Merge pull request #3542 from realm/relative-config
...
Fix issue that prevented the inclusion of a configuration file from a parent folder
2021-02-26 13:00:46 -05:00
JP Simard
fed8644e01
Remove duplicate disable commands
2021-02-26 12:09:40 -05:00
JP Simard
2009b00366
Add entry to breaking section of changelog
2021-02-26 11:58:14 -05:00
JP Simard
3e04acd97d
Revert "Revert "Fix issue that prevented the inclusion of a configuration file from a parent folder ( #3491 )""
...
This reverts commit b66f7c7992
.
2021-02-26 11:44:10 -05:00
JP Simard
9182eda98c
Disable file & type body length rules in ConfigurationTests
2021-02-26 10:37:47 -05:00
JP Simard
8c29a89888
Fix changelog spacing
2021-02-25 17:21:29 -05:00
JP Simard
706abfe9e3
Tweak the auto-correction result console output for clarity ( #3522 )
...
A colleague was confused by the output of `swiftlint autocorrect`, she
couldn't understand why SwiftLint told her it corrected thousands of
files when she only touched one.
The "Done correcting \(files.count) ..." output made her think that a
change was made on each of the `files`, when really they had only been
inspected.
A good solution would be to adopt a similar approach as the `lint`
command does.
Not being familiar with the codebase, I though a good first step could
have been to tweak the message a bit, making it clearer that the count
printed to the console is the inspected files.
2021-02-25 17:20:58 -05:00
JP Simard
5b1d737683
Merge pull request #3538 from realm/feature/fix-custom-rules-merging
...
Multiple fixes for custom rules
2021-02-25 16:14:50 -05:00
JP Simard
4e2a569aac
Add SWIFTLINT_LOG_MODULE_USAGE environment variable for UnusedImportRule ( #3539 )
...
That's because it can currently be difficult to know why a module is
referenced in a file.
To use, run SwiftLint with the environment variable set to the module
whose references you want to log to `stderr`:
SWIFTLINT_LOG_MODULE_USAGE=MyModule swiftlint analyze ...
2021-02-25 15:25:31 -05:00
JP Simard
8b6167c7f2
Add changelog entry
2021-02-25 14:54:51 -05:00
JP Simard
721b077608
Add SWIFTLINT_LOG_MODULE_USAGE environment variable for UnusedImportRule
...
That's because it can currently be difficult to know why a module is
referenced in a file.
To use, run SwiftLint with the environment variable set to the module
whose references you want to log to `stderr`:
SWIFTLINT_LOG_MODULE_USAGE=MyModule swiftlint analyze ...
2021-02-25 14:53:07 -05:00
JP Simard
b66f7c7992
Revert "Fix issue that prevented the inclusion of a configuration file from a parent folder ( #3491 )"
...
This reverts commit 2f6fd1e95f
.
2021-02-25 14:49:10 -05:00
Frederick Pietschmann
235f598ac7
Fix custom rules bug when using only_rules mode
2021-02-25 19:22:57 +01:00
Frederick Pietschmann
0dfb04b25a
Add 2 new tests for custom rules when in only_rules mode
2021-02-25 19:22:57 +01:00
Frederick Pietschmann
520d224719
Revert "Revert "Merge pull request #3473 from realm/feature/3472-fix-custom-rules-merging" ( #3503 )"
...
This reverts commit 6a38b15657
.
2021-02-25 19:22:57 +01:00
JP Simard
8326624491
Make discarded_notification_center_observer opt-in ( #3537 )
...
It's very common for this rule to produce false positives, and there's
no easy way to address them.
See these issues:
* https://github.com/realm/SwiftLint/issues/1398
* https://github.com/realm/SwiftLint/issues/3498
2021-02-25 09:06:00 -08:00
JP Simard
62d558eb53
Fix changelog whitespace
2021-02-24 17:31:53 -05:00
JP Simard
21cf0b77db
Fix changelog entry location
2021-02-24 17:30:04 -05: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
Bradley Walters
5eb00b79cc
Update CodeClimateReporter to produce relative paths ( #3499 )
...
GitLab and the CodeClimate spec both expect these paths to be relative.
https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html#implementing-a-custom-tool
690633cb2a/spec/analyzers/SPEC.md (locations)
2021-02-24 14:16:18 -08:00
JP Simard
559470a245
Integrate OS Signposts to help profile SwiftLint performance ( #3535 )
...
* Integrate OS Signposts to help profile SwiftLint performance
* Split LintOrAnalyzeCommand.lintOrAnalyze(_:) into two functions
Using a builder reference type to share common mutable state.
2021-02-24 10:03:53 -08:00
Frederick Pietschmann
2f6fd1e95f
Fix issue that prevented the inclusion of a configuration file from a parent folder ( #3491 )
...
* Add (currently failing) test for #3485
* [#3485 ] Add missing rootDir adjustment for included / excluded paths
* Add changelog entry
* Adjust tests for relative included / excluded paths
2021-02-23 18:19:19 -05:00
Thomas Goyne
8f216b8398
Support Swift Playground control comments in the comment spacing rule
...
Swift Playgrounds use `//:` to mark prose sections and `//:#` for embedded
content like images and localized prose, so those shouldn't violate the
space-after-comment rule.
2021-02-23 17:33:20 -05:00
leogdion
3643fea111
adding platform specification to Swift package ( #3482 )
2021-02-23 13:29:55 -08:00
JP Simard
402e76b33d
Add a few more possible upcoming versions to testDetectSwiftVersion
...
To give us more lead time before we need to update this again.
2021-02-23 16:27:27 -05:00
JP Simard
eca9ea4bb8
Adding Legacy ObjC Type Rule #2758 ( #3531 )
2021-02-23 12:08:01 -08:00
Christian Mitteldorf
4e75099e16
Link to Ray Wenderlich’s Swift Style guide ( #3250 )
...
GitHub has archived their current style guide.
The style guide from Wenderlich closely follows the existing rules, and is still being maintained.
2021-02-23 12:07:07 -08:00
JP Simard
cfd67b9534
Make strong-iboutlet rule correctable ( #3530 )
...
* Make strong-iboutlet rule correctable
* fixup! Make strong-iboutlet rule correctable
Co-authored-by: Max Haertwig <dev@maxhaertwig.com>
2021-02-23 11:37:23 -08:00
JP Simard
08fbd043c0
Remove stale probot config ( #3529 )
...
I believe this will completely remove the bot.
Rationale: https://github.com/realm/SwiftLint/pull/3385#issuecomment-784411782
> I've changed my mind on this. I believe this is solving the wrong
> problem. It can be very disappointing for users when their issues /
> PRs remain ignored by maintainers for a long time, but I think it's
> worse when issues / PRs are automatically closed, and I don't think it
> actually helps with the health of the project, or make maintainer's
> lives easier.
>
> I can't guarantee anything, but I am working on a plan to improve the
> maintainership of SwiftLint moving forward, and hopefully that can be
> more impactful when it comes to responsiveness to community issues and
> PRs, and I believe that's a better way to triage issues and PRs.
2021-02-23 10:49:14 -08:00
JP Simard
6b51c3ebc5
[UnusedDeclarationRule] Fix false positives with result builders ( #3528 )
2021-02-23 07:59:37 -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
Gio Lodi
ff1ca8fd5a
Update changelog with entry for #3522
2021-02-17 12:19:52 +11:00
Gio Lodi
8248178213
Tweak the auto-correction result console output for clarity
...
A colleague was confused by the output of `swiftlint autocorrect`, she
couldn't understand why SwiftLint told her it corrected thousands of
files when she only touched one.
The "Done correcting \(files.count) ..." output made her think that a
change was made on each of the `files`, when really they had only been
inspected.
A good solution would be to adopt a similar approach as the `lint`
command does.
Not being familiar with the codebase, I though a good first step could
have been to tweak the message a bit, making it clearer that the count
printed to the console is the inspected files.
2021-02-16 20:41:04 +11:00
Otavio Cordeiro
46777539ad
Add opt-in rule private_passthrough_subject ( #3504 )
2021-02-08 10:43:27 -08:00
Colton Schlosser
01a0f82e99
Improve parallelMap implementation by removing iteration for force unwrapping every element ( #3517 )
2021-02-08 06:37:20 -05:00
Otavio Cordeiro
7ea9b733ff
Allow multi-line parameters rule to always break lines ( #3494 )
2021-02-02 13:27:29 -08:00
DwayneCoussement
f66c51b9f2
Update tests to support Swift 5.3.3 ( #3509 )
2021-02-02 07:18:31 -08:00
JP Simard
bbf1ad4a18
[ExplicitSelfRule] Fix violation location and misplaced corrections ( #3507 )
2021-01-29 10:59:28 -08:00
Otavio Cordeiro
59eb887cfa
Add opt-in rule discouraged_assert ( #3506 )
...
Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>
2021-01-29 09:30:57 -08:00
JP Simard
6a38b15657
Revert "Merge pull request #3473 from realm/feature/3472-fix-custom-rules-merging" ( #3503 )
...
This reverts commit 537e53f6b3
, reversing
changes made to ba49f7d309
.
2021-01-22 10:31:05 -08:00
JP Simard
6de5771899
[Analyze] Support compile commands with relative paths ( #3501 )
...
* [Analyze] Support compile commands with relative paths
* Add changelog entry
And made small formatting edits to other recent entries.
2021-01-22 09:44:30 -08:00
Frederick Pietschmann
537e53f6b3
Merge pull request #3473 from realm/feature/3472-fix-custom-rules-merging
...
Multiple Fixes for custom rules
2021-01-15 11:53:17 +01:00
Frederick Pietschmann
22d25da7fc
Add newline at end of yml test file
2021-01-15 00:14:50 +01:00
Frederick Pietschmann
2d17045b11
[ #3477 ] Fix bug that prevented the reconfiguration of a custom rule in a child config
2021-01-14 23:35:21 +01:00
Frederick Pietschmann
a39e72ef13
Fix changelog
2021-01-14 23:35:21 +01:00
Frederick Pietschmann
56e4f175ac
Fix if statement formatting
2021-01-14 23:35:21 +01:00
Frederick Pietschmann
5bffc77af6
Fix custom_rules merging when a configuration is based on only_rules
2021-01-14 23:35:21 +01:00
Frederick Pietschmann
e3e169b4b9
Add changelog entry
2021-01-14 23:35:21 +01:00
Frederick Pietschmann
256288ab88
Separate custom rules merging & filtering to avoid misleading warnings
2021-01-14 23:35:21 +01:00
dependabot[bot]
ba49f7d309
Bump redcarpet from 3.5.0 to 3.5.1 ( #3487 )
...
Bumps [redcarpet](https://github.com/vmg/redcarpet ) from 3.5.0 to 3.5.1.
- [Release notes](https://github.com/vmg/redcarpet/releases )
- [Changelog](https://github.com/vmg/redcarpet/blob/master/CHANGELOG.md )
- [Commits](https://github.com/vmg/redcarpet/compare/v3.5.0...v3.5.1 )
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-11 12:21:59 -08:00
Marcelo Fabri
d10b80d49f
Merge pull request #3474 from realm/feature/swift-532
...
Add 5.3.2 to testDetectSwiftVersion()
2020-12-20 23:31:51 -08:00
Frederick Pietschmann
0a0e3f50eb
Add 5.3.2 to testDetectSwiftVersion()
2020-12-20 15:56:14 +01:00
Frederick Pietschmann
81b12739df
Merge pull request #3467 from advantis/bugfix/file-name-options
...
Fix typos in configuration options for file_name rule
2020-12-20 15:46:53 +01:00
Yurii Kotov
dacfdcef40
Add changelog entry
2020-12-17 16:55:03 +02:00
Yurii Kotov
6dba929b4f
Fix typos in configuration options for file_name rule
2020-12-16 19:56:50 +02:00
JP Simard
5134545093
Make `--strict` mutually exclusive with `--lenient`
2020-12-14 15:54:08 -05:00
JP Simard
7351648590
Fix paths argument handling
2020-12-14 15:53:50 -05:00
JP Simard
6bad2eccdf
Remove unused imports
2020-12-14 15:53:49 -05:00
JP Simard
4a94f6a894
Add changelog entry
2020-12-14 15:53:49 -05:00
JP Simard
fa55508668
Migrate from Commandant to swift-argument-parser
2020-12-14 15:51:04 -05:00
JP Simard
82b00bf4b5
Rename command files
2020-12-14 15:51:04 -05:00
JP Simard
e7f4a8fd67
Update SourceKittenFramework to 0.31.0
2020-12-14 15:51:04 -05:00
JP Simard
2436f669fe
Add empty changelog section
2020-12-14 15:49:31 -05:00
JP Simard
d53fc2664d
release 0.42.0
2020-12-14 15:26:56 -05:00
JP Simard
40cf2ddef2
Fix false positives on unused_declaration for outlets with accessors ( #3462 )
...
* Fix false positives on unused_declaration for outlets with accessors
* Also willSet/didSet
* fixup! Fix false positives on unused_declaration for outlets with accessors
2020-12-11 10:03:20 -08:00
JP Simard
ab6aeed5b1
Replace non_private_xctest_member with test_case_accessibility ( #3464 )
...
in `.swiftlint.yml`.
2020-12-11 09:05:02 -08:00
JP Simard
9c672c774c
Update Yams
2020-12-11 11:20:00 -05:00
JP Simard
ebca5238a7
Fix false positives on unused_declaration for outlets with accessors
2020-12-11 10:07:22 -05:00
JP Simard
f8bc10aaaa
Merge pull request #3460 from realm/dont-log-a-warning-if-no-configuration-files-were-explicitly-specified
...
Don't log a warning if no configuration files were explicitly specified
2020-12-11 10:02:41 -05:00
JP Simard
01b1001a81
fixup! Don't log a warning if no configuration files were explicitly specified
2020-12-11 10:02:16 -05:00
JP Simard
cb3eed544c
Add FileGraphInitializationResult to make error handling more explicit
2020-12-11 09:27:51 -05:00
JP Simard
12cea6b9c7
fixup! Don't log a warning if no configuration files were explicitly specified
2020-12-10 09:39:49 -05:00
JP Simard
ab700a3262
Re-add warning message if the config file was implicit and misconfigured
...
Thanks fredpi!
2020-12-10 09:37:09 -05:00
JP Simard
d75b9c45df
Remove unused error case
2020-12-09 17:18:21 -05:00
JP Simard
35d75809c9
Fix typo
2020-12-09 17:16:50 -05:00
JP Simard
2b50902d1a
Revert most changes, just don't log a warning
2020-12-09 17:14:04 -05:00
JP Simard
d010569f1d
Extract out error string generation
2020-12-09 16:26:10 -05:00
Keith Smiley
800030ad11
Remove NonPrivateXCTestMembersRule ( #3459 )
...
* Remove NonPrivateXCTestMembersRule
I accidentally implemented this rule twice. So TestCaseAccessibilityRule
did the same thing but with a bit more behavior. This change deletes
NonPrivateXCTestMembersRule but also ports over the autocorrection from
it to TestCaseAccessibilityRule.
2020-12-09 13:16:40 -08:00
JP Simard
82e5870a16
Don't log a warning if no configuration files were explicitly specified
...
And none was found at the default location of `.swiftlint.yml`.
2020-12-09 16:16:04 -05:00
JP Simard
71449e76b7
Merge pull request #3455 from realm/add-dockerfile
...
Add Dockerfile
2020-12-09 09:14:19 -05:00
Keith Smiley
22ee449971
Fix @IBInspectable unused declarations with get/set ( #3458 )
2020-12-07 11:07:16 -08:00
JP Simard
c521e54e7e
Merge pull request #3457 from jrturton/weak-delegate-exception-for-@UIApplicationDelegateAdaptor
...
Add exception for UIApplicationDelegateAdaptor
2020-12-04 16:46:12 -05:00
richard.turton
4357eed219
Updated changelog
2020-12-04 17:08:51 +00:00
richard.turton
103cf7504a
Fixed whitespace violations
2020-12-04 17:01:47 +00:00
richard.turton
62298de662
Add exception for UIApplicationDelegateAdaptor
2020-12-04 16:45:51 +00:00
Norio Nomura
a84aee23df
[Makefile] Update zip_linux target to depending Dockerfile
...
Hiding dependencies required at build time in the Dockerfile
2020-12-05 00:25:42 +09:00
Norio Nomura
4e61c8436c
[Docker] Add Dockerfile
...
Provides:
- a runtime environment on ubuntu that does not include the Swift toolchain.
- supportintg `docker build https://github.com/realm/SwiftLint.git `
- add `libcurl4-openssl-dev` as build time dependency that introduced by #3058
2020-12-05 00:22:54 +09:00
Keith Smiley
03f13e5bb7
Remove @IBOutlet and @IBInspectable from UnusedDeclarationRule ( #3432 )
...
The original implementation wasn't tested so it regressed.
https://github.com/realm/SwiftLint/pull/3184
2020-12-03 11:00:53 -08:00
JP Simard
0c5136d725
Merge pull request #3451 from realm/fix-paths-log
...
Fix logging linting the current working directory
2020-12-01 15:12:09 -05:00
JP Simard
f926cfaabd
fixup! fixup! Fix logging linting the current working directory
2020-12-01 14:47:25 -05:00
JP Simard
0019c61de7
fixup! Fix logging linting the current working directory
2020-12-01 14:46:46 -05:00
JP Simard
b73673ab01
Fix logging linting the current working directory
...
Fixes log messages saying `Linting files at path ''` that should have
said `Linting files in current working directory`.
2020-12-01 14:34:16 -05:00
JP Simard
231ef2b5db
Indent changelog entry
2020-11-23 16:52:17 -05:00
JP Simard
be21dc3b4b
Add scrip/get-version script
...
Previous way wasn't working and this way we edit one less file when
pushing new versions.
2020-11-23 11:15:52 -05:00
JP Simard
f0f0086aca
Merge pull request #3443 from realm/remove-info.plist-files
...
Remove Info.plist files
2020-11-23 10:47:36 -05:00
Frederick Pietschmann
b8f5b6a30e
Merge pull request #3058 from realm/feature/remote-child-parent-configs
...
Add remote, parent & child configuration features
2020-11-22 10:55:16 +01:00
Frederick Pietschmann
26aae94f1b
Drop unneeded import statement
2020-11-21 00:58:24 +01:00
Frederick Pietschmann
28cb43afa9
Fix test resources access on Linux
2020-11-21 00:35:34 +01:00
Frederick Pietschmann
715a8db2db
Adjust file naming in child / parent config tests
2020-11-21 00:20:40 +01:00
Frederick Pietschmann
495d742f65
Fix issues originating from new set semantics
2020-11-21 00:05:42 +01:00
Frederick Pietschmann
4c5a3f0577
Add remote, parent & child configuration features
2020-11-20 23:08:37 +01:00
JP Simard
69250c9cd5
Merge pull request #3442 from realm/fix-deprecation-compiler-warnings-on-linux-for-showdocscommand.swift
...
Fix deprecation compiler warnings on Linux for ShowDocsCommand.swift
2020-11-20 15:26:44 -05:00
JP Simard
f45f381320
fixup! Remove Info.plist files
2020-11-20 15:25:50 -05:00
JP Simard
e143a18e5c
Remove Info.plist files
...
These are no longer needed now that we removed the Xcode project.
2020-11-20 15:01:09 -05:00
JP Simard
8bf8ca482a
Fix deprecation compiler warnings on Linux for ShowDocsCommand.swift
2020-11-20 15:00:54 -05: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
JP Simard
cd9cf682e7
Merge pull request #3441 from realm/fix-how-test-failures-are-rendered
...
Fix how test failures are rendered
2020-11-20 11:55:02 -05:00
JP Simard
36263cd0b9
Merge pull request #3431 from realm/ks/add-support-for-testing-examples-with-configuration
...
Add support for testing Examples with configuration
2020-11-20 11:53:25 -05:00
JP Simard
5a077d9f3f
Fix how test failures are rendered
2020-11-20 11:19:27 -05:00
JP Simard
42373a94b6
Remove example failing test
...
This is hard to fix, and already covered by the corrections.
2020-11-20 11:18:07 -05:00
JP Simard
5f057d5ebf
Merge pull request #3437 from realm/build-universal-binary
...
[Makefile] Build `swiftlint` as a universal binary on macOS
2020-11-19 07:14:50 -05:00
Norio Nomura
88d77a3211
[Makefile] Build `swiftlint` as a universal binary on macOS
...
SwiftPM 5.3 uses the `XCBuild.framework` to generate universal binaries when it receives multiple `--arch` options.
In that case, `--show-bin-path` returns `.build/apple/Products/Release`.
2020-11-19 18:48:11 +09:00
JP Simard
b484d439b8
Merge pull request #3434 from realm/static-stdlib-zip-linux
...
Use `-static-stdlib` on building Linux binary for release artifacts
2020-11-18 08:51:43 -05:00
Norio Nomura
97052faf18
Use `-static-stdlib` on building Linux binary for release artifacts
...
This change prevents `swiftlint` from having links to shared libraries belonging to `/usr/lib/swift`.
```
$ docker run -v$PWD:$PWD -w$PWD --rm swift sh -c 'ldd $(swift build -c release --show-bin-path)/swiftlint'
linux-vdso.so.1 (0x00007ffee8bb8000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f75e750b000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f75e7308000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f75e7104000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f75e6d66000)
libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2 (0x00007f75e69a5000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f75e661c000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f75e6404000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f75e6013000)
/lib64/ld-linux-x86-64.so.2 (0x00007f75ea7bf000)
libicuuc.so.60 => /usr/lib/x86_64-linux-gnu/libicuuc.so.60 (0x00007f75e5c5b000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f75e5a3e000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f75e5818000)
libicudata.so.60 => /usr/lib/x86_64-linux-gnu/libicudata.so.60 (0x00007f75e3c6f000)
```
I confirmed that `swiftlint` produced by `make zip_linux` works with following docker images:
- swift:5.3.1-xenial
- swift:5.3.1-bionic
- swift:5.3.1-focal
- swift:5.3.1-centos8
- swift:5.3.1-amazonlinux2
- norionomura/swift:5.3.1
- norionomura/swift:5.3.0
- norionomura/swift:5.2.5
- norionomura/swift:5.1.5
- norionomura/swift:5.0.3
2020-11-18 21:39:31 +09:00
Keith Smiley
e50e34a60a
Add another
2020-11-16 15:54:23 -08: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
Keith Smiley
866102c3fc
Add XCTestCase examples to unused declaration rule ( #3192 )
2020-11-16 15:32:51 -08:00
Keith Smiley
3151e6c45f
Add NonPrivateXCTestMembersRule ( #3248 )
...
Co-authored-by: JP Simard <jp@jpsim.com>
2020-11-16 09:50:56 -08:00
JP Simard
07f559549a
Rename OverridenSuperCallConfiguration to fix typo ( #3426 )
...
* BREAKING CHANGE: As `OverridenSuperCallConfiguration` is a
publicly-exposed struct, this rename should be considered breaking.
* Fix consoleDescription for OverriddenSuperCallConfiguration
2020-11-11 13:37:12 -05:00
Jan-Otto Kröpke
874cacbd1f
Add codeclimate reporter ( #3425 )
2020-11-11 10:29:00 -08: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
Noah Gilmore
2e26e9cd93
Merge pull request #3416 from noahsark769/noahsark769/comment-spacing-rule-updated
...
Add CommentSpacingRule (#3233 )
2020-11-10 17:08:40 -08:00
Noah Gilmore
6d4487c517
Fix a few test which failed due to comment_spacing being a default rule
2020-11-10 16:08:25 -08:00
JP Simard
bf2790df54
Enable CommentSpacingRule by default
...
And fix violations in SwiftLint
2020-11-10 12:50:39 -05:00
JP Simard
869fe868b3
Apply minor refactorings
...
1. Add some comments
2. Name variables when used in multiline closures
3. Change violation range length from 1 to 0, which simplifies the
substitution
4. Tweak indentation
2020-11-10 12:42:40 -05:00
JP Simard
30db88dde3
Add double trailing space to changelog entry
2020-11-10 12:28:28 -05:00
Noah Gilmore
5185afc4a4
Update Changelog
2020-11-09 21:57:01 -08:00
Noah Gilmore
5108233ac5
Further PR comments
2020-11-09 21:54:14 -08:00
Noah Gilmore
6bd38e8607
Update Source/SwiftLintFramework/Rules/Lint/CommentSpacingRule.swift
...
Co-authored-by: JP Simard <jp@jpsim.com>
2020-11-09 21:54:14 -08:00
Noah Gilmore
442eac2556
Update Source/SwiftLintFramework/Rules/Lint/CommentSpacingRule.swift
...
Co-authored-by: JP Simard <jp@jpsim.com>
2020-11-09 21:54:14 -08:00
Noah Gilmore
3508ef8e1e
Add changelog entry
2020-11-09 21:54:14 -08:00
Noah Gilmore
1a104e4dc4
Add comments
2020-11-09 21:54:14 -08:00
Noah Gilmore
dd5c0d3599
Add CommentSpacingRule ( #3233 )
2020-11-09 21:54:14 -08:00
JP Simard
eb0c1b271f
Fix changelog entry
2020-11-09 17:44:50 -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
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
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
mknabbe
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 Smiley
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
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
JP Simard
f71394a372
[UnusedDeclarationRule] Add more tests ( #3359 )
2020-09-21 12:10:46 -07:00
JP Simard
59d6c2ef52
Test CI with official Swift 5.3 release ( #3356 )
2020-09-20 11:16:10 -04:00
JP Simard
0ecf9a945b
Don't mark `@NSApplicationMain` or `@UIApplicationMain` classes as unused ( #3355 )
2020-09-20 07:16:26 -07:00
hank121314
5e537fa821
[Fix] `UnusedCaptureListRule`: implicit self in @escaping closures ( #3352 )
...
## Summary
This pr fixes : #3267 .
Since Swift 5.3 is released. It support implicit self in @escaping closures([SE-0269](https://github.com/apple/swift-evolution/blob/master/proposals/0269-implicit-self-explicit-capture.md ))
I think we should exclude self keyword from capture list rule.
## Test Plan
I have already add some test in example.
Thanks you so much for your code review!
2020-09-18 07:26:49 -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
JP Simard
9b93b3efb8
[SwiftLintFile] Remove lock in favor of UUID ( #3347 )
...
We were using this lock to guarantee a new ID for every file, but we can
get that benefit by using values that are guaranteed to be unique
without the need for locks, such as a UUID.
2020-09-17 07:35:05 -07:00
JP Simard
ea311bab23
[UnusedDeclarationRule] Speed up and detect more dead code ( #3340 )
...
By using SourceKit's `index` request to index the entire source file,
we can avoid having to make `cursor-info` requests for every candidate
token in the file, which scales linearly with the number of candiate
tokens.
For the Yams project, this approach improved the total SwiftLint run
time by 4.6x: 7.9 down from 36.8s.
The SourceKit index response doesn't have everything we need to identify
declarations, so we still need to make some `cursor-info` requests,
mostly to detect overrides: protocol conformances and parent class
overrides.
This approach ends up finding more unused declarations because the index
contains more declared USRs than can be found by calling `cursor-info`
on candidate tokens in a file.
---
Remove unused declaration in ArrayInitRule
---
Update package versions
2020-09-15 10:33:27 -07:00
JP Simard
d9ce579b38
Add empty changelog section
2020-09-10 22:41:13 -04:00
JP Simard
9ab72060b6
release 0.40.2
2020-09-10 22:25:10 -04:00
JP Simard
7009463876
Format changelog
2020-09-10 21:15:07 -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
JP Simard
4083f16885
Merge pull request #3331 from lightsprint09/patch-1
...
Use correct term for associated values
2020-09-03 07:37:34 -07:00
JP Simard
89981cc984
Merge pull request #3330 from realm/add-linux-binary-to-release-artifacts
...
Add Linux binary to release artifacts
2020-09-03 06:18:16 -07:00
Lukas Schmidt
96c8918982
Update CHANGELOG.md
2020-09-03 12:23:34 +02: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
JP Simard
d0d9ad575f
Add Linux binary to release artifacts
...
There are a lot of libraries dynamically linked, so it's unlikely to
work in most places other than the same Docker image used to build the
binary (latest official Swift Docker image).
It might still be useful if you can guarantee that you'll use this from
that image.
ldd .build/release/swiftlint
linux-vdso.so.1 (0x00007fff38db5000)
libswiftCore.so => /usr/lib/swift/linux/libswiftCore.so (0x00007f11503cd000)
libFoundation.so => /usr/lib/swift/linux/libFoundation.so (0x00007f114fba6000)
libswiftGlibc.so => /usr/lib/swift/linux/libswiftGlibc.so (0x00007f1151264000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f114f987000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f114f784000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f114f580000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f114f1e2000)
libswiftDispatch.so => /usr/lib/swift/linux/libswiftDispatch.so (0x00007f115122b000)
libdispatch.so => /usr/lib/swift/linux/libdispatch.so (0x00007f114ef82000)
libBlocksRuntime.so => /usr/lib/swift/linux/libBlocksRuntime.so (0x00007f114ed7f000)
libFoundationXML.so => /usr/lib/swift/linux/libFoundationXML.so (0x00007f11511d2000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f114e98e000)
libicui18nswift.so.65 => /usr/lib/swift/linux/libicui18nswift.so.65 (0x00007f114e463000)
libicuucswift.so.65 => /usr/lib/swift/linux/libicuucswift.so.65 (0x00007f114e062000)
libicudataswift.so.65 => /usr/lib/swift/linux/libicudataswift.so.65 (0x00007f114c3b3000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f114c02a000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f114be12000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1151053000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f114bc0a000)
libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2 (0x00007f114b849000)
libicuuc.so.60 => /usr/lib/x86_64-linux-gnu/libicuuc.so.60 (0x00007f114b491000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f114b274000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f114b04e000)
libicudata.so.60 => /usr/lib/x86_64-linux-gnu/libicudata.so.60 (0x00007f11494a5000)
2020-09-02 15:33:46 -04:00
JP Simard
2ea422b52a
Add empty changelog section
2020-08-27 11:52:50 -04:00
JP Simard
1a1db6c706
release 0.40.1
2020-08-27 11:33:45 -04:00
JP Simard
ff0e9f46c0
Merge pull request #3319 from realm/update-sourcekitten-and-yams
...
Update SourceKitten and Yams
2020-08-24 20:56:15 -07:00
JP Simard
81e8501dd5
Update SourceKitten and Yams
2020-08-24 22:27:13 -04:00
JP Simard
e677737fe6
Merge pull request #3313 from realm/ks/add-support-for-params-files-for-file-path-arguments
...
Add support for params files for file path arguments
2020-08-21 08:13:06 -07:00
Keith Smiley
eb841988f9
Add empty args
2020-08-20 11:32:05 -07:00
Keith Smiley
32579f457a
Add support for params files for file path arguments
...
This allows you to pass `@path/to/file` which will be read line by line
for the list of files to lint / analyze. This is useful if you want to
pass a massive list of files which will either exceed arg max, or
break most unix tools if you use script input files + env vars.
2020-08-20 11:20:09 -07:00
JP Simard
e90d2e2005
Merge pull request #3309 from ZevEisenberg/patch-1
...
Explain why two trailing spaces are needed
2020-08-18 10:57:32 -07:00
Zev Eisenberg
5a1693c6aa
Less forceful language.
2020-08-18 11:32:23 -04:00
Zev Eisenberg
93527bc9b8
Explain why two trailing spaces are needed.
2020-08-18 11:23:26 -04:00
JP Simard
af2837e3e5
Merge pull request #3298 from cfiken/fix-swift-version
...
Fixed .swift-version with Swift 5.1
2020-08-13 07:46:40 -07:00
JP Simard
c3b5bc186e
Merge branch 'master' into fix-swift-version
2020-08-13 07:46:08 -07:00
JP Simard
7feb50f0df
Merge pull request #3299 from cfiken/fix_swift_version_test
...
Update test `testDetectSwiftVersion` for Swift 5.2.5
2020-08-13 07:44:50 -07:00
cfiken
1b95821205
Fix: testDetectSwiftVersion for Swift 5.2.5
2020-08-13 12:48:33 +09:00
cfiken
776b7d74e2
Fix: CHANGELOG
2020-08-13 12:33:14 +09:00
cfiken
2418534ce5
Fix: .swift-version with Swift 5.1
2020-08-13 12:16:28 +09:00
Marcelo Fabri
0e8ad1d169
Update CHANGELOG.md
2020-08-10 09:43:13 -07:00
Marcelo Fabri
da66a81710
release 0.40.0
2020-08-10 08:23:58 -07:00
Marcelo Fabri
83f52704f4
Merge pull request #3292 from realm/marcelo/unneeded_notification_center_removal
...
Add `unneeded_notification_center_removal` rule
2020-08-10 08:17:29 -07:00
Marcelo Fabri
5e1c13be52
Add `unneeded_notification_center_removal` rule
...
Fixes #2755
2020-08-10 07:46:51 -07:00
Marcelo Fabri
6a8f413bd7
Merge pull request #3291 from realm/marcelo/codecov
...
Setup codecov
2020-08-10 02:11:41 -07:00
Marcelo Fabri
6cf3534db9
Setup codecov
2020-08-10 01:41:32 -07:00
Marcelo Fabri
5ae6a32944
Merge pull request #3289 from realm/dependabot/bundler/kramdown-2.3.0
...
Bump kramdown from 2.1.0 to 2.3.0
2020-08-08 16:38:13 -07:00
dependabot[bot]
bf834b6ff4
Bump kramdown from 2.1.0 to 2.3.0
...
Bumps [kramdown](https://github.com/gettalong/kramdown ) from 2.1.0 to 2.3.0.
- [Release notes](https://github.com/gettalong/kramdown/releases )
- [Changelog](https://github.com/gettalong/kramdown/blob/master/doc/news.page )
- [Commits](https://github.com/gettalong/kramdown/commits )
Signed-off-by: dependabot[bot] <support@github.com>
2020-08-07 23:28:37 +00:00
Marcelo Fabri
1dbe1f23f0
Merge pull request #3153 from realm/mf-bugfix-3150
...
Fix false positives in extension_access_modifier with Swift 5.2
2020-08-05 22:14:41 -07:00
Marcelo Fabri
4756ce6b69
Ignore local vars and params
2020-08-05 21:46:33 -07:00
Marcelo Fabri
bb372c2146
Fix false positives in extension_access_modifier with Swift 5.2
2020-08-05 21:36:09 -07:00
Marcelo Fabri
a61ae0e656
Update CHANGELOG.md
2020-08-05 21:30:19 -07:00
Marcelo Fabri
124ed9564b
Merge pull request #3047 from 417-72KI/feature/open-browser-for-docs
...
Add `swiftlint show-docs` command to easily open online docs.
2020-08-05 21:08:09 -07:00
Marcelo Fabri
20092640fe
Merge pull request #3137 from AdrianBinDC/add-access-control-level-tests
...
Add tests for AccessControlLevel
2020-08-05 20:39:26 -07:00
Marcelo Fabri
e6d9f72cad
Rename command
2020-08-05 20:37:49 -07:00
417-72KI
6c0f8365b3
Remove backquotes and "Framework" from the sentence
2020-08-05 20:34:33 -07:00
417-72KI
d0328b3990
Update CHANGELOG
2020-08-05 20:34:33 -07:00
417-72KI
3d05146c3a
Add file to pbxproj
2020-08-05 20:34:33 -07:00
417-72KI
6e237f77b8
Fix URL
2020-08-05 20:34:33 -07:00
417-72KI
623e69e623
Add `show-docs` command
2020-08-05 20:34:33 -07:00
Marcelo Fabri
6dbc0523fa
Rename file
2020-08-05 20:13:53 -07:00
Marcelo Fabri
2b7230709d
Move tests
2020-08-05 20:13:03 -07:00
Adrian Bolinger
c156af86bc
Add tests for AccessControlLevel
...
- add assertions for `description`
- add assertions to test 'priority'
2020-08-05 20:10:51 -07:00
Marcelo Fabri
a5dbe93023
Merge pull request #3191 from MortyMerr/feature/preferZeroRule
...
Add prefer_zero_over_explicit_init rule
2020-08-05 15:49:22 -07:00
Marcelo Fabri
2bb7e842b5
Merge pull request #3287 from realm/marcelo/maybe-fix-jazzy
...
Fix Jazzy
2020-08-05 15:23:14 -07:00
Marcelo Fabri
aae9730ee1
Fix Jazzy
...
Don’t try to create ~/.ssh if it already exists
2020-08-05 15:22:25 -07:00
Marcelo Fabri
244f41c2dd
Improve CHANGELOG
2020-08-05 15:12:22 -07:00
Marcelo Fabri
30c7add095
Change to .idiomatic
2020-08-05 15:11:41 -07:00
antonnazarov
09a0a216d1
Change types on string representation
2020-08-05 15:05:02 -07:00
antonnazarov
63bd8ce7a5
Add PreferZeroOverExplicitInitRule
2020-08-05 15:05:02 -07:00
Marcelo Fabri
89523a92a9
Merge pull request #3122 from lordzsolt/if-guard-case
...
Extend empty_enum_arguments rule to support `if case` and `guard case`
2020-08-05 14:51:55 -07:00
Marcelo Fabri
c9d96ff5c7
Merge pull request #3284 from janakmshah/master
...
Include IndexSet in compiler_protocol_init
2020-08-05 14:42:43 -07:00
Janak Shah
733db8496b
Update CHANGELOG.md
2020-08-05 13:18:17 +01:00
Janak Shah
6b3e4e64a0
Include IndexSet in byArrayLiteral collection
2020-08-05 13:03:46 +01:00
Zsolt Kovacs
f3802a3a75
Update CHANGELOG.md
2020-08-05 03:49:49 -07: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
0cabed81d7
Merge pull request #3283 from realm/marcelo/bugfix-3214
...
Use atexit on Linux
2020-08-05 03:47:33 -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
caedfcb62b
Use atexit on Linux
...
Fixes #3214
2020-08-05 01:40:38 -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
5a817b0139
Update CHANGELOG.md
2020-08-05 01:03:18 -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
ed37784cd6
Merge pull request #3280 from realm/marcelo/bugfix-3259
...
Fix false positive in no_space_in_method_call with multiple trailing closures
2020-08-04 23:56:35 -07:00
Marcelo Fabri
b1a776116e
Add CHANGELOG entry
2020-08-04 23:46: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
5ad5bf2dae
Merge pull request #3276 from realm/marcelo/bugfix-3186
...
Fix false negative in `explicit_acl` rule with Swift 5.2+
2020-08-04 20:53:42 -07:00
Marcelo Fabri
b541d253c6
Ignore .varParameter
2020-08-04 20:25:16 -07:00
Marcelo Fabri
1279523798
Ignore varLocal
2020-08-04 16:22:11 -07:00
Marcelo Fabri
934a208df7
Fix CHANGELOG
2020-08-04 15:53:20 -07:00
Marcelo Fabri
0a592a34c9
Fix rule
2020-08-04 15:53:11 -07:00
Keith Smiley
cf94d5d8ea
Add IBInspectableInExtensionRule ( #3174 )
2020-08-04 14:15:40 -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
6d2360a2f4
Merge pull request #3273 from realm/marcelo/update-linux-main
...
Update LinuxMain to add missing test
2020-08-04 05:03:58 -07:00
Marcelo Fabri
2d7702fc25
Fix false positive in `explicit_acl` rule with Swift 5.2+
...
Fixes #3186
2020-08-04 04:24:52 -07:00
Marcelo Fabri
a4a0481a50
Merge pull request #3275 from realm/marcelo/rename-blacklist
...
Remove a usage of “blacklist”
2020-08-04 04:01:08 -07:00
Marcelo Fabri
28bec96b3e
Remove a usage of “blacklist”
2020-08-04 04:00:36 -07:00
Marcelo Fabri
20b86147d9
Merge pull request #3236 from realm/cg_improve-whitelist-docs
...
Improve visibility of whitelist_rules option
2020-08-04 03:53:07 -07:00
Marcelo Fabri
dc1b60742e
Update CHANGELOG.md
2020-08-04 03:36:01 -07:00
Marcelo Fabri
b64d02c829
Merge pull request #3175 from teameh/false-positive-raw_value_for_camel_cased_codable_enum
...
Fix false positive uppercase enum case in raw_value_for_camel_cased_codable_enum
2020-08-04 03:35:36 -07:00
Tieme van Veen
5f8f9a5a3d
Fix false positive UPPERCASE raw_value_for_camel_cased_codable_enum
2020-08-04 03:34:28 -07:00
Marcelo Fabri
e238587588
Update CHANGELOG.md
2020-08-04 03:24:56 -07:00
Marcelo Fabri
0219584605
Update LinuxMain to add missing test
2020-08-04 03:24:15 -07:00
Marcelo Fabri
240e25232f
Add computed_accessors_order rule
...
Fixes #3158
2020-08-04 03:23:36 -07:00
Marcelo Fabri
a23d4e1c34
Update CHANGELOG.md
2020-08-04 03:20:48 -07:00
Marcelo Fabri
5242d6b442
Merge pull request #3272 from realm/marcelo/bugfix-3253
...
Fix false positive on switch_case_on_newline with Swift 5.3
2020-08-04 03:18:33 -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
Marcelo Fabri
990c2808ef
Merge pull request #3271 from realm/marcelo/run-xcode-12
...
Run tests on Xcode 12 as well
2020-08-04 03:16:07 -07:00
Marcelo Fabri
a2de4a0585
Merge pull request #3223 from liamnichols/ln/reporters-in-readme
...
Update README files to include complete list of reporters
2020-08-04 03:15:36 -07:00
Marcelo Fabri
a718ffae35
Merge pull request #3193 from yusukegoto/duplicate_imports_configuration
...
Fix severity level configuration for duplicate_imports
2020-08-04 03:01:06 -07:00
Marcelo Fabri
d09a1411c9
Merge branch 'master' into duplicate_imports_configuration
2020-08-04 03:00:38 -07:00
Marcelo Fabri
1f5ee4d9fd
Run tests on Xcode 12 as well
2020-08-04 02:45:42 -07:00
Danny Moesch
d08ea47920
Fix #3034 : Allow opening brace directly after another opening brace or `in`
...
This special case occurs in functions implicitly returning closures.
2020-07-26 12:38:46 +02:00
JP Simard
0dd3dac82c
Merge pull request #3262 from changm4n/master
...
Typo fix in README_KR
2020-07-14 08:49:05 -04:00
changmin lee
e367a11175
Correct typo in README_KR.md
2020-07-14 18:57:56 +09:00
Keith Smiley
46b99892d2
fix lint
2020-06-30 14:03:12 -07:00
Keith Smiley
660920a5f8
Add 'always_keep_imports' to UnusedImportRule
...
Sometimes we hit issues with SourceKit that cause this rule to produce
false positives of some imports. While we would prefer to fix all of
these cases whenever possible, this gives us a temporary escape hatch to
tell the rule never to remove imports of specific modules until the
fixes land in SwiftLint or Swift itself.
Currently this is for us to opt out of https://bugs.swift.org/browse/SR-13120
2020-06-30 10:00:33 -07:00
JP Simard
075312af6e
Fix Linux Swift 5.2 Azure Pipeline ( #3247 )
...
* Update Makefile with Swift 5.2.4 image
* Add support for Xcode 11.5 and Swift 5.2.4
2020-06-18 13:32:26 -07:00
Frederick Pietschmann
eaff622233
Add support for Xcode 11.5 and Swift 5.2.4
2020-06-18 14:52:20 -05:00
Ilias Karim
a91c987552
Update Makefile with Swift 5.2.4 image
2020-06-18 14:51:45 -05:00
Cihat Gündüz
11b13da9ad
Improve visibility of whitelist_rules option
...
Related to https://github.com/realm/SwiftLint/issues/1451 and https://github.com/realm/SwiftLint/issues/1118
2020-06-11 17:24:14 +02:00
Liam Nichols
d1b1393748
Update README files to include complete list of reporters
2020-06-05 14:06:46 +01:00
Noah Gilmore
bda1cd56e0
#3167 : Fixes false positives for multiline_parameters_brackets and multiline_arguments_brackets ( #3171 )
...
* Issue #3167 : Fixes false positives for multiline_parameters_brackets and multiline_arguments_brackets
* Add changelog entry
* Fix trailing comma in MultilineParametersBracketsRule nontriggering examples
* Remove header comments from ExtendedStringTests.swift
Co-authored-by: Paul Taykalo <ptaykalo@macpaw.com>
2020-05-29 11:59:02 +03:00
Mateusz Matrejek
8ed7c31161
Fix false positive in with Swift 5.2 ( #3112 ) ( #3206 )
2020-05-27 22:13:46 +03:00
Tieda
9f05692d12
Typo fix in README_CN ( #3215 )
...
`XCode` -> `Xcode`
2020-05-24 14:09:45 -07:00
Yusuke Goto
7da113e932
Fix severity level configuration for duplicate_imports
2020-05-12 17:27:33 +09:00
Keith Smiley
e3ba417303
Fix UnusedImportRule breaking transitive imports ( #3198 )
2020-05-06 15:39:32 -07:00
JP Simard
345933ebb1
Run CI on Linux Swift 5.2 ( #3199 )
...
* Run CI on Linux Swift 5.2
* fixup! Run CI on Linux Swift 5.2
* Move SwiftVersion tests to its own file
2020-05-06 14:16:17 -07:00
JP Simard
52cd6ebe06
Fix `@available` attribute to work around SR-12500
...
https://bugs.swift.org/browse/SR-12500
2020-05-06 13:33:10 -07:00
Keith Smiley
bf3da85d8d
Improve compile commands error handling ( #3188 )
...
* Improve compile commands error handling
Previously when a compile commands file was invalid, it could be hard to
figure out what about it was wrong. This adds some more granular error
handling which hopefully helps provide valid files here.
* fix desc
* Fixups
* Update changelog
* Make what broke clear
* Reword changelog entry
Co-authored-by: JP Simard <jp@jpsim.com>
2020-04-28 09:20:07 -07:00
Cihat Gündüz
5a22b94ec6
Add new file_content_type for PreviewProvider subclasses ( #3063 )
...
Fixes #2860 .
Co-authored-by: Paul Taykalo <tt.kilew@gmail.com>
2020-04-24 13:21:24 +03:00
JP Simard
889dc49bb6
Remove support for compiling with 5.0.x ( #3180 )
...
* Remove support for compiling with 5.0.x
* fixup! Remove support for compiling with 5.0.x
2020-04-14 08:46:23 -07:00
Alexander Chapliuk
ef4a37ee1e
JUnit reporter for GitLab artifact:report:junit ( #3177 )
...
* Add JUnit reporter for GitLab artifact:report:junit
* Added CHANGELOG entry
Co-authored-by: Alexander Chapliuk <2318002+krin-san@users.noreply.github.com>
2020-04-12 17:14:52 +03:00
JP Simard
1e1807b88b
Add empty changelog section
2020-04-03 20:52:26 -07:00
JP Simard
b1c72069ca
release 0.39.2
2020-04-03 20:22:50 -07:00
JP Simard
bc4b7d2962
Update CI to run jobs with Xcode 11.0 to 11.4 ( #3168 )
...
* Update CI to run jobs with Xcode 11.0 to 11.4
In the process, remove CI jobs running with Swift 5.0.x and indicate
in the changelog that the next release will be the last one to support
building with Swift 5.0.x.
* fixup! Update CI to run jobs with Xcode 11.0 to 11.4
* fixup! Update CI to run jobs with Xcode 11.0 to 11.4
* fixup! Update CI to run jobs with Xcode 11.0 to 11.4
* fixup! Update CI to run jobs with Xcode 11.0 to 11.4
* Disable Swift 5.2 tests on Linux due to SR-12500
* Update ruby gems
Mostly to get jazzy 0.13.2 with Swift 5.2 bug fixes.
2020-04-03 18:06:22 -07:00
JP Simard
da3e1a793b
Fix false positives in valid_ibinspectable rule when using Swift 5.2 ( #3155 )
...
* Fix false positives in valid_ibinspectable rule when using Swift 5.2
when defining inspectable properties in class extensions with computed
properties.
The following was triggering:
```swift
extension Foo {
@IBInspectable var color: UIColor {
set {
self.bar.textColor = newValue
}
get {
return self.bar.textColor
}
}
}
```
Fix by checking to see if an instance property has `set` keywords in its
body when running with Swift 5.2 or later.
* fixup! Fix false positives in valid_ibinspectable rule when using Swift 5.2
2020-03-27 10:04:04 -07:00
JP Simard
85d3425210
Fix attributes rule false positive with Swift 5.2 ( #3154 )
...
The following was triggering:
```swift
func printBoolOrTrue(_ expression: @autoclosure () throws -> Bool?) rethrows {
try print(expression() ?? true)
}
```
Fix by adding the `rethrows` attribute kind to the rule's blacklist.
2020-03-27 09:33:12 -07:00
Marcelo Fabri
e6ecd6b8ce
Fix CHANGELOG link
2020-03-26 19:31:38 -07:00
Marcelo Fabri
0bbbcb0a56
Fix false positives in redundant_objc_attribute with Swift 5.2 ( #3152 )
2020-03-26 19:23:48 -07:00
Marcelo Fabri
39ee6fe34e
Fix false positives on implicit_getter with Swift 5.2+ ( #3151 )
...
Fixes #3149
2020-03-26 18:53:36 -07:00
JP Simard
c201ae43e6
Simplify regex ( #3145 )
...
* Simplify regex
`\w` already includes `_`
* Fix test
2020-03-18 16:23:52 -07:00
Ryoya Ito
302f377a4b
fix links about configuration rules ( #3142 )
2020-03-13 08:34:43 -07:00
JP Simard
d10ccacb45
Add unused_import config options to require imports for each module used ( #3123 )
...
For example, if `CGFloat` is used in a file where only `UIKit` is imported but not `CoreGraphics`, this will be a violation even if the file previously compiled.
This is because Swift allows referencing some declarations that are only transitively imported.
Enabling the `require_explicit_imports` configuration option will require that the module of every declaration referenced in a source file be explicitly imported.
This will add significant noise to the imports list, but has a few advantages:
1. It will be easier to understand all the dependencies explicitly referenced in a source file.
2. Correcting the `unused_import` rule will no longer introduce compilation errors in files that compiled prior to the correction.
If missing imports are added to a file when correcting it, the `sorted_imports` rule will be automatically run on that file.
If you with to allow some imports to be implicitly importable transitively, you may specify the `allowed_transitive_imports` configuration:
```yaml
unused_import:
require_explicit_imports: true
allowed_transitive_imports:
- module: Foundation
allowed_transitive_imports:
- CoreFoundation
- Darwin
- ObjectiveC
```
2020-02-22 14:39:07 -08:00
JP Simard
8beb7144f0
Add empty changelog section
2020-02-11 14:11:39 -08:00
JP Simard
8f22943ca1
release 0.39.1
2020-02-11 13:43:28 -08:00
JP Simard
b744cf08f1
Temporarily remove all SwiftSyntax rules and support ( #3107 )
...
The new rules introduced in 0.39.0 that depend on SwiftSyntax have been temporarily removed as we work out release packaging issues.
* `prohibited_nan_comparison`
* `return_value_from_void_function`
* `tuple_pattern`
* `void_function_in_ternary`
See https://github.com/realm/SwiftLint/issues/3105 for details.
2020-02-11 13:40:04 -08:00
JP Simard
05a8a854f5
Fix unused_import rule reported locations and corrections ( #3106 )
...
When multiple `@testable` imports are involved.
Because we use the `.dotMatchesLineSeparators` regular expression option, the dot was matching across lines when the intention was for it to just match `\w_` characters.
2020-02-11 11:23:27 -08:00
Marcelo Fabri
5a4c3f143d
release 0.39.0
2020-02-10 22:19:59 -08:00
Marcelo Fabri
6adf529e7e
Fix false positive in `empty_string` rule with multiline literals ( #3101 )
...
Fixes #3100
2020-02-10 08:27:44 -08:00
Marcelo Fabri
c5e7bb3d31
Fix PrivateActionRule in Swift 5.2 ( #3092 )
2020-02-09 22:16:00 -08:00
Marcelo Fabri
4e84992a4a
Fix false positive in implicit_getter with Swift 5.2 ( #3099 )
...
Fixes #3074
2020-02-09 20:00:53 -08:00
Marcelo Fabri
a2fe35d620
Fix false positive in `attributes` with Swift 5.2 ( #3097 )
...
Fixes #3079
2020-02-09 18:17:45 -08:00
Marcelo Fabri
085e8ea0c9
Fix NSObjectPreferIsEqualRuleTests with Swift 5.2 ( #3096 )
...
This is not valid Swift code and Swift 5.2 changes the SourceKit response: https://bugs.swift.org/browse/SR-12167
2020-02-09 17:09:57 -08:00
Marcelo Fabri
66848e0186
Enable some opt-in rules in SwiftLint itself ( #3095 )
2020-02-09 17:07:24 -08:00
Marcelo Fabri
c47db1b093
Fix testDetectSwiftVersion with Swift 5.2 ( #3093 )
2020-02-09 16:20:52 -08:00
Marcelo Fabri
b303cd64ea
Make SyntaxRules Opt-In ( #3094 )
2020-02-09 16:20:14 -08:00
Marcelo Fabri
14da706ae9
Remove unused variable in AttributesRule ( #3090 )
2020-02-09 16:06:27 -08:00
Marcelo Fabri
b70b7778df
Fix UnownedVariableCaptureRuleTests in Swift 5.2 ( #3091 )
...
https://bugs.swift.org/browse/SR-12168
2020-02-09 16:06:11 -08:00
Marcelo Fabri
04dbf708ee
Update CHANGELOG.md
2020-02-09 15:13:54 -08:00
Marcelo Fabri
fdd16a6853
Add `prohibited_nan_comparison` opt-in rule ( #3089 )
...
Fixes #2086
2020-02-09 15:13:25 -08:00
Zsolt Kovács
ab8cd43e67
Empty count configuration ( #3052 )
...
* Add `only_after_dot` configuration option to `empty_count` rule
* Update CHANGELOG.md
* Adopt Example wrapper
* Change severity level to error
2020-02-09 15:12:54 -08:00
Marcelo Fabri
62e273c46c
Do not trigger optional_enum_case_matching on `_?` ( #3088 )
...
Fixes #3057
2020-02-08 14:42:55 -08:00
Marcelo Fabri
f95768d2e6
Add `tuple_pattern` opt-in rule ( #3086 )
...
* Add `tuple_pattern` opt-in rule
Fixes #2203
* Remove unused import
2020-02-08 13:57:17 -08:00
Marcelo Fabri
bdede7b9c1
Remove extra space in `optional_enum_case_matching` description ( #3087 )
2020-02-08 13:49:21 -08:00
Marcelo Fabri
6ddcf2c281
Update CHANGELOG.md
2020-02-08 13:34:44 -08:00
David Harris
8c789bb3e2
feature: add config setting to exist successfully in case of no lintable ( #2732 )
...
files
2020-02-08 13:33:50 -08:00
Marcelo Fabri
1d39071dfd
Add `void_function_in_ternary` opt-in rule ( #3085 )
...
* Add `void_function_in_ternary` opt-in rule
Fixes #2358
* Remove unused import and improve description
2020-02-08 13:23:02 -08:00
Marcelo Fabri
8d9c501cb8
Add optional return_value_from_void_function rule using SwiftSyntax ( #3054 )
...
* Add optional return_value_from_void_function rule using SwiftSyntax
* Use Script/bootstrap in CI
* Make SwiftSyntax optional
* Make SwiftSyntax optional in SPM
* Fix Package.swift
* Try again
* Add minSwiftVersion
* Fix thread sanitizer issue
* Take 2
* Fix false positive on nested computed variables
* Remove support for Xcode 10.x
* Fix rule description
* Enable opt-in rule in configuration file
* Extract code into `SyntaxRule` protocol
* nit: make property private
* Missing docs
* Fix MasterRuleList.swift
* Update CHANGELOG
* Remove unused imports
* Use Example type
* Change rule kind to .idiomatic
* Update CHANGELOG
* Bump deployment target to macOS 10.12
* Simplify SyntaxRule.validate(file:visitor)
* Make TSan happy
* Use script/bootstrap in the README
2020-02-08 02:43:40 -08:00
Marcelo Fabri
0991ede1ed
Fix tests on Linux ( #3084 )
2020-02-08 02:05:35 -08:00
John Buckley
efe8816315
ImplicitReturnConfiguration description now reports current config ( #3083 )
...
* ImplicitReturnConfiguration description now reports current config.
Previously only the default config was reported.
* Updating CHANGELOG.md
2020-02-08 01:55:58 -08:00
Marcelo Fabri
1ea070dbd5
Remove base path from reported message in oss-check ( #3070 )
2020-02-03 01:25:30 -08:00
Marcelo Fabri
ecbbd0dc28
Update CHANGELOG.md
2020-02-02 16:58:41 -08:00
Marcelo Fabri
cd7d558dd2
Update CHANGELOG.md
2020-02-02 16:56:54 -08:00
Marcelo Fabri
5d3403a615
Fix master ( #3069 )
2020-02-02 16:50:07 -08:00
John Mueller
be44017675
Fix false positives when line ends with carriage return + line feed ( #3061 )
...
Fixes : #3060
2020-02-02 15:37:49 -08:00
Paul Taykalo
057bcb8921
Fixes #3066 Crash on missing ( #3067 )
2020-02-02 23:30:40 +02:00
Zev Eisenberg
fcf848608e
Add Inline test failure messages ( #3040 )
...
* Add Example wrapper in order to display test failures inline when running in Xcode.
* Stop using Swift 5.1-only features so we can compile on Xcode 10.2.
* Wrap strings in Example.
* Add Changelog entry.
* Wrap all examples in Example struct.
* Better and more complete capturing of line numbers.
* Fix broken test.
* Better test traceability.
* Address or disable linting warnings.
* Add documentation comments.
* Disable linter for a few cases.
* Limit mutability and add copy-and-mutate utility functions.
* Limit scope of mutability.
2020-02-02 10:35:37 +02:00
JP Simard
ed54fd6130
Fix changelog entry location
2020-01-30 16:46:33 -08:00
Paul Taykalo
25f07af7bc
Merge pull request #3031 from PetteriHuusko/dev
...
Fix discarded_notification_center_observer false positive on arrays
2020-01-30 09:19:26 +02:00
Petteri Huusko
3bd269fdd2
Fix discarded_notification_center_observer false positive when capturing observers into an array
2020-01-29 08:32:40 +02:00
Paul Taykalo
8ac124a494
A bit faster Explicit Self rule ( #3048 )
2020-01-17 13:57:54 -08:00
Steven
325af44c36
Add deinitializer to type_contents_order ( #3042 )
...
Add `deinitializer` type content to `type_contents_order` rule instead of grouping it with initializers. This allows the common use case of putting the deinitializer at the end of the class.
2020-01-16 16:49:37 -08:00
JP Simard
0b1140d874
Fix typo in examples for `isEmpty`
2020-01-16 16:29:11 -08:00
JP Simard
fe5baca7cd
Migrate to use SourceKitten's new ByteCount/ByteRange types ( #3037 )
...
New APIs were introduced in SourceKitten to allow for a more typesafe distinction between integers meaning NSString-based distances and byte-based distances.
* https://github.com/jpsim/SourceKitten/pull/639
* https://github.com/jpsim/SourceKitten/pull/642
This PR migrates SwiftLint's use of those APIs.
2020-01-16 15:18:37 -08:00
iliaskarim
4a56bf56c5
Update RedundantVoidReturnRule.swift ( #3039 )
...
Single argument function types require parentheses
2020-01-14 12:58:32 -08:00
JP Simard
399f5b7df6
Fix docstring formatting issues using DrString ( #3032 )
...
Using command:
$ drstring check -i 'Source/**/*.swift' --first-letter lowercase --vertical-align
2020-01-12 11:19:33 -08:00
JP Simard
5b5314ee70
Fix documentation in Version.swift
2020-01-08 12:14:42 -08:00
JP Simard
2de2b7cd4f
Add empty changelog section
2020-01-08 10:46:10 -08:00
JP Simard
76d44cff39
release 0.38.2
2020-01-08 10:35:08 -08:00
JP Simard
37167a8a35
Add documentation comments to all public declarations ( #3027 )
2020-01-08 09:47:10 -08:00
JP Simard
df6cf175d8
Remove outdated Documentation section of CONTRIBUTING.md
2020-01-07 20:36:30 -08:00
JP Simard
d2643db495
[Docs] Build docs using jazzy ( #3016 )
...
* Add `.jazzy.yaml` configuration file
* Update `swiftlint generate-docs` to write docs to a directory rather than a single file
* Add jazzy to the Gemfile
* Run `bundle update`
* Add CI job to run jazzy automatically and publish to GitHub Pages

2020-01-07 20:31:29 -08:00
JP Simard
4388c9f899
Fix regressions in UnusedImportRule ( #3025 )
2020-01-07 12:43:47 -08:00
JP Simard
760383508e
Improve tuple handling in optional_enum_case_matching rule ( #3024 )
...
Catch previously missed violations in the `optional_enum_case_matching` rule when case expressions involved tuples. For example:
```swift
switch foo {
case (.bar↓?, .baz↓?): break
case (.bar↓?, _): break
case (_, .bar↓?): break
default: break
}
```
2020-01-07 09:36:08 -08:00
JP Simard
cd841dff84
Remove duplicate file entry in SwiftLint.xcodeproj
2020-01-06 10:40:45 -08:00
Frederick Pietschmann
601ea392c2
Merge pull request #2765 from fredpi/feature/indentation_width
...
Add new indentation_width rule
2020-01-06 10:47:09 +01:00
Frederick Pietschmann
3d0b568e2c
Fix bug with no-syntax-kind lines (e. g. "[")
2020-01-06 10:24:13 +01:00
Frederick Pietschmann
c806942a4b
Fix changelog
2020-01-06 08:42:13 +01:00
Marcelo Fabri
4fd593ff39
Add more tests for OrphanedDocCommentRule ( #3017 )
2020-01-05 23:34:03 -08:00
Frederick Pietschmann
d283904b0a
Fix rebase issues
2020-01-06 08:30:49 +01:00
Frederick Pietschmann
95947b4c92
Fix changelog
2020-01-06 08:30:49 +01:00
Frederick Pietschmann
385b6c6548
Drop unused import statement
2020-01-06 08:30:49 +01:00
Frederick Pietschmann
98e870e726
Fix modifier order
2020-01-06 08:30:49 +01:00
Frederick Pietschmann
08a986dce4
Fix changelog
2020-01-06 08:30:49 +01:00
Frederick Pietschmann
5c08e330d2
Update LinuxMain.swift
2020-01-06 08:30:49 +01:00
Frederick Pietschmann
eb92e0b3a1
Fix wrong spacesEquivalent implementation; simplify validate method
2020-01-06 08:30:49 +01:00
Frederick Pietschmann
bc6396d516
Keep linting even when seeing mixed indentation
2020-01-06 08:30:49 +01:00
Frederick Pietschmann
74adc8726a
Fix changelog format
2020-01-06 08:30:49 +01:00
Frederick Pietschmann
0d9ad4848e
Fix changelog format
2020-01-06 08:30:49 +01:00
Frederick Pietschmann
0bed014cba
Add extensive tests for indentation_rule; fix duplicate warning avoidance mechanism
2020-01-06 08:30:49 +01:00
Frederick Pietschmann
35cd789ba1
Restructure indentation_width tests
2020-01-06 08:30:49 +01:00
Frederick Pietschmann
1fbb39dd50
Introduce mechanism to avoid duplicate indentation_width warnings for one single issue
2020-01-06 08:30:49 +01:00
Frederick Pietschmann
3a8ad943c3
Add configuration option whether to consider comment lines for indentation_width rule
2020-01-06 08:30:49 +01:00
Frederick Pietschmann
8c245c7581
Add new indentation_width rule
2020-01-06 08:30:49 +01:00
Marcelo Fabri
c2bdb589df
Add orphaned_doc_comment rule ( #3014 )
...
* Add orphaned_doc_comment rule
Fixes #2989
* Don’t trigger on lines with only “/“
2020-01-05 20:45:06 -08:00
Pyry Jahkola
805b9ab3ba
Add capture_group option to custom_rules
...
This option allows for more fine-grained placement of the location
marker for code violating a custom rule, e.g.:
```swift
print("Hello world.")
^~~~~
```
for this `.swiftlint.yml`:
```yaml
custom_rules:
world_preceded_by_hello:
name: "World Preceded by Hello"
included: ".+\\.swift"
message: "The word World predeced by the word hello should be capitalised."
severity: warning
regex: "(?i:hello)\\s+(world)"
match_kinds: [string]
capture_group: 1
```
2020-01-05 15:24:11 -08:00
Optional Endeavors
8fb900650b
Add support for showing only correctable rules, and a switch for ignoring the width of the terminal so full configuration detail is always shown.
2020-01-05 15:19:45 -08:00
Sven Münnich
72e2063531
Include functions and getters in rule `implicit_return`
2020-01-05 15:04:35 -08:00
JP Simard
28460c50c6
Add empty changelog section
2020-01-03 19:57:44 -08:00
JP Simard
cb325512fb
Run `make sourcery`
2020-01-03 19:56:18 -08:00
JP Simard
6f6c9fed8c
release 0.38.1
2020-01-03 19:44:27 -08:00
JP Simard
40ade98710
Update SourceKitten to 0.28.0 ( #3011 )
2020-01-03 16:47:18 -08:00
timcmiller
4112816077
Added 'file_name_no_space' rule ( #3008 )
...
* Added 'file_name_no_space' rule
* Removed unused var, and added to changelog
* Remove custom suffix from 'file-name-no-space' rule
* Fixed LinuxMain
* Switched to use a CharacterSet over Regex
2020-01-03 15:45:30 -08:00
timcmiller
29bff89a29
File name console description ( #3010 )
...
* Added parameters to FileNameConfiguration.consoleDescription
* Added bugfix to CHANGELOG
* Fix indentation
Co-authored-by: JP Simard <jp@jpsim.com>
2020-01-03 14:00:17 -08:00
Marcelo Fabri
093370c2b3
Add opt-in `prefer_self_type_over_type_of_self` rule ( #3006 )
...
Fixes #3003
2020-01-03 12:33:04 -08:00
JP Simard
20ba18c820
Indent
2020-01-03 10:17:01 -08:00
Max Härtwig
292d89f18b
Make weak_delegate rule correctable ( #2959 )
2020-01-03 10:16:30 -08:00
Sven Münnich
fb5361e37b
Fix parsing of rule disable comments containing a URL ( #2985 )
2020-01-03 09:36:16 -08:00
Marcelo Fabri
2c3411dc88
Add optional_enum_case_matching rule ( #3002 )
2020-01-03 00:50:47 -08:00
Marcelo Fabri
fbbd3fc08e
Add AutomaticTestableRule conformance to EnumCaseAssociatedValuesLengthRule ( #3005 )
2020-01-03 00:34:29 -08:00
Marcelo Fabri
352d178dc3
Merge pull request #2998 from lakpa/feature/enum-case-associatedValue-length-rule
...
Add `enum_case_associated_values_count` opt-in rule
2020-01-02 23:52:52 -08:00
Marcelo Fabri
1cbc5dafe5
Fix CHANGELOG entry
2020-01-02 23:24:38 -08:00
ldindu
2ccb33b111
Add `enum_case_associated_values_count` opt-in rule
2020-01-02 23:24:06 -08:00
Max Härtwig
44b04f377d
Allow SubstitutionCorrectableRule to return nil instead of a correction to indicate that a suitable correction couldn't be found for a specific case ( #2958 )
2020-01-02 23:15:40 -08:00
JP Simard
99dd894c80
Fix false positives in unused_declaration for protocol extensions ( #3000 )
2019-12-30 09:44:25 -08:00
JP Simard
9ecefbd969
[UnusedImportRule] Handle comments after the import statement ( #2993 )
...
* [UnusedImportRule] Handle comments after the import statement
* fixup! [UnusedImportRule] Handle comments after the import statement
* Use \s+ to capture whitespace in regex
Co-Authored-By: Dave Lee <davelee.com@gmail.com>
* Fix testDetectSwiftVersion() with Swift 5.1.3
* fixup! Fix testDetectSwiftVersion() with Swift 5.1.3
* Handle @_exported imports
* Work around SR-11099
* Unescape newline
2019-12-18 11:30:41 -08:00
JP Simard
5bcbe36f4b
Add empty changelog section
2019-12-03 11:01:13 -08:00
JP Simard
8dc3e81193
release 0.38.0
2019-12-03 10:50:21 -08:00
JP Simard
daf111ebca
Fix changelog
2019-12-03 10:38:47 -08:00
a-25
e11fcd9820
Fixed false positive in opening_brace rule on anonymous closure ( #2927 )
...
* Fixed false positive in opening_brace rule on anonymous closure
* added one more triggering rule, fixed docs
* fixed anonymous closure match
* fixed anonymous closure match, more accurate
2019-12-03 10:37:47 -08:00
Dave Lee
36e8d9f581
Add support for compilation databases ( #2962 )
...
* Add --compile-commands flag
* Implement support for --compile-commands
* Turns out you can't use yaml to read compile_commands.json
* refactor all the things
* Add changelog entry
* formatting
* Add comment and typealiases
* typo
* fix bool logic
* support directory field in compile commands
* remove "directory" field support
* filter compilation database args too
* Remove initial `swiftc` from args
* grammar
2019-12-03 10:36:18 -08:00
Dave Lee
8f2334babd
Update bug report template: `xcodebuild -version` ( #2979 )
2019-11-27 14:21:31 -08:00
Dan Loman
cc57ed3d69
Add ExpiringTodoRule ( #2911 )
...
* Add expiring todos rule
* Fix default dateFormat
* Fix date regex to handle 2-4 at beginning/end of string
* Clean up/improve clarity
* Add tests for ExpiringTodoRule
* Add output from make sourcery
* Add output from make sourcery
* Update documentation
* Enable updating of all configuration properties
* Add back Foundation import
* Add changelog entry
* Add 2 spaces after changelog entry
* Add return for legacy swift compatibility
* Add unwrapping to switch statement
* Use disable:next
* Add default values to severity config init; Add public delimiter init
* Add tests for various custom configurations
* Remove unused funcs
* Add extra tests to LinuxMain file
* Update File type -> SwiftLintFile
* Move Changelog entry
* Shorten changelog entry line length
* Fix changelog
2019-11-20 16:50:29 -08:00
JP Simard
7627253f3c
Fix changelog
2019-11-19 10:07:32 -08:00
JP Simard
5f66704a1a
Improve compilation time ( #2965 )
...
* Improve compilation time
Before this change, `trailingClosure` took 8.6s to type check.
After this change, it takes 31ms.
* Speed up type checking `isDecimal(number:)`
Before: 377ms
After: 2ms
* Speed up type checking testViolationMessageForExpressibleByIntegerLiteral()
Before: 285ms
After: 175ms
* Fix OSSCheck
More than just rules are in `Source/SwiftLintFramework/Rules/`
* Shim XCTUnwrap for Swift 5.0
2019-11-15 11:36:25 -08:00
Paul Taykalo
66a4193aa3
Merge pull request #2956 from realm/improvement/let-var-whitespace-rule
...
Speedup LetVarWhitespaceRule
2019-11-12 21:09:57 +02:00
Paul Taykalo
e00a8bf11a
That day when regex can be faster than code
2019-11-12 20:36:47 +02:00
Paul Taykalo
3f0db8ff13
Merge pull request #2955 from realm/improvement/own-wrappers-over-syntax-tokens
...
Add own wrappers for SyntaxTokens and Syntax Map
2019-11-12 20:33:12 +02:00
Paul Taykalo
13c93ae74f
Merge pull request #2932 from MaxHaertwig/control-statement-correctable
...
Make control_statement rule substitution correctable
2019-11-12 20:31:41 +02:00
Max Härtwig
8c7b21dcb2
Fix trailing_comma rule violation
2019-11-12 10:47:13 +01:00
Paul Taykalo
d181cb0fd2
Speedup let var whitespace rule a bit
2019-11-12 03:03:22 +02:00
Paul Taykalo
3cb318e42f
Update Source/SwiftLintFramework/Extensions/Dictionary+SwiftLint.swift
...
Co-Authored-By: JP Simard <jp@jpsim.com>
2019-11-12 01:27:02 +02:00
Paul Taykalo
1112cb9c11
Update Changelog
2019-11-11 23:06:25 +02:00
Max Härtwig
76d6f6745a
Import Foundation to fix error
2019-11-11 15:01:36 +01:00
Max Härtwig
dcc8d6e34c
Make control_statement rule substitution correctable
2019-11-11 15:01:36 +01:00
Paul Taykalo
61a6a278a5
add byterange to the dictionary and breadthfirst algorithm
2019-11-10 23:53:59 +02:00
Paul Taykalo
73802c285d
Add own wrappers over syntax tokens and syntax map
2019-11-10 22:55:54 +02:00
Paul Taykalo
7fa995189e
Merge pull request #2953 from realm/fix/false-postive-identical-operands
...
Fix for false-positive identical operands rule
2019-11-10 22:43:10 +02:00
Paul Taykalo
3a36b6998b
Fix false-positive identical operands rule
2019-11-10 21:54:34 +02:00
JP Simard
944bea41c6
Add empty changelog section
2019-11-09 14:49:30 -08:00
JP Simard
36775cce86
release 0.37.0
2019-11-09 14:31:56 -08:00
JP Simard
4aad7e14b4
Space between ':' and 'inout'
2019-11-09 14:19:01 -08:00
JP Simard
de28c9bd43
Reword and reorder changelog entry
2019-11-09 14:18:29 -08:00
JP Simard
067b1e075f
Docstring edits
2019-11-09 13:39:05 -08:00
Paul Taykalo
f569e3d973
Rename Traverse to Traverse with Parent
2019-11-09 13:29:43 -08:00
Paul Taykalo
c85d3099a1
Update documentation
2019-11-09 13:29:43 -08:00
Paul Taykalo
a52a94c987
Use Generic Dictionary Traversing for multiple cases
2019-11-09 13:29:43 -08:00
Paul Taykalo
523b2618c1
Update SubstitutionCorrectableASTRule for using inout array when traversing dictionaries
2019-11-09 13:29:42 -08:00
Paul Taykalo
da04c669fb
Update Changelog
2019-11-09 13:29:42 -08:00
Paul Taykalo
dfe61fab8d
Faster dictionaries traversing for AST rules
2019-11-09 13:29:42 -08:00
JP Simard
77e03656a6
[OSSCheck] Only run on changed rules if only rules have changed ( #2950 )
2019-11-08 14:34:19 -08:00
Paul Taykalo
e6af334576
Merge pull request #2949 from realm/speedup/file-type-order-rule
...
Use a bit faster comparison in 'file_types_order' rule
2019-11-08 18:36:54 +02:00
Paul Taykalo
7927187644
Update CHANGELOG.md
2019-11-08 09:44:09 +02:00
Paul Taykalo
848370a522
Simpler check for FileTypesOrderRule
2019-11-08 01:35:01 +02:00
Sven Münnich
63b5b92e59
Update documentation regarding `exclude` definition in nested `.swiftlint.yml` ( #2731 )
2019-11-07 14:22:36 -08:00
JP Simard
5d17ae3edc
Minor edits to changelog
2019-11-07 11:08:56 -08:00
JP Simard
beaa2a8a87
Update Commandant and SourceKitten, drop Result ( #2947 )
2019-11-07 10:59:16 -08:00
Paul Taykalo
45131909bf
Merge pull request #2929 from realm/speedup/test-use-cache-as-int
...
[Speedup] [Proof Of Concept] Use unique file Id for each SiwftLintFile for caching
2019-11-07 17:18:04 +02:00
Paul Taykalo
a8d90ebc5e
Update changelog
2019-11-07 16:49:35 +02:00
Paul Taykalo
d771d223e3
Remove unused imports
2019-11-07 16:20:18 +02:00
Paul Taykalo
30a1c5b65e
Update changelog
2019-11-07 15:19:18 +02:00
Paul Taykalo
ac40778cb3
Use SwiftLintFile wrapper over the File
2019-11-07 15:19:17 +02:00
Paul Taykalo
0db1f9c3f1
Merge pull request #2924 from realm/speedup/use-swift-declaration-kinds-enums-instead-of-rawValues
...
Use swift enums instead of raw values
2019-11-07 12:52:19 +02:00
Paul Taykalo
2a308c1698
Fix DiscardedNotificationCenterObserverRule
2019-11-07 12:07:56 +02:00
Paul Taykalo
ed9f2adc34
Update Changelog
2019-11-07 11:54:46 +02:00
Paul Taykalo
ec6d82af56
Cache Access Control Level property
2019-11-07 11:52:50 +02:00
Paul Taykalo
b1cdc119ec
Use swift enums instead of raw values
2019-11-07 11:05:19 +02:00
Paul Taykalo
f845af66f8
Merge pull request #2922 from realm/speedup/cache-structure-dictionaries
...
Cache Structure Dictionaries
2019-11-07 10:56:02 +02:00
Paul Taykalo
4fff698c09
Update UnusedDeclarationRule to use SourceKittenDictionary
2019-11-07 10:28:30 +02:00
Paul Taykalo
18a3896f97
Update swift structure dictionary
2019-11-07 08:51:16 +02:00
Paul Taykalo
f0ad230e81
fix linting issues
2019-11-07 08:50:50 +02:00
Paul Taykalo
b901c670d4
Cache file structure dictionary
2019-11-07 08:50:50 +02:00
Paul Taykalo
8c963d2c15
Working solution with SouceKittenDictionary wrapper
2019-11-07 08:50:50 +02:00
Paul Taykalo
6175c004da
Faster tokens resolving in syntaxmap ( #2916 )
...
When the request is asked which tokens are have in an intersection, the previous solution was searching for first Index (linearly) and then filtered everything that was coming after that index using `intersect function`
The updated solution will search for the first token index using`binary search`
# Speedup
While this is only one function was updated, the next options were considered:
- [**lin+filter**] old solution
- [**lin+prefix**] old solution with `prefix:wihle` instead of filtering
- [**bin+filter**] binary search with filter
- [**bin+prefix**] binary search with `prefix:wihle` instead of filtering
The speedup highly depends on the file sizes. The bigger/longer files the bigger win is
# Benchmark
## Kickstarter
|lin+filter|lin+prefix|bin+filter|bin+prefix|speedup|
|-|-|-|-|-|
|0.494|0.243|0.390|\***0.117\***| ~4x |
## Swift
|lin+filter|lin+prefix|bin+filter|bin+prefix|speedup|
|-|-|-|-|-|
|1.739|0.740|1.273|\***0.103**\*| ~16x |
## WordPress
|lin+filter|lin+prefix|bin+filter|bin+prefix|speedup|
|-|-|-|-|-|
|1.270|0.526|0.918|0.148| ~8x |
# Testing code
This code was tested with these parts of code (in Release build)
```
fileprivate var counter = 0
fileprivate var times: [String: Double] = [:]
fileprivate let timesQueue = DispatchQueue.init(label: "benchmarks")
fileprivate func timeLog<T>(_ name: String, block: () -> T) -> T {
let start = DispatchTime.now()
let result = block()
let end = DispatchTime.now()
timesQueue.async {
let oldValue = times[name, default:0.0]
let diff = TimeInterval(end.uptimeNanoseconds - start.uptimeNanoseconds) / 1_000_000_000
let newValue = oldValue + diff
times[name] = newValue
counter += 1
if counter % 1000 * times.count == 0 {
print("!!!!: \(times)")
}
}
return result
}
internal func tokens(inByteRange byteRange: NSRange) -> [SyntaxToken] {
let new = timeLog("new") { tokensFast(inByteRange: byteRange) }
let new2 = timeLog("old") { tokensOld(inByteRange: byteRange) }
return arc4random() % 2 == 1 ? new : new2
}
```
2019-11-06 15:21:38 -08:00
JP Simard
da114c341c
Update Danger to 6.1.0 and fix issues with running on MacStadium ( #2945 )
...
And validate that running on PRs from forked repos works.
2019-11-06 14:51:57 -08:00
JP Simard
24208ddbd5
Run Danger and OSSCheck on MacStadium instead of on Azure Pipelines ( #2941 )
...
This will allow us to run OSSCheck on a bare metal Mac, which should
make the OSSCheck performance results more reliable than running on
virtual machines from Azure Pipelines.
2019-11-05 14:55:22 -08:00
Norio Nomura
f5b4196a5e
Merge pull request #2938 from realm/nn/github-actions-logging
...
Add GitHub Actions Logging reporter (`github-actions-logging`)
2019-11-05 09:33:21 +09:00
Norio Nomura
80d3813214
Add GitHub Actions Logging reporter (`github-actions-logging`)
...
Use [GitHub Actions Logging](https://help.github.com/en/github/automating-your-workflow-with-github-actions/development-tools-for-github-actions#logging-commands ) same as https://github.com/norio-nomura/action-swiftlint does.
2019-11-04 19:36:25 +09:00
Marcelo Fabri
77bac34828
Merge pull request #2936 from Blackjacx/patch-1
...
Add allowed_symbols to type_name example
2019-10-31 11:22:33 -07:00
Stefan Herold
082413190d
Add allowed_symbols to type_name example
2019-10-31 18:07:00 +01:00
Paul Taykalo
5892478069
Merge pull request #2918 from PaulTaykalo/feature/identical-operands-rule-using-syntaxmap
...
Identical operands rule using syntaxmap
2019-10-26 03:23:51 +03:00
Paul Taykalo
1db3eb7890
Change zip.allSatisfy to map ==
2019-10-25 19:53:45 +03:00
Paul Taykalo
b996e0c890
Allow force casts when chainng operators
2019-10-25 19:40:37 +03:00
Paul Taykalo
94c3f9a14b
Update rules and fix syntax violations
2019-10-25 19:20:34 +03:00
Paul Taykalo
1833a44031
Include optional chaining operator when joiing operands
2019-10-25 16:03:03 +03:00
Paul Taykalo
a361848866
Identical operands rule using syntaxmap
2019-10-25 04:04:38 +03:00
JP Simard
efcb17f5e7
Add empty changelog section
2019-10-24 15:45:31 -07:00
JP Simard
652e5dd59c
release 0.36.0
2019-10-24 15:25:32 -07:00
JP Simard
274c2a14ff
Reflect that Swift 5.x is supported in the README
2019-10-24 15:18:40 -07:00
Marcelo Fabri
642d9dfb25
Merge pull request #2913 from realm/mf-fast-redundant-void
...
Optimize `redundant_void_return`
2019-10-23 13:15:13 -07:00
Marcelo Fabri
355a219b8a
PR feedback
2019-10-23 12:31:07 -07:00
Marcelo Fabri
cff53944c4
Optimize `redundant_void_return`
2019-10-20 20:40:11 -07:00
Marcelo Fabri
a9ae253bd4
Merge pull request #2889 from 00FA9A/mp/2888
...
Add `raw_value_for_camel_cased_codable_enum` (#2888 )
2019-10-20 20:37:20 -07:00
Marcelo Fabri
029f1a9916
Merge pull request #2892 from vani2/syntactic-sugar-autocorrect
...
Add autocorrection to the syntactic sugar rule
2019-10-20 20:36:41 -07:00
Marcelo Fabri
3b5458a248
Use String.isLowercase()
2019-10-20 19:19:54 -07:00
Marcelo Fabri
1206fd4dd4
Fixes after rebase
2019-10-20 19:19:54 -07:00
MarkoPejovic
df2d2abb50
Remove ↓ from examples
2019-10-20 19:19:54 -07:00
MarkoPejovic
6bfd2567ce
Update name
2019-10-20 19:19:54 -07:00
MarkoPejovic
109899c56c
Implement #2888
2019-10-20 19:19:54 -07:00
Ivan Vavilov
c27597e5bd
Update Rules docs
2019-10-20 19:08:54 -07:00
Ivan Vavilov
ab558806c6
Add new line before credit
2019-10-20 19:08:54 -07:00
Ivan Vavilov
dc22d1c2df
Add entry to CHANGELOG
2019-10-20 19:08:54 -07:00
Ivan Vavilov
8af5825ca1
Add some test cases
2019-10-20 19:08:54 -07:00
Ivan Vavilov
ffa955dc7d
Add autocorrection to the syntactic sugar rule
2019-10-20 19:08:54 -07:00
Paul Taykalo
d891b1ec60
Use binary search when searching for lines indexes in LetVarWhiteSpacesRule ( #2901 )
...
* Use binary search when searching for lines indexes
* Update Changelog
* Remove unused old method of searching line by offset
* Update line by offset call with already implemented function
2019-10-20 11:30:32 -07:00
JP Simard
3706f31fd5
Fix running analyze on Xcode 11 build outputs ( #2912 )
...
Xcode 11 started using _response files_ [0] to avoid exceeding command
line length limits. For SwiftLint's analyzer rules to find which
compiler arguments are needed for a given file being analyzed, we first
need to expand these response files to their contents.
This was ported over from https://github.com/jpsim/SourceKitten/pull/613
[0]: https://github.com/apple/swift/pull/16362
2019-10-19 22:19:44 -07:00
Marcelo Fabri
3903127352
Merge pull request #2902 from realm/mf-xcode11.1
...
Run CI on Xcode 11.1
2019-10-15 09:52:10 -07:00
Marcelo Fabri
f7e0cc94e2
Lock CryptoSwift to 1.0.0
2019-10-14 00:16:56 -07:00
Marcelo Fabri
31ca623eb0
Fix unit test
2019-10-13 23:43:07 -07:00
Marcelo Fabri
711ebc4d1b
Run CI on Xcode 11.1
2019-10-13 23:25:17 -07:00
Marcelo Fabri
495407b452
Merge pull request #2896 from realm/mf-swift-5.1-linux
...
Run CI on Swift 5.1 + Linux
2019-10-09 08:51:47 -07:00
Marcelo Fabri
e10a0129bc
Set Swift version on Package.swift
2019-10-08 23:56:00 -07:00
Marcelo Fabri
b695c696f9
Update make docker_test
2019-10-08 23:55:48 -07:00
Marcelo Fabri
4c42d49199
Run CI on Swift 5.1 + Linux
2019-10-08 09:48:07 -07:00
Marcelo Fabri
2dcaf3ee78
Merge pull request #2894 from realm/mf-update-sourcekitten
...
Update SourceKitten to 0.26.0
2019-10-08 09:36:57 -07:00
Marcelo Fabri
956ea6f949
Delete build artifacts before starting a new build
2019-10-08 08:57:15 -07:00
Marcelo Fabri
df28cbb879
Merge pull request #2893 from MaxHaertwig/toggle-bool-correctable
...
Make `toggle_bool` rule substitution correctable
2019-10-08 00:56:22 -07:00
Marcelo Fabri
f5174b3168
Update SourceKitten to 0.26.0
2019-10-08 00:51:18 -07:00
Max Härtwig
1a5aa05c34
Add missing Foundation import
2019-10-07 09:42:19 +02:00
Max Härtwig
b9368cbca6
Fix reference to
2019-10-07 09:27:31 +02:00
Max Härtwig
a157957df4
Make `toggle_bool` rule substitution correctable
2019-10-07 01:16:15 +02:00
Marcelo Fabri
f211694e7d
Merge pull request #2885 from realm/mf-flatmap
...
Add `flatmap_over_map_reduce` opt-in rule
2019-09-26 11:02:58 -07:00
Marcelo Fabri
539629a8da
Merge pull request #2884 from realm/mf-xcode11
...
Run CI on Xcode 11
2019-09-26 11:02:42 -07:00
Marcelo Fabri
f04d9fa640
Run more jobs on Xcode 11
2019-09-26 10:15:42 -07:00
Marcelo Fabri
b9b0beb0c9
Fix localization warning
2019-09-26 10:15:26 -07:00
Marcelo Fabri
2457843c7c
Generate docs with Xcode 11
2019-09-26 10:11:38 -07:00
Marcelo Fabri
d4ef1f0ad0
Add `flatmap_over_map_reduce` opt-in rule
...
Fixes #2883
2019-09-26 10:07:12 -07:00
Marcelo Fabri
5b4ae6c931
Run CI on Xcode 11
2019-09-26 09:56:04 -07:00
Nathan Van Fleet
406a8f20f8
Add Mark rule for triple slash Mark comments ( #2868 )
...
* Add Mark rule for triple slash Mark comments
* Move changelog entry to appropriate section
* Re-add Package.resolved
* Fix trailing comma
* Rebuild Rules.md using Xcode 10.3
* Combine two regexes into one
2019-09-18 17:21:13 -07:00
Marcelo Fabri
d5f37ca23a
Merge pull request #2862 from cltnschlosser/cs_fixChangelog
...
Move CHANGELOG entries to the correct section
2019-09-04 11:45:22 -07:00
Colton Schlosser
05591c49fa
Move CHANGELOG entries to the correct section
2019-09-04 14:38:56 -04:00
Colton Schlosser
2c076151f4
Add `contains_over_range_not_nil` rule, make `contains_over_first_not_nil` also match == nil ( #2811 )
2019-09-03 12:03:00 -04:00
JP Simard
ffb2f4f76d
Require Swift 5.0 to build ( #2857 )
...
* Require Swift 5.0 to build
* Update CI
* Stop testing with Swift 4.x & Xcode 10.0/10.1
* Use official Swift docker image instead of norionomura's
* Use Xcode 10.3 as latest stable version
* Update READMEs
* Fixup xcodeproj
* Fixup CI Swift container image tag
* Fixup changelog
2019-09-03 11:42:57 -04:00
JP Simard
b32b3de34f
Add empty changelog section
2019-09-03 10:46:43 -04:00
JP Simard
8dc8421a49
release 0.35.0
2019-09-03 10:07:31 -04:00
JP Simard
f239ce8264
Add note about being the last release to support building with Swift 4.2
2019-09-03 10:04:03 -04:00
Marcelo Fabri
40bc8de5c7
Add no_space_in_method_call rule ( #2855 )
...
* Add no_space_in_method_call rule
* Avoid false positive with typecasting
2019-09-03 10:03:21 -04:00
Marcelo Fabri
899b38a1b6
Merge pull request #2852 from realm/mf-bugfix-2851
...
Don't trigger `missing_docs` on extensions
2019-08-30 15:12:58 -07:00
Marcelo Fabri
dae7a7b193
Don't trigger `missing_docs` on extensions
...
Fixes #2851
2019-08-30 14:29:32 -07:00
Marcelo Fabri
d5461510ea
CHANGELOG formatting
2019-08-29 11:54:46 -07:00
Marcelo Fabri
399998b265
Merge pull request #2810 from cltnschlosser/cs_emptyArray
...
Add `empty_collection_literal` rule
2019-08-29 11:54:04 -07:00
Colton Schlosser
130371b8cc
Add `empty_collection_literal` rule
2019-08-28 21:57:02 -04:00
JP Simard
0d18758241
Use reduce(into:) for unused imports rule ( #2850 )
2019-08-28 16:20:47 -07:00
Marcelo Fabri
3879151abf
Enable some opt-in rules ( #2801 )
2019-08-28 14:49:23 -07:00
Marcelo Fabri
a89738ef5b
Merge pull request #2847 from realm/mf-enable-contains_over_filter_is_empty
...
Enable `contains_over_filter_is_empty` in SwiftLint itself
2019-08-25 23:48:50 -07:00
Marcelo Fabri
b24fd6cdd4
Enable `contains_over_filter_is_empty` in SwiftLint itself
2019-08-25 20:58:11 -07:00
Marcelo Fabri
3e115835b1
Merge pull request #2846 from realm/mf-contains_over_filter_is_empty
...
Add `contains_over_filter_is_empty` opt-in rule
2019-08-25 20:55:11 -07:00
Marcelo Fabri
a1f0967e7a
Merge pull request #2845 from realm/mf-avoid-false-positive
...
Avoid false positives in contains_over_filter_count
2019-08-25 20:45:54 -07:00
Marcelo Fabri
67526344ef
Add `contains_over_filter_is_empty` opt-in rule
2019-08-25 20:22:41 -07:00
Marcelo Fabri
759ccd8a1e
Avoid false positives in contains_over_filter_count
2019-08-25 20:11:23 -07:00
Marcelo Fabri
07e2130863
Merge pull request #2841 from realm/mf-contains_over_filter_count
...
Add contains_over_filter_count opt-in rule
2019-08-25 20:01:11 -07:00
Marcelo Fabri
00d2b5d772
Add contains_over_filter_count opt-in rule
...
Fixes #2803
2019-08-25 20:00:50 -07:00
Marcelo Fabri
50c59a236e
Fix another formatting issue
2019-08-25 19:33:00 -07:00
Marcelo Fabri
2788f5e09e
Fix formatting
2019-08-25 19:32:33 -07:00
Marcelo Fabri
7c6d5d0994
Merge pull request #2815 from atfelix/issue-2791-swiftui-previews
...
Removes `type_name` violation for SwiftUI template code
2019-08-25 19:32:05 -07:00
Adam Felix
6f67cfa5aa
Issue-2791: `type_name` violation for with SwiftUI template code
...
* Ignore SwiftUI Previews underscore character
2019-08-25 20:01:28 -04:00
Marcelo Fabri
e96e75b49f
Merge pull request #2844 from realm/mf-bugfix-2690
...
Don't trigger `missing_docs` on `deinit`
2019-08-25 04:07:17 -07:00
Marcelo Fabri
150db104c7
Don't trigger `missing_docs` on `deinit`
...
Fixes #2690
2019-08-25 03:28:44 -07:00
Marcelo Fabri
c4741fadce
Merge pull request #2843 from realm/mf-bugfix-2842
...
Avoid triggering redundant_type_annotation with @IBInspectable
2019-08-25 03:27:58 -07:00
Marcelo Fabri
f6b73431a1
Avoid triggering redundant_type_annotation with @IBInspectable
...
Fixes #2842
2019-08-25 02:22:33 -07:00
Timofey Solonin
7800220ff7
#2737 - Fix unused_imports false positive when only operators from the module are used ( #2840 )
...
As was discussed #2737 , I utilized the `indexsource` request to look up the operators and fetch the cursorInfo per operator. In the implementation I refrained from using `usr` to look up the operator because SourceKit [doesn't support](5add168042/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp (L1799)
) fetching cursorInfo by `usr` when it comes from C (but it can still be fetched by offset).
I also made [an alternative implementation](https://github.com/realm/SwiftLint/compare/master...biboran:fix-unused-imports-for-operators-alternative ) which uses the `indexsource` request instead of the `editor.open`. It seems to work with the unit tests but I am not 100% sure it doesn't introduce a regression since there is no oss-check for analyzer rules.
I also updated [the example](https://github.com/biboran/synthax-bug-example ) to better reflect the original issue in case you want to test the changes manually
2019-08-23 16:19:57 -07:00
a-25
40457a7044
Fixed false positive in `colon` ( #2836 )
2019-08-14 08:42:34 -07:00
Marcelo Fabri
40ddc9f254
Merge pull request #2834 from iliaskarim/patch-1
...
Fix `swiftlint` typo in CHANGELOG.md
2019-08-07 10:56:20 -07:00
iliaskarim
4fdc1c99ab
Fix `swiftlint` typo in CHANGELOG.md
2019-08-07 13:55:06 -04:00
JP Simard
e312b06f71
Fix `swiftlint rules` output table formatting ( #2828 )
...
Fixes https://github.com/realm/SwiftLint/issues/2787
Broken since https://github.com/realm/SwiftLint/pull/2379
2019-07-28 16:12:27 -07:00
Kyle Fleming
83541eeb80
Fix broken link in Makefile ( #2826 )
2019-07-26 20:18:48 -07:00
JP Simard
e2d325c6f5
Update SourceKitten to 0.24 ( #2819 )
...
Released here: https://github.com/jpsim/SourceKitten/releases/tag/0.24.0
2019-07-21 22:48:40 -07:00
JP Simard
fdb067dcac
Add empty changelog section
2019-07-18 18:46:19 -07:00
JP Simard
08946e65e5
release 0.34.0
2019-07-18 18:28:39 -07:00
JP Simard
e63e8cad0f
Add UnusedDeclarationRule ( #2814 )
...
This PR adds a new `unused_declaration` analyzer rule to lint for unused declarations.
By default, detects unused `fileprivate`, `private` and `internal` declarations.
Configure the rule with `include_public_and_open: true` to also detect unused `public` and `open` declarations.
Completely remove the `unused_private_declaration` rule.
This is built on the work enabling collecting rule infrastructure in https://github.com/realm/SwiftLint/pull/2714 .
2019-07-18 18:23:43 -07:00
JP Simard
b7c1db7245
Fix duplicate path printing
2019-07-18 14:59:42 -07:00
JP Simard
b88b005a5e
Add breaking changes to changelog
2019-07-18 14:59:42 -07:00
JP Simard
08816840ef
Re-add outputFilename
2019-07-18 14:59:42 -07:00
JP Simard
daa7f1011d
Move changelog entry
2019-07-18 14:59:42 -07:00
Elliott Williams
3d5239429e
Add AnyCollectingRule and isCollecting
...
All CollectingRules implement AnyCollectingRule, which is used to check
whether a linter will perform any collections and only print the
"Collecting" log message if so.
2019-07-18 14:59:42 -07:00
Elliott Williams
a47b9a90fc
Document Linter / CollectedLinter relation
2019-07-18 14:59:42 -07:00
Elliott Williams
f277fbe5d2
Make RuleStorage have dictionary semantics and check for collected info inside Rule
2019-07-18 14:59:42 -07:00
Elliott Williams
ddee9c8e6b
Refactor spacing, indenting, and rename collect to collectInfo
2019-07-18 14:59:42 -07:00
Elliott Williams
ab655b226c
Remove File+Hashable and bump SourceKitten
2019-07-18 14:59:42 -07:00
Elliott Williams
2b675c1bb3
Use popen2 in oss-check
...
Ruby's documentation mentions that `popen3` requires that you flush
stderr to prevent deadlocking:
> You should be careful to avoid deadlocks. Since pipes are fixed length
> buffers, ::popen3(“prog”) {|i, o, e, t| o.read } deadlocks if the
> program generates too much output on stderr. You should read stdout and
> stderr simultaneously (using threads or IO.select). However, if you
> don't need stderr output, you can use ::popen2.
2019-07-18 14:59:42 -07:00
Elliott Williams
97f8d4803d
Break Configuration.visit into multiple functions and fix index bug
...
The post-collection visitor in `Configuration.visit` was iterating over
the total fileCount given, not just the files that could be collected.
This meant than when a file was skipped, the visitor would end up
referencing a linter past the end of its array, causing a crash.
2019-07-18 14:59:42 -07:00
Elliott Williams
7344732799
PR: Create File+Hashable, symlink Array+SwiftLint, fix nits
2019-07-18 14:59:42 -07:00
Elliott Williams
5446a0af06
Update changelog
2019-07-18 14:59:42 -07:00
Elliott Williams
7f0302f89a
Test that CollectionCorrectableRule is called correctly
2019-07-18 14:59:42 -07:00
Elliott Williams
c338f292c3
Make shim autorelease function generic over its return value
2019-07-18 14:59:42 -07:00
Elliott Williams
1c56d30db6
Add CollectingRuleTests
2019-07-18 14:59:42 -07:00
Elliott Williams
512e06a4e4
Update tests to compile and pass
...
Publicize Array extensions
Address linting violations
2019-07-18 14:59:42 -07:00
Elliott Williams
b1ca533649
Add RuleStorage and a pre-linting stage to run collection
...
In order for rules to collect arbitrary information about all files
being linted, a shared RuleStorage instance is defined in each command
and passed into the linter.
Linting now requires two "passes": once to call collect and populate the
storage (rules that are non-collecting do nothing here), and again to
call validate. The old Linter factory now creates a Prelinter, which can
collect for a file and produce a Linter that orchestrates all the
traditional validation/collection logic.
This design enforces that a file is only validated once it has been
collected; in turn, the file-visiting loop ensures that all files are
collected before the first is validated, so that the storage is fully
populated.
Use storage-backed correct method
Crash if storage for a rule is accessed prematurely
Key FileInfo by File
Rename Prelinter to Linter and Linter to CollectedLinter
Clean up rule protocols such that rule-facing storage methods are actually called
Make RuleStorage a reference type to solve mutating data races
2019-07-18 14:59:42 -07:00
Elliott Williams
01ea736a46
Add CollectingRule to support arbitrary pre-lint collection
2019-07-18 14:59:42 -07:00
JP Simard
18c78684b0
Remove unused declarations ( #2816 )
2019-07-18 13:52:57 -07:00
JP Simard
ac8abbb3a7
Add empty changelog section
2019-07-08 09:30:06 -07:00
JP Simard
ffd0804746
release 0.33.1
2019-07-08 08:54:53 -07:00
Keith Smiley
6ac0894a40
Print relative path for duplicate filenames ( #2768 )
...
In projects with multiple Swift targets, it's possible to have multiple
Swift files with the same name. In this case you can't differentiate
from the log, which one SwiftLint is printing about. Now in this case it
prints the relative (to your pwd) path of the file.
2019-07-08 06:56:04 -07:00
JP Simard
3a0c2b0c05
Migrate LinterCache to use Codable models ( #2799 )
...
* Migrate LinterCache to use Codable models
improving performance and type safety
* Fix Linux
* Avoid creating a Decoder if it won't be used
For example if the file doesn't exist or can't be read.
* Use corelibs plist coder if available
It's available in the Swift 5.1 branch: https://github.com/apple/swift-corelibs-foundation/pull/1849
* Remove unused error case
2019-07-07 00:35:10 -07:00
JP Simard
07021393e4
Update SwiftPM gitignore ( #2798 )
...
Mostly to ignore .swiftpm/ which Xcode 11 automatically generates
2019-07-06 15:29:51 -07:00
Colton Schlosser
18e90be780
Split cache into one file per configuration ( #2796 )
...
* Split cache into one file per configuration
* Only write cache files with changes
* Avoid converting from Data -> String -> Data when saving cache files
* Move empty check to for where
* Split cache changelog entry
* Reword changelog entry to better reflect impact
2019-07-06 11:50:20 -07:00
Marcelo Fabri
b07c8887a7
Merge pull request #2795 from realm/mf-bugfix-2788
...
Fix false positive in `function_default_parameter_at_end`
2019-07-05 00:25:03 -07:00
Marcelo Fabri
94c6009fc4
Fix false positive in `function_default_parameter_at_end`
...
Fixes #2788
2019-07-04 22:25:52 -07:00
Marcelo Fabri
bb1a012327
Merge pull request #2794 from realm/mf-bugfix-2792
...
Detect parameter attribute in vertical_parameter_alignment
2019-07-04 22:20:32 -07:00
Marcelo Fabri
0652b323f5
Use new source.request.compiler_version request
2019-07-04 10:59:43 -07:00
Marcelo Fabri
596bf8dbc8
Detect parameter attribute in vertical_parameter_alignment
...
Fixes #2792
2019-07-04 10:42:11 -07:00
JP Simard
7f4b736ea3
Synthesize Equatable implementations where possible ( #2790 )
2019-07-01 17:22:18 -04:00
JP Simard
aba0230b23
Delete presentation.jpg and replace with SVG for all languages
...
And revert SwiftLint to not have backticks when referring to the name of the project.
2019-07-01 16:34:44 -04:00
Ivan Vorobei
9f9b675cd6
Update image to vector ( #2780 )
...
* Update preview image
* Update README.md
2019-07-01 16:32:50 -04:00
Marcelo Fabri
740e398f91
release 0.33.0
2019-06-02 09:54:05 -07:00
Marcelo Fabri
0ee12bd096
Catch `!= 0` in legacy_multiple rule ( #2778 )
2019-06-02 09:52:05 -07:00
Marcelo Fabri
6be5bf74c3
Add legacy_multiple opt-in rule ( #2771 )
...
Fixes #2612 .
2019-06-01 22:49:23 -07:00
Marcelo Fabri
90cb1349c0
Add `duplicate_enum_cases` rule ( #2777 )
...
Fixes #2676
2019-06-01 20:32:55 -07:00
JP Simard
a4e62d5692
changelog formatting
2019-05-27 14:27:42 -07:00
Marcelo Fabri
862913f0c0
Don't trigger no_fallthrough_only if next case is @unknown ( #2770 )
...
* Don't trigger no_fallthrough_only if next case is @unknown
Fixes #2696
2019-05-25 21:53:23 -07:00
JP Simard
94be5345b1
Update podspec to support multiple swift versions ( #2769 )
...
now that CocoaPods 1.7.0 is out.
2019-05-24 09:47:59 -07:00
JP Simard
a55178e681
Use isDisjoint(with:) instead of intersection().isEmpty
2019-05-20 10:19:37 -07:00
Dalton Claybrook
a371419ce4
Fix issue where force-unwrapping self does not trigger a violation of the `force_unwrapping` rule ( #2764 )
...
* Fix issue where force-unwrapping self does not trigger a rule violation
* Update changelog
2019-05-20 10:17:32 -07:00
JP Simard
c216ccc1e5
Remove WeakComputedProperyRule ( #2761 )
...
* Remove WeakComputedProperyRule
Addresses https://github.com/realm/SwiftLint/issues/2712
* fixup! Remove WeakComputedProperyRule
2019-05-16 02:19:01 -07:00
Cihat Gündüz
d01ed712f9
Merge pull request #2754 from samrayner/samrayner/file-types-order-extensions
...
#2749 Fix file_types_order in extension-only files
2019-05-14 12:44:04 +02:00
Sam Rayner
7b82250995
#2749 Fix file_types_order in extension-only files
...
Prevents extensions being flagged as in the wrong order when a file only contains extensions and nothing else (enums, classes, structs). In this case it's not intuitive that the longest extension be considered the "main" one so the file can be considered as having no "main" type.
2019-05-13 13:59:16 +01:00
Kevin Randrup
d7439410e9
Introduce " - " delimiter to allow rules to be commented ( #2721 )
...
* Introduce " - " delimiter to allow rules to be commented
Ex. swiftlint:disable:next force_try - Explanation here
* Fix changelog formatting
2019-05-12 21:40:12 -07:00
JP Simard
7dd437b3cb
Bump SourceKitten dependency to 0.23.2 ( #2756 )
...
Which adds `Equatable` and `Hashable` conformance to `File`.
2019-05-12 14:51:56 -07:00
Alvar Hansen
af72c06be4
Skip module import if cursor info is missing module info ( #2746 )
2019-05-06 08:57:01 -07:00
Federico Zanetello
ef50162478
Fix Changelog url ( #2745 )
2019-05-05 22:12:34 -07:00
Marcelo Fabri
c33fc83be9
Merge pull request #2739 from realm/marcelo/unowned_variable_capture
...
Add `unowned_variable_capture` opt-in rule
2019-05-02 08:09:00 -07:00
Marcelo Fabri
a3aa36757b
Add `unowned_variable_capture` opt-in rule
...
Fixes #2097
2019-04-30 10:12:20 -07:00
JP Simard
eecef724de
Add a "known installation issues" section to readme ( #2738 )
...
to point users to solutions if they don't have a Swift 5 runtime available.
2019-04-30 09:51:24 -07:00
Frederick Pietschmann
3b9917f89d
Add nested type handling specification to file_name rule ( #2718 )
...
* Add nestedTypeSeparator to FileNameConfiguration
* Add tests for nested_type_separator configurability of file_name rule
* Add changelog entry
* Fix changelog position after rebase
2019-04-30 08:12:43 -07:00
Marcelo Fabri
9be5a97f00
Merge pull request #2735 from JaviSoto/patch-1
...
Fixed typo in `nslocalizedstring_require_bundle` rule description
2019-04-29 17:52:47 -07:00
Norio Nomura
d3c2f1f6a8
Merge pull request #2734 from realm/nn-make-simulate-homebrew-test-opt-in
...
Make `testSimulateHomebrewTest()` test opt-in
2019-04-30 09:21:33 +09:00
Javier Soto
49c288eb3f
Fixed typo in `nslocalizedstring_require_bundle` rule description
2019-04-29 17:06:28 -07:00
Norio Nomura
0de15e119d
Make `testSimulateHomebrewTest()` test opt-in
...
because it may fail on unknown condition.
Set `SWIFTLINT_FRAMEWORK_TEST_ENABLE_SIMULATE_HOMEBREW_TEST` environment variable to test like following:
```terminal.sh-session
$ SWIFTLINT_FRAMEWORK_TEST_ENABLE_SIMULATE_HOMEBREW_TEST=1 \
swift test --filter testSimulateHomebrewTest
```
2019-04-30 08:55:01 +09:00
Marcelo Fabri
4bca29cf31
Merge pull request #2733 from realm/marcelo/redundant_void_return-subscript
...
Don’t trigger redundant_void_return when using subscripts
2019-04-29 15:29:09 -07:00
JP Simard
acfc592ee0
Mark Swift 5 as supported ( #2730 )
...
* Mark Swift 5 as supported
* Only set a single Swift version on podspec
Multiple swift versions requires CocoaPods 1.7.0, which is still
in beta.
* Modernize ruby hash syntax
* Update SourceKitten to 0.23.1
2019-04-29 11:55:16 -07:00
Marcelo Fabri
d14d79d2c4
Don’t trigger redundant_void_return when using subscripts
2019-04-29 09:47:00 -07:00
JP Simard
27bd825e05
Add empty changelog section
2019-04-28 21:55:46 -07:00
JP Simard
6534946fe3
release 0.32.0
2019-04-28 21:30:19 -07:00
JP Simard
13b7156022
Fix typos in changelog entries
2019-04-28 21:24:47 -07:00
Marcelo Fabri
3a36212b94
Swift 5 support ( #2720 )
...
* Update project to compile with Xcode 10.2
* Fix explicit_acl with Swift 5
* Update macOS VM image
* Fix ConfigurationTests on Swift 5
* Update Podspec
* Workaround SR-10486 to fix validation tests
* Fix testDetectSwiftVersion on Swift 5
* Update specs repo when validating CocoaPods spec
* Fix redundant_set_access_control tests
* Manually update Package.resolved
* Use .upToNextMinor
* [Azure Pipelines] Add `sw_vers`
* Relax expecting conditions for crashing output in `testSimulateHomebrewTest()`
Because TSAN makes `swiflint` to produce additional output on crashing.
* Add CHANGELOG entry
* Ignore extensions in explicit ACL rules
* Work around SR-10486 for Sourcery
2019-04-28 21:10:06 -07:00
KelaKing
aea1654488
Update README_CN.md ( #2727 )
...
Add Mint
2019-04-28 17:04:15 -07:00
Dalton Claybrook
d0ce8b6ac8
Fix false positive in UnusedCaptureListRule ( #2726 )
2019-04-23 11:51:44 -07:00
JP Simard
318cc4b0bc
Update docs
2019-04-19 17:50:45 -04:00
JP Simard
230bedcd05
Bump ReduceIntoRule's minimum Swift version to Swift 4
2019-04-19 17:38:04 -04:00
Marcelo Fabri
ad2733391a
Merge pull request #2666 from daltonclaybrook/dc-reduce-into-rule
...
Add reduce_into opt-in rule
2019-04-15 14:52:04 -07:00
Marcelo Fabri
87d9097b95
Merge pull request #2719 from daltonclaybrook/dc-unused-capture-list-rule
...
Add unused_capture_list rule
2019-04-15 10:04:09 -07:00
Dalton Claybrook
59990129f9
PR feedback updates
2019-04-15 07:34:57 -04:00
Dalton Claybrook
665920aa0b
Fix line length violation + updated changelog
2019-04-14 18:55:43 -04:00
Dalton Claybrook
41c8da2769
Cleanup
2019-04-14 18:46:34 -04:00
Dalton Claybrook
0a0a60b9da
Rule is now passing tests
2019-04-14 18:34:47 -04:00
Dalton Claybrook
d8f671c315
WIP - create unused capture list rule
2019-04-13 23:12:25 -04:00
Marcelo Fabri
c80ffd34d2
Merge pull request #2716 from fredpi/feature/#2670-fix-superfluous-disable
...
Fix "superfluous_disable_command" / "disable all" interference
2019-04-12 10:02:45 -07:00
Frederick Pietschmann
43e18458de
Update file headers for new sourcery version
2019-04-12 17:13:27 +02:00
Frederick Pietschmann
71d4fe9a24
Adjust disable all / superfluous_disable_command test
2019-04-12 17:13:13 +02:00
Frederick Pietschmann
e3fb18bedc
Add changelog entry
2019-04-12 16:33:22 +02:00
Frederick Pietschmann
4cd6cafcbf
Make sourcery
2019-04-12 16:27:54 +02:00
Frederick Pietschmann
81abf9f3f2
Let "disable all" command override "superfluous_disable_command" rule
2019-04-12 16:27:43 +02:00
Frederick Pietschmann
70d9eef09b
Add test whether superfluous disable command respects disable all command
2019-04-12 15:53:34 +02:00
Marcelo Fabri
bc8f9d69a0
Merge pull request #2710 from realm/marcelo/acl-swift-5
...
Fix false positives on `explicit_acl` and `explicit_top_level_acl`
2019-04-09 11:32:17 -07:00
Marcelo Fabri
fa1184d844
Merge pull request #2679 from realm/marcelo/first-index
...
`contains_over_first_not_nil` rule now also checks for `firstIndex(where:)`
2019-04-09 11:31:51 -07:00
Marcelo Fabri
537dec1d37
Fix false positives on `explicit_acl` and `explicit_top_level_acl`
...
Fixes #2705
2019-04-09 10:59:46 -07:00
Marcelo Fabri
51d47d492c
`contains_over_first_not_nil` rule now also checks for `firstIndex(where:)`
...
Fixes #2678
2019-04-09 10:53:42 -07:00
JP Simard
a97487f3e1
Refactor `Configuration.groupFiles(...)` for style and performance ( #2707 )
...
* Move changelog entry to appropriate section
* Refactor file exclusion from groupedFiles for performance and style
2019-04-07 16:59:44 -07:00
Dylan Bruschi
9396a0a32b
Fix bug where nested configuration excluded files are ignored ( #2648 )
...
Fixes #2447
When SwiftLint is linting files in `visitLintableFiles` in `Configuration+CommandLine`, it:
1. Gathers all lintable files in `getFiles`. This is where the exclusion of files occurs based on the parent configuration's exclusion list.
2. These files are grouped by their specific configuration in `groupFiles`. This is where configurations for each available file are determined (and if nested configurations exist, merged). After these configurations are determined and the files are grouped accordingly, no more files are excluded from the lintable files list. Even though a file's configuration thinks it should be excluded, these files are not removed from the list of lintable files, generating the bug.
3. Finally, each file is visited by the linter.
My solution is to skip files whose merged configurations specify they should be excluded in step 2 or `groupFiles`. Therefore, they will not be visited in step 3.
2019-04-07 15:43:29 -07:00
JP Simard
834df26609
Merge pull request #2682 from realm/check-swift_static
...
[Makefile] Avoid using `-Xswiftc -static-stdlib` if toolchain does not have `usr/lib/swift_static` directory
2019-04-06 15:59:48 -07:00
JP Simard
ace6aadb3e
Return false for isFile for empty strings ( #2706 )
...
As of Swift 5, corelibs-foundation crashes if you pass an empty string
to `fileExists` cae5eaca63/Foundation/FileManager.swift (L2033)
2019-04-06 15:53:26 -07:00
JP Simard
9cc97d666e
Add a changelog entry
2019-04-06 15:47:15 -07:00
Keith Smiley
dd39c438e1
Return false for isFile for empty strings
...
As of Swift 5, corelibs-foundation crashes if you pass an empty string
to `fileExists` cae5eaca63/Foundation/FileManager.swift (L2033)
2019-04-02 18:15:40 -07:00
Marcelo Fabri
1d7b37be1d
Merge pull request #2701 from r-plus/bugfix-2700
...
fix: false positive on sorted_first_last with firstIndex(of:), firstIndex(where:), lastIndex(of:) and lastIndex(where:) method
2019-04-02 09:54:01 -07:00
Marcelo Fabri
800ca0e0d8
Merge pull request #2704 from daltonclaybrook/dc-number-separator-more-examples
...
Add triggering examples with parentheses to the number separator rule tests
2019-04-02 09:19:19 -07:00
Dalton Claybrook
696cdf801c
Add triggering examples with parentheses to the number separator rule tests
2019-04-02 09:02:49 -04:00
r-plus
72dc428b2f
Add some non-triggering examples to SortedFirstLastRule
2019-04-02 10:40:43 +09:00
Marcelo Fabri
442a59d71c
Merge pull request #2672 from matthew-healy/matthew-healy/nslocalizedstring-require-bundle
...
Add NSLocalizedStringRequireBundleRule
2019-04-01 08:35:48 -07:00
r-plus
c7a1cc1d54
fix: false positive on sorted_first_last with firstIndex(of:) and lastIndex(of:) method
...
Fixes #2700
2019-04-01 15:03:46 +09:00
Matthew Healy
2894da1c72
[nslocalizedstring_require_bundle] Update CHANGELOG
2019-03-30 00:17:43 +01:00
Matthew Healy
f54e7406d9
[nslocalizedstring_require_bundle] Implement NSLocalizedStringRequireBundleRule
2019-03-30 00:17:43 +01:00
Matthew Healy
dc9584e524
[nslocalizedstring_require_bundle] Add autogenerated documentation
2019-03-30 00:17:43 +01:00
Matthew Healy
eecf27ede8
[nslocalizedstring_require_bundle] Run make sourcery
2019-03-30 00:10:14 +01:00
Matthew Healy
74b51c5d38
[nslocalizedstring_require_bundle] Add NSLocalizedStringRequireBundleRule description
2019-03-30 00:10:14 +01:00
Cihat Gündüz
9d0ac2d654
Merge pull request #2687 from daltonclaybrook/dc_number_separator_false_positive
...
Fix false positives on `number_separator` when the number is wrapped in parentheses.
2019-03-28 00:16:45 +01:00
Dalton Claybrook
2567900491
Fix changelog formatting after rebase
2019-03-27 07:53:59 -04:00
Dalton Claybrook
ce2d1c973b
Update variable name to be more specific which negates the need for a comment
2019-03-27 07:51:39 -04:00
Dalton Claybrook
a5d4fb1c14
Add comment explaining the fix
2019-03-27 07:51:39 -04:00
Dalton Claybrook
3866871127
Add entry to changelog
2019-03-27 07:51:39 -04:00
Dalton Claybrook
10711bb92b
Fix issue where using parentheses around a number could result in a false-positive on number_separator
2019-03-27 07:51:39 -04:00
Cihat Gündüz
dc22d93c30
Merge pull request #2296 from Dschee/file-content-order
...
File Types Order & Type Contents Order
2019-03-27 12:32:37 +01:00
Cihat Gündüz
b145d666d0
Fix issues after rebasing to master
2019-03-27 11:54:56 +01:00
Cihat Gündüz
020d0d140c
Merge pull request #2685 from jsloop42/master
...
Update Discarded Notification Center Observer Violation false positive trigger on array append
2019-03-27 11:18:00 +01:00
jsloop
3d528030d6
Update documentation #2684
2019-03-27 15:14:50 +05:30
Cihat Gündüz
02f11bd21d
Fix Changelog entries placement
2019-03-27 10:34:58 +01:00
Cihat Gündüz
7d5aa7a574
Fix holdover from debugging session (aka "rogue print call")
2019-03-27 10:34:58 +01:00
Cihat Gündüz
adc4985189
Fix CHANGELOG.md position after rebase
2019-03-27 10:34:58 +01:00
Cihat Gündüz
311965f23c
Fix issues after rebase
2019-03-27 10:34:58 +01:00
Cihat Gündüz
837e9bca56
Move changelog entries to new release
2019-03-27 10:34:41 +01:00
Cihat Gündüz
d172dc190b
[CHANGELOG.md] Fix missing newline after rebase
2019-03-27 10:34:41 +01:00
Cihat Gündüz
4f2f0ac350
Fix issue with missing types in older Swift versions
2019-03-27 10:34:41 +01:00
Cihat Gündüz
f3ccc8cd4c
Regenerate file for Linux testing & fix leftover
2019-03-27 10:34:41 +01:00
Cihat Gündüz
50fba286ab
Add tests for different configurations in type_contents_order
2019-03-27 10:34:41 +01:00
Cihat Gündüz
04b2f9cac4
Split nonTriggeringExamples in components
2019-03-27 10:34:41 +01:00
Cihat Gündüz
bea1d31937
Add tests for different configurations in file_types_order
2019-03-27 10:34:41 +01:00
Cihat Gündüz
843a9334d3
Move rule examples out of rule file
2019-03-27 10:34:41 +01:00
Cihat Gündüz
7d43a71510
Add more specific instance property type ib_inspectable
2019-03-27 10:34:41 +01:00
Cihat Gündüz
553b22110a
Improve english in violatin reasons
2019-03-27 10:34:41 +01:00
Cihat Gündüz
56cea92913
Make implementation less probable to crash
2019-03-27 10:34:41 +01:00
Cihat Gündüz
99f60685a3
Implement equatable protocols manually for Swift 4.0 conformance
2019-03-27 10:34:41 +01:00
Cihat Gündüz
38277b75b5
Cleanup after rebase
2019-03-27 10:34:41 +01:00
Cihat Gündüz
423f30025b
Fix offset encoding issue
2019-03-27 10:34:41 +01:00
Cihat Gündüz
3f2ad0ed9a
Sort rule configurations in project navigator by name
2019-03-27 10:34:41 +01:00
Cihat Gündüz
ea7f5e6b47
Fix configuration naming issue
2019-03-27 10:34:41 +01:00
Cihat Gündüz
a3fc519a01
Whitelist supporting types instead of blacklist
2019-03-27 10:34:41 +01:00
Cihat Gündüz
a9ec3b5949
Fix pointers & update Rules.md
2019-03-27 10:34:41 +01:00
Cihat Gündüz
664efbc916
Add more specific reason in found violations
2019-03-27 10:34:41 +01:00
Cihat Gündüz
e0fb65624b
Add configurations for both rules
2019-03-27 10:34:41 +01:00
Cihat Gündüz
cdec4717e6
[CHANGELOG.md] Add entries for new rules file_types_order & type_contents_order
2019-03-27 10:34:41 +01:00
Cihat Gündüz
39b1fb516c
Complete implementation of type_contents_order rule
2019-03-27 10:34:41 +01:00
Cihat Gündüz
92d9cacb85
Implement violation finding part type_contents_rule
2019-03-27 10:34:40 +01:00
Cihat Gündüz
423c4ec8f7
Fix issues with file_types_order rule
2019-03-27 10:34:40 +01:00
Cihat Gündüz
b19b0ca294
Basic file_types_order implementation
2019-03-27 10:34:40 +01:00
Cihat Gündüz
7b94984175
Split new rule up into two separate rules
2019-03-27 10:34:40 +01:00
Cihat Gündüz
f379fdef77
Define new rule file_content_order with examples & tests
2019-03-27 10:34:40 +01:00
jsloop
c2e9b1110e
Update documentation
...
https://github.com/realm/SwiftLint/issues/2684
2019-03-27 12:29:00 +05:30
jsloop
e8cf3e5469
Update rule to match any function
...
- Updated rule to not trigger if notification observer is passed to any function as argument (https://github.com/realm/SwiftLint/issues/2684 )
2019-03-27 12:17:58 +05:30
Dalton Claybrook
0aa6c429fb
Fix build error on linux
2019-03-24 16:36:10 -04:00
Dalton Claybrook
1e69dd950a
Now the reduce_into rule is only triggered for COW types
2019-03-24 16:22:20 -04:00
Dalton Claybrook
92de850471
ReduceIntoRule is now an ASTRule
2019-03-24 16:22:20 -04:00
Dalton Claybrook
87dbf8e3d7
Fix Changelog issue, Sourcery version mismatch, and package.resolved issue
2019-03-24 16:22:19 -04:00
Dalton Claybrook
7576984b60
Add changelog entry for reduce_into
2019-03-24 16:22:19 -04:00
Dalton Claybrook
7c2e4dfd19
Add ReduceIntoRule
2019-03-24 16:22:19 -04:00
Hiroki Nagasawa
834315796c
Update bundler version to v2.0.1 ( #2681 )
...
* Update bundler version to v2.0.1
* Remove unnecessary step for update bundler
2019-03-24 09:26:57 -07:00
jsloop
b6edb17955
Add bug description in change log file #2684
2019-03-23 16:31:13 +05:30
jsloop
9308c38ba4
Update discarded notification center observer
...
- This fixes an issue where the notification center observer is appended to an array, which triggers the violation. Fixes https://github.com/realm/SwiftLint/issues/2684 .
2019-03-23 15:56:16 +05:30
Norio Nomura
398733afa4
[Makefile] Avoid using `-Xswiftc -static-stdlib` if toolchain does not have `usr/lib/swift_static` directory
...
This is required on building with Xcode 10.2, because Xcode 10.2’s toolchain does not have `usr/lib/swift_static` directory.
2019-03-20 19:26:59 +09:00
Marcelo Fabri
ddab4a4eb0
Fix changelog entries
2019-03-13 11:07:57 -07:00
Marcelo Fabri
9fc1d571ae
Merge pull request #2669 from pixyzehn/fix-link-for-redundant-@objc-attribute
...
Remove @ mark to fix invalid link in Rules.md
2019-03-13 09:41:20 -07:00
Xaver Lohmüller
57af7f0e30
Add ReduceBooleanRule ( #2675 )
...
* [reduce_boolean] Implement rule
* [reduce_boolean] Improve reason text
* [reduce_boolean] Fix new violations
* [reduce_boolean] Add CHANGELOG.md entry
* [reduce_boolean] Shorten rule name
* [reduce_boolean] Use regular map instead of compactMap
* [reduce_boolean] Match only possible syntax kinds
2019-03-10 10:54:14 -07:00
Nagasawa Hiroki
ddce88fb61
Update CHANGELOG.md
2019-03-09 17:45:32 +00:00
Nagasawa Hiroki
8fa2d0bcfc
Remove punctuation from anchor
2019-03-09 17:12:22 +00:00
Nagasawa Hiroki
92efeac3f1
Revert "Remove @ mark to fix invalid link"
...
This reverts commit 1219244086
.
2019-03-09 16:33:53 +00:00
Nagasawa Hiroki
1219244086
Remove @ mark to fix invalid link
2019-03-06 10:23:21 +00:00
Marcelo Fabri
eb3f21c34a
Merge pull request #2633 from realm/mf-colon-rule-generic
...
Colon rule now catches violations on generic type declarations
2019-03-04 09:25:02 -08:00
Marcelo Fabri
6b3b89cff4
Colon rule now catches violations on generic type declarations
...
Fixes #2628
2019-03-03 20:06:13 -08:00
Marcelo Fabri
6244d98238
Merge pull request #2663 from matthew-healy/matthew-healy/equatable-nsobject
...
Add NSObjectPreferIsEqualRule
2019-03-03 20:03:40 -08:00
Matthew Healy
eded960dfd
[nsobject_prefer_isequal] Update CHANGELOG.md
2019-03-01 21:15:03 +01:00
Matthew Healy
dbb5aa4c9e
[nsobject_prefer_isequal] Implement NSObject == linter rule
2019-03-01 21:15:03 +01:00
Matthew Healy
a75198f9d0
[nsobject_prefer_isequal] Add autogenerated documentation
2019-03-01 21:15:03 +01:00
Matthew Healy
057c72c2a6
[nsobject_prefer_isequal] Run make sourcery
2019-03-01 21:15:03 +01:00
Matthew Healy
1c90d8745f
[nsobject_prefer_isequal] Add NSObjectPreferIsEqualRule definition
2019-03-01 21:15:03 +01:00
Marcelo Fabri
a8c108e512
Add empty CHANGELOG section
2019-02-28 15:40:10 -08:00
Marcelo Fabri
26c0048cf4
release 0.31.0
2019-02-28 15:01:30 -08:00
Cihat Gündüz
7155b86919
Merge pull request #2638 from realm/cg-first_where-fix
...
Fix false positives on rule `first_where`
2019-02-27 12:25:03 +01:00
Paul Taykalo
1b0ac66334
Update reduce to reduce:into for a bit faster running ( #2657 )
2019-02-22 09:29:39 -08:00
Paul Taykalo
f1fd6cec3a
Update group Array extension to faster implementation ( #2654 )
2019-02-20 19:33:19 -08:00
Cihat Gündüz
0c36874ec1
Merge pull request #2642 from realm/cg-number_separator-fix
...
Fix false positive on `number_separator` with year integer literals
2019-02-14 23:30:08 +01:00
Cihat Gündüz
d9113a7b87
[first_where] Fix CHANGELOG after solving merge conflicts
2019-02-14 21:30:23 +01:00
Cihat Gündüz
3c607f1f4a
[first_where] Make triggering example valid Swift code
2019-02-14 21:29:49 +01:00
Cihat Gündüz
5e1b491eea
[first_where] Fix code smells like suggested by @marcelofabri
2019-02-14 21:29:49 +01:00
Cihat Gündüz
11fa7f1906
[first_where] Add CHANGELOG entry for fix
2019-02-14 21:29:49 +01:00
Cihat Gündüz
09fb947887
[first_where] Prevent false positives by excluding some substructures
2019-02-14 21:29:49 +01:00
Cihat Gündüz
2d67f611b8
[first_where] Add false positives from #1930 as non-triggering examples
2019-02-14 21:29:49 +01:00
Cihat Gündüz
37687fbdc4
[number_separator] Fix CHANGELOG entry name & merge conflict issue
2019-02-14 21:22:04 +01:00
Cihat Gündüz
3ab600f5a2
[number_separator] Add more non-triggering examples + Rename option to exclude_ranges
2019-02-14 21:19:15 +01:00
Cihat Gündüz
57fe9947a6
[number_separator] Add valid_ranges option instead of ignoring years by default
2019-02-14 21:19:15 +01:00
Cihat Gündüz
bf8a4dbc24
[number_separator] Update Rules.md with new non-triggering examples
2019-02-14 21:19:15 +01:00
Cihat Gündüz
62d66aec70
[number_separator] Add CHANGELOG entry with fix
2019-02-14 21:19:15 +01:00
Cihat Gündüz
85a6a77791
[number_separator] Allow year integer literals to be written without separator
2019-02-14 21:19:15 +01:00
Cihat Gündüz
efee4ed582
[number_separator] Add false positives to default non-triggering examples
2019-02-14 21:19:15 +01:00
Cihat Gündüz
47dd897ec2
Merge pull request #2639 from realm/cg-unused_closure_parameter-fix
...
Fix false positives on rule `unused_closure_parameter` with `self` arguments
2019-02-14 21:17:14 +01:00
Cihat Gündüz
4622b2077e
[unused_closure_parameter] Resolve merge conflict in CHANGELOG
2019-02-14 18:50:20 +01:00
Cihat Gündüz
74d40f2845
[unused_closure_parameter] Check if self is a keyword to prevent potential issues
...
This was suggested by @[marcelofabri](/marcelofabri) here:
https://github.com/realm/SwiftLint/pull/2639#discussion_r256048671
2019-02-14 18:49:13 +01:00
Cihat Gündüz
0cf41f5f68
[unused_closure_parameter] Update Rules.md with new (non-)triggering examples
2019-02-14 18:49:13 +01:00
Cihat Gündüz
4628f8a274
[unused_closure_parameter] Add CHANGELOG entry for fix
2019-02-14 18:49:13 +01:00
Cihat Gündüz
fe146a3e40
[unused_closure_parameter] Make an exception for the `self` keyword and handle like identifier
...
Rationale: This makes the usage of the Delegated pattern usable without violating this rule.
See here for more details: https://github.com/dreymonde/Delegated
2019-02-14 18:49:13 +01:00
Cihat Gündüz
315f3a30a4
[unused_closure_parameter] Add false positive to non-triggering examples
2019-02-14 18:49:13 +01:00
Marcelo Fabri
0bc7d41958
Merge pull request #2641 from realm/cg-explicit_type_interface-fix
...
Fixes false positives on `explicit_type_interface` with type reference assignments
2019-02-14 09:18:55 -08:00
Marcelo Fabri
df9005b6ab
Merge pull request #2647 from almazrafi/master
...
Fix false positives on no_grouping_extension rule when using where clause
2019-02-14 09:17:56 -08:00
Almaz Ibragimov
ee21684e93
Fixed `where` keyword detection method and CHANGELOG
2019-02-14 04:47:24 +03:00
Almaz Ibragimov
72a18e4aec
Fix false positives on no_grouping_extension rule when using where clause
2019-02-14 03:05:46 +03:00
Cihat Gündüz
70f686591d
[explicit_type_interface] Simplified type assignment regex
2019-02-12 18:50:24 +01:00
Cihat Gündüz
5b7a057555
[explicit_type_interface] Add CHANGELOG entry for fix
2019-02-12 14:46:15 +01:00
Cihat Gündüz
04ce4f8c49
[explicit_type_interface] Make sure type reference assignments are detected with allow_redundancy
2019-02-12 14:44:26 +01:00
Cihat Gündüz
7ff07958db
[explicit_type_interface] Add false positive to non-triggering examples for option allow_reduncancy
2019-02-12 14:28:09 +01:00
Marcelo Fabri
dde13e49fb
Merge pull request #2625 from realm/mf-bugfix-2623
...
Fix excessive `superfluous_disable_command` violations
2019-02-09 02:32:24 -08:00
Marcelo Fabri
bf9758679b
Support commands using “/* .. */“
2019-02-09 01:48:36 -08:00
Marcelo Fabri
735c432eaf
Skip whitespace only rule identifiers
2019-02-09 01:36:03 -08:00
Marcelo Fabri
19505dbcad
Fix excessive `superfluous_disable_command` violations
...
Fixes #2623
2019-02-09 01:36:03 -08:00
Marcelo Fabri
d20f9f8337
Merge pull request #2626 from realm/mf-not-configured-rule
...
Warn if a configured rule is not enabled
2019-02-09 01:35:01 -08:00
Marcelo Fabri
34616f7fd0
Minor changes to LetVarWhitespaceRule.swift
2019-02-03 15:01:35 -08:00
Marcelo Fabri
82440d361d
Merge pull request #2629 from Igor-Palaguta/let_var_whitespace-With-Warning
...
Let var whitespace with warning
2019-02-03 14:53:31 -08:00
Marcelo Fabri
7ecfce34c7
Warn if a configured rule is not enabled.
...
Fixes #1350
2019-02-03 14:43:00 -08:00
Marcelo Fabri
cc1418502d
Merge pull request #2622 from Igor-Palaguta/TriggerBooleanNimbleOperators
...
Trigger boolean nimble operators
2019-02-03 14:39:59 -08:00
Marcelo Fabri
bfebdce4fb
Merge pull request #2624 from BenStaveleyTaylor/master
...
Add Deinit Required rule
2019-02-03 14:38:05 -08:00
Igor Palaguta
e611831a26
Fix trailing spaces
2019-02-04 00:37:22 +02:00
Igor Palaguta
279f52c6ff
Add #error
2019-02-04 00:35:26 +02:00
Ben Staveley-Taylor
56f9aca477
Change rule kind from Style to Lint
2019-02-03 20:39:07 +00:00
Igor Palaguta
215f15647c
Fix Rules whitespaces
2019-02-03 20:25:29 +02:00
Igor Palaguta
7078a5057b
ignore warning directives
2019-02-03 20:22:45 +02:00
Ben Staveley-Taylor
b8b83d025b
Code formatting tidy-up
2019-02-03 15:15:53 +00:00
Ben Staveley-Taylor
e29d38cde2
Incorporate review comments
...
- Rename from Deinit_Required to Required_Deinit
- Adopt ASTRule protocol
2019-02-03 15:02:19 +00:00
Igor Palaguta
c75097a54d
Add trailng spaces
2019-02-03 14:28:24 +02:00
Ben Staveley-Taylor
ac73301f97
Back out accidental scheme change
2019-02-02 15:22:06 +00:00
Ben Staveley-Taylor
bff405d34e
Add deinit_required rule
...
Classes are required to have a deinit method.
This is a style to help debugging memory issues, when it is common to want to set a breakpoint at the point of deallocation. Most classes don't have a deinit, so the developer ends up having to quit, add a deinit and rebuild to proceed. If all classes have a deinit, debugging is much smoother.
Ref: https://github.com/realm/SwiftLint/issues/2620
2019-02-02 14:52:48 +00:00
Igor Palaguta
49cce549f1
Fix CHANGELOG
2019-02-01 02:54:34 +02:00
Igor Palaguta
3043c081d3
fix line length warning
2019-02-01 01:58:44 +02:00
Igor Palaguta
c616f1e846
fix variable name
2019-02-01 01:52:34 +02:00
Igor Palaguta
939468e1fe
trigget beTrue and beFalse
2019-02-01 01:51:33 +02:00
Maru
d8a91501a6
Remove unmeaning comment in colon rule ( #2610 )
2019-01-29 08:30:09 -08:00
JP Simard
7b447ab5b1
Fix `lower_acl_than_parent` when linting with Swift 5 ( #2609 )
2019-01-28 12:49:23 -08:00
JP Simard
e5396af9e6
Fix lint issues from #2593
2019-01-28 10:53:01 -08:00
dirtydanee
6493c6f8b5
Make `redundant_objc_attribute` rule autocorrectable. ( #2593 )
...
* Moved the violation point from the variables offset to the `@objc` attribute startIndex. I think it kinda makes sense, since the violations warns against the redundant attribute, there is nothing to fix on the variable itself.
* Searching for ranges of violations initially, and converting later only to `StyleViolation`-s
* Making the rule conforming to `CorrectableRule`. Kinda straightforward, the only extra is that I am counting the attribute's trailing whitespace and newline characters and removing with the attribute. I am doing so since I would like to keep the format of the code.
2019-01-28 10:16:11 -08:00
Marcelo Fabri
e4ba455cf0
Merge pull request #2599 from realm/mf-migrate-correctable-rules
...
Migrate CorrectableRules to use new protocols
2019-01-27 21:42:07 -08:00
Norio Nomura
a4ce99aa95
Merge pull request #2605 from realm/nn-remove-environment-variable-operations
...
Remove unnecessary environment variable operations from `execute(_:in:input:)`
2019-01-28 14:23:15 +09:00
JP Simard
9cec649ab6
Add tests that fail with Swift 5 ( #2604 )
...
These are tests that pass with Swift 4.2.x but fail with Swift 5.0
from Xcode 10.2 beta 1.
2019-01-27 20:54:03 -08:00
JP Simard
4b3dd7d2a3
Apply small edits to IntegrationTests.swift ( #2603 )
...
* Make constant private
* Avoid force-unwrap
* Allow early return if path is found
2019-01-27 20:46:32 -08:00
Norio Nomura
bfb9b278fd
Remove unnecessary environment variable operations from `execute(_:in:input:)`
...
Those environment variables are not required on SwiftLint.
Sorry, I forgot to remove them on copying the `execute(_:in:input:)` from my other project. 🙇♂️
2019-01-28 13:41:12 +09:00
JP Simard
2638827965
Add SwiftVersion.five and automatically detect it ( #2602 )
...
Add `SwiftVersion.five` and automatically detect it when computing `SwiftVersion.current`.
2019-01-27 20:26:30 -08:00
JP Simard
18ad2473d0
Remove unnecessary backticks ( #2601 )
...
These were once required but now that we only support Swift 4.2 or later, they're unnecessary.
2019-01-27 20:19:49 -08:00
JP Simard
f08c3e4239
Use firstIndex(where:) instead of index(where:) ( #2600 )
...
to silence a Swift 5 warning. This is compatible with Swift 4.2.
2019-01-27 20:19:16 -08:00
Marcelo Fabri
b3c399b025
Migrate EmptyParametersRule
2019-01-27 19:05:31 -08:00
Marcelo Fabri
c1002d7fc6
Migrate EmptyEnumArgumentsRule
2019-01-27 19:02:57 -08:00
Marcelo Fabri
225780ad32
Migrate CommaRule
2019-01-27 19:00:53 -08:00
Marcelo Fabri
dbe920da69
Migrate EmptyParenthesesWithTrailingClosureRule
2019-01-27 18:59:38 -08:00
Marcelo Fabri
19df08ff93
Convert ClosingBraceRule
2019-01-27 18:57:25 -08:00
Marcelo Fabri
03632b24f1
Migrate TrailingSemicolonRule
2019-01-27 18:53:05 -08:00
Marcelo Fabri
6642180212
Migrate RedundantOptionalInitializationRule
2019-01-27 18:50:29 -08:00
Marcelo Fabri
08570c1dd1
Migrate RedundantVoidReturnRule
2019-01-27 18:48:33 -08:00
Marcelo Fabri
708f763215
Migrate RedundantTypeAnnotationRule
2019-01-27 18:46:55 -08:00
Marcelo Fabri
b0a6ec22e0
Migrate RedundantNilCoalescingRule
2019-01-27 18:45:55 -08:00
Marcelo Fabri
b49ecf7b9a
Migrate JoinedDefaultParameterRule
2019-01-27 18:43:45 -08:00
Marcelo Fabri
d9df6976d5
Migrate ExplicitInitRule
2019-01-27 18:42:34 -08:00
Marcelo Fabri
d52eb0c64b
Migrate ImplicitReturnRule
2019-01-27 18:40:56 -08:00
Marcelo Fabri
7c5c742d36
Migrate ProtocolPropertyAccessorsOrderRule
2019-01-27 18:39:08 -08:00
Marcelo Fabri
1dbd255c52
Migrate RedundantDiscardableLetRule
2019-01-27 18:38:04 -08:00
Marcelo Fabri
d147ed43f4
Migrate VoidReturnRule
2019-01-27 18:35:48 -08:00
Marcelo Fabri
b309dfd4ee
Migrate TrailingCommaRule
2019-01-27 18:35:42 -08:00
Marcelo Fabri
d6dac23bc1
Migrate UnusedControlFlowLabelRule
2019-01-27 18:35:30 -08:00
Marcelo Fabri
336fb20b48
Migrate UnusedClosureParameterRule
2019-01-27 18:35:24 -08:00
Marcelo Fabri
979f24c0c1
Merge pull request #2598 from realm/mf-substitution-correctable-rule
...
Add SubstitutionCorrectableRule and SubstitutionCorrectableASTRule
2019-01-27 18:05:16 -08:00
Marcelo Fabri
5a0bf55f74
PR feedback
2019-01-27 14:04:24 -08:00
Marcelo Fabri
a174126f28
Add missing import
2019-01-27 12:44:52 -08:00
Marcelo Fabri
0ca9f6e85e
Refactor WeakComputedProperyRule
2019-01-27 12:38:14 -08:00
Marcelo Fabri
5d4923f568
Add SubstitutionCorrectableRule and SubstitutionCorrectableASTRule
2019-01-27 12:32:10 -08:00
Marcelo Fabri
ea9c638926
Merge pull request #2597 from realm/mf-weak_computed_property
...
Add `weak_computed_property` rule
2019-01-27 11:57:16 -08:00
Marcelo Fabri
81ffa9b0bb
Don’t trigger for stored properties with observers
2019-01-26 02:52:38 -08:00
Marcelo Fabri
757b5fb94d
Add `weak_computed_property` rule
...
Fixes #2596
2019-01-26 02:11:35 -08:00
Marcelo Fabri
7c38722384
Merge pull request #2591 from marcelofabri/mf-deployment-target-rule
...
Add `deployment_target` rule
2019-01-26 00:46:05 -08:00
Marcelo Fabri
a1b659aa1b
Merge pull request #2588 from dirtydanee/bugfix/explicit-type-interface-in-groups-and-stmts
...
Fix ExplicitTypeInterfaceRule in groups and statements
2019-01-25 13:37:44 -08:00
Marcelo Fabri
1495f62203
Use SwiftDeclarationAttributeKind
2019-01-25 01:10:53 -08:00
Marcelo Fabri
293805cf11
Remove unused import
2019-01-24 22:28:45 -08:00
Marcelo Fabri
6fadf80eae
Add `deployment_target` rule
...
Fixes #2589
2019-01-24 21:42:11 -08:00
Marcelo Fabri
86f25bf7ea
Merge pull request #2590 from realm/mf-minor-refactoring
...
Extract two common operations to extensions
2019-01-24 21:35:55 -08:00
Marcelo Fabri
7b84e2bf66
Extract two common operations to extensions
2019-01-24 21:14:10 -08:00
Daniel Metzing
4634467644
Fix ExplicitTypeInterfaceRule in groups and statements
2019-01-24 20:37:42 +01:00
Marcelo Fabri
407d9a7008
Add empty master changelog section
2019-01-23 16:25:40 -08:00
Marcelo Fabri
b2d428a4e2
release 0.30.1
2019-01-23 11:08:50 -08:00
Marcelo Fabri
c2d9a9c849
Merge pull request #2581 from realm/mf-nslocalizedstring_key
...
Add `nslocalizedstring_key` opt-in rule
2019-01-23 10:44:26 -08:00
Marcelo Fabri
14ef233987
PR feedback
2019-01-23 09:57:40 -08:00
Marcelo Fabri
8cde771e9c
Allow string concatenation
2019-01-23 09:32:37 -08:00
Marcelo Fabri
ea4e13b9a8
Add `nslocalizedstring_key` opt-in rule
2019-01-22 23:54:04 -08:00
JP Simard
eca7e6b365
Move changelog entry to bug fixes section and link to issue
2019-01-22 12:30:16 -08:00
Luis Valdés
80a44bcf8c
Exclude files defined in `excluded` when using the `--use-script-input-files` and `--force-exclude` options ( #2574 )
2019-01-22 12:28:34 -08:00
Marcelo Fabri
22e34b3606
Merge pull request #2577 from realm/mf-bugfix-1877
...
Fix false positives in array_init rule with prefix operators
2019-01-22 00:46:31 -08:00
Marcelo Fabri
6876419552
Fix false positives in array_init rule with prefix operators
...
Fixes #1877
2019-01-21 23:07:21 -08:00
Kim de Vos
da4d25fa8d
Silence `CodingKeys` violations in `unused_private_declaration` ( #2575 )
2019-01-21 13:11:00 -08:00
Marcelo Fabri
bdcf04db83
Merge pull request #2572 from realm/mf-bugfix-2159
...
Fix false positives on `trailing_closure` with anonymous closures
2019-01-19 15:33:04 -08:00
Marcelo Fabri
2b822e8c6d
Fix false positives on `trailing_closure` with anonymous closures
...
Fixes #2159
2019-01-18 17:43:54 -08:00
Marcelo Fabri
1a5b21f89f
Add empty changelog section
2019-01-18 17:28:06 -08:00
Marcelo Fabri
d40fc8e452
release 0.30.0
2019-01-17 23:28:28 -08:00
Marcelo Fabri
6801608c43
Merge pull request #2568 from realm/mf-trailing-closure-single-muted-param
...
Add `only_single_muted_parameter` configuration on `trailing_closure` rule
2019-01-17 22:26:34 -08:00
Norio Nomura
c20ca082b5
Merge pull request #2569 from realm/nn-update-azure-pipelines-configuration
...
Update Azure Pipelines configuration
2019-01-18 15:23:28 +09:00
Marcelo Fabri
f8dda65637
Add `only_single_muted_parameter` configuration on `trailing_closure
2019-01-17 22:02:47 -08:00
Norio Nomura
758be7d1fb
[Azure Pipelines] Use `DEVELOPER_DIR` environment variable instead of executing `xcode-select`
...
That reduces some steps and removes `XCODE_APP` environment variable.
2019-01-18 14:55:23 +09:00
Norio Nomura
d22dd39fab
[Azure Pipelines] Use container shorthand and inline container
...
https://docs.microsoft.com/en-us/azure/devops/release-notes/2018/sprint-143-update#declare-container-resources-inline
2019-01-18 14:55:23 +09:00
Marcelo Fabri
e347582977
Merge pull request #2567 from realm/mf-unused-newValue
...
Add unused_setter_argument rule
2019-01-17 21:06:55 -08:00
Marcelo Fabri
8f93b21543
Fix typos in examples
2019-01-17 20:38:26 -08:00
Marcelo Fabri
26e531f771
Rename rule to UnusedSetterValueRule
2019-01-17 20:37:31 -08:00
Marcelo Fabri
6bdadb01c1
Add changelog entry
2019-01-17 19:27:02 -08:00
Marcelo Fabri
17906b2ac6
Handle named arguments
2019-01-17 19:25:39 -08:00
Marcelo Fabri
105f8a8710
Add unused_setter_argument rule
2019-01-17 18:51:47 -08:00
Samuel Susla
90232d542e
Add `DuplicateImportsRule` ( #2004 )
2019-01-17 15:42:29 -08:00
JP Simard
a92c6870f0
Fix false positive in identical_operands ( #2565 )
2019-01-17 13:57:51 -08:00
azure-pipelines[bot]
a0e6d31744
Set up CI with Azure Pipelines ( #2563 )
...
* Remove `circle.yml`
* Update readme badge to Azure Pipelines
2019-01-16 16:52:16 -08:00
JP Simard
567c531473
Add empty changelog section
2019-01-16 14:47:25 -08:00
JP Simard
0328f83db1
release 0.29.4
2019-01-16 14:29:24 -08:00
JP Simard
ddc1ffd9b6
Move changelog entry
2019-01-16 14:17:28 -08:00
Xaver Lohmüller
7b00a110a0
Fix line_length violation a different way
2019-01-16 14:16:56 -08:00
Xaver Lohmüller
0badea7cd1
Change termination condition
2019-01-16 14:16:56 -08:00
Xaver Lohmüller
e032d14384
Update CHANGELOG.md
2019-01-16 14:16:56 -08:00
Xaver Lohmüller
3e655411b3
Update Rules.md
2019-01-16 14:16:56 -08:00
Xaver Lohmüller
88e23a9113
Replace word break with end of line match
2019-01-16 14:16:56 -08:00
Xaver Lohmüller
ed60316501
Put false positives with IdenticalOperandsRule
2019-01-16 14:16:56 -08:00
JP Simard
7d339ec782
Fix unused import correction ( #2562 )
2019-01-16 14:12:18 -08:00
Marcelo Fabri
a81d13b992
Merge pull request #2557 from marcelofabri/strong_iboutlet
...
Add strong_iboutlet opt-in rule
2019-01-14 08:32:01 -08:00
Marcelo Fabri
f8e42d81e0
Add strong_iboutlet opt-in rule
...
Fixes #2433
2019-01-13 20:53:12 -08:00
Kim de Vos
b5c5701e90
Warn when disabling non existing rules ( #2504 )
...
* Added violations when trying to disable non valid rule
* Added violations when trying to disable non valid rule
* Add changelog enty for 'superfluous_disable_command' improvement
* Uses all rule identifiers when running nonValidSuperfluousCommandViolations
* Address feedback from jpsim
* Uses all rule identifiers when running nonValidSuperfluousCommandViolations
* Address more feedback from jpsim
* Added customRuleIdentifiers when verifying undefinedSuperfluousCommandViolations
* Catch all invalid disable commands in a region
Not just the first one.
* Rename test
2019-01-13 15:10:44 -08:00
JP Simard
0e01e07326
#2441 - Fix inaccessible custom rules in nested configurations ( #2556 )
...
* #2441 - Pass custom rules identifiers to the enableRules function to consider custom rules of a parent of a nested configuration
* #2441 - Add custom rules merge
* #2441 - Fix line length violation
* #2441 - Add nested configutaion mocks with custom rules
* #2441 - Add nested configurations tests for custom rules
* #2441 - Disable function body length check
* #2441 - Update changelog
* Move changelog to appropriate position
* Split up and refactor Configuration.init to avoid being too long
* Add tests to LinuxMain.swift
* Remove redundant protocol conformances
Hashable implies Equatable
* Fix typo in changelog entry and add another fixed issue URL
2019-01-13 15:07:27 -08:00
JP Simard
e102389742
Add empty changelog section
2019-01-07 16:44:19 -08:00
JP Simard
bd0f78a501
release 0.29.3
2019-01-07 16:30:54 -08:00
Norio Nomura
18b410baf6
Merge pull request #2546 from realm/nn-static-string-imitator
...
Stop using `StaticString.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:)`
2019-01-07 11:04:37 +09:00
Norio Nomura
b8296cb09a
Stop using `StaticString.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:)`
...
Since that can not be callable in Swift 5.
2019-01-07 10:37:53 +09:00
Marcelo Fabri
74abfc93a6
Merge pull request #2543 from BenStaveleyTaylor/issue_2538
...
Issue 2538: vertical_whitespace_between_cases gives false warning if blank line has whitespace
2019-01-06 12:50:08 -08:00
Ben Staveley-Taylor
09c266613d
Implement review changes
...
Add new nonTriggeringExample for testing, with trailing spaces
2019-01-06 16:21:51 +00:00
Marcelo Fabri
8b11489704
Merge pull request #2545 from marcelofabri/unused_control_flow_label
...
Add unused_control_flow_label rule
2019-01-06 01:45:52 -08:00
JP Simard
0a42e64de0
Fix order in which corrections are applied
...
They're already ordered last to first in the file from the sorting
applied in `violationRanges(in file:)`
2019-01-05 21:33:42 -08:00
JP Simard
135a997c9c
Re-use bridged string
...
and inline firstToken(afterByteOffset:)
2019-01-05 21:30:58 -08:00
Marcelo Fabri
41868b35cb
Improvements on unused_control_flow_label correction
2019-01-05 19:21:18 -08:00
JP Simard
eb8f398683
Add shitty implementation of correction
2019-01-05 19:11:39 -08:00
Marcelo Fabri
d863fc9fb7
Add unused_control_flow_label rule
...
Fixes #2227
2019-01-05 18:59:32 -08:00
Ben Staveley-Taylor
c4e01a3ec4
Update CHANGELOG.md
2019-01-05 16:17:52 +00:00
Ben Staveley-Taylor
de3a24008f
Fix false positives on vertical_whitespace_between_cases
...
Fixes #2538
2019-01-05 16:00:32 +00:00
Marcelo Fabri
9f7aa1496c
Merge pull request #2540 from marcelofabri/bugfix-2539
...
Fix false positives on `redundant_objc_attribute` rule when using nested types
2019-01-03 21:46:04 -08:00
Marcelo Fabri
91f37afcd1
Remove unused declaration
2019-01-03 02:02:32 -08:00
Marcelo Fabri
d08b3888ad
Add missing ↓ on triggering example
2019-01-03 01:53:07 -08:00
Marcelo Fabri
0c92b948a9
Warn on private declaration inside @objc extension
2019-01-03 01:48:08 -08:00
Marcelo Fabri
972bb0d347
Fix false positives on `redundant_objc_attribute` rule when using nested types
...
Fixes #2539
2019-01-03 00:57:15 -08:00
Marcelo Fabri
5de042b2ee
Merge pull request #2534 from marcelofabri/bugfix-2533
...
Fix false positives on sorted_first_last with Realm
2018-12-25 20:22:55 -08:00
Marcelo Fabri
eafd98971d
Fix false positives on sorted_first_last with Realm
...
Fixes #2533
2018-12-25 19:25:53 -08:00
Marcelo Fabri
461f6a77af
Merge pull request #2531 from marcelofabri/last-where-rule
...
Add last_where opt-in rule
2018-12-25 19:23:29 -08:00
Marcelo Fabri
4b12e08731
Fix false positives on Realm collections
2018-12-25 18:41:53 -08:00
Marcelo Fabri
506e3086ba
Enable last_where on SwiftLint
2018-12-25 18:12:26 -08:00
Marcelo Fabri
c17e269cee
Add last_where opt-in rule
2018-12-25 01:34:42 -08:00
JP Simard
61a5daa073
Fix false positives in UnusedPrivateDeclarationRule ( #2530 )
2018-12-24 12:55:17 -08:00
Marcelo Fabri
4653c4a3b7
Merge pull request #2528 from marcelofabri/xct_specific_matcher
...
Adds xct_specific_matcher opt-in rule
2018-12-24 02:46:46 -08:00
Marcelo Fabri
0cc6ccfcf5
Remove unneeded import
2018-12-24 01:36:57 -08:00
Marcelo Fabri
187278feb2
Enable xct_specific_matcher on SwiftLint
2018-12-24 01:04:42 -08:00
Marcelo Fabri
e6ee8f7145
Fix violations after rebase
2018-12-24 01:04:25 -08:00
Marcelo Fabri
c9ea5a5406
Fix entry position in CHANGELOG
2018-12-24 01:02:00 -08:00
Ornithologist Coder
13d51e7b4c
Rebase and remove file headers
2018-12-24 01:01:12 -08:00
Ornithologist Coder
8c7a0e0499
Sets min. Swift version to 4.1
2018-12-24 01:01:12 -08:00
Ornithologist Coder
a18e093144
Updates changelog after 0.25.1 release
2018-12-24 01:01:12 -08:00
Ornithologist Coder
6f668a6087
Uses compactMap instead of flatMap
2018-12-24 01:01:11 -08:00
Ornithologist Coder
88b10f84a9
Updates changelog after git rebase
2018-12-24 01:01:11 -08:00
Ornithologist Coder
488488ef0d
Prepare for SR-5717 apple/swift#11542
2018-12-24 01:01:11 -08:00
Ornithologist Coder
fb179a9760
Uses offset/length instead of bodyOffset/bodyLength
2018-12-24 01:01:11 -08:00
Ornithologist Coder
e37baf106c
Handles optinals when argument is true/false
2018-12-24 01:01:11 -08:00
Ornithologist Coder
237c7eeef1
Rebases and remove duplicate tests
2018-12-24 01:01:11 -08:00
Ornithologist Coder
fd9c9f5fa5
Updates readme file after rebasing
2018-12-24 01:01:11 -08:00
Ornithologist Coder
8e4e68fe13
Removes tests SwiftLint already takes care of
2018-12-24 01:01:11 -08:00
Ornithologist Coder
3c30d6f519
Renames variables
2018-12-24 01:01:11 -08:00
Ornithologist Coder
22a21c8fe1
Renames variable
2018-12-24 01:01:11 -08:00
Ornithologist Coder
4b391d188d
Moves validation to guard statement
2018-12-24 01:01:11 -08:00
Ornithologist Coder
e497f63fe0
Adds additional tests for the reasons
2018-12-24 01:01:11 -08:00
Ornithologist Coder
6d60d03fca
Moves tests to its own file
2018-12-24 01:01:11 -08:00
Ornithologist Coder
8bf9e7fb29
Adds additional examples
2018-12-24 01:01:11 -08:00
Ornithologist Coder
ba31336cb3
Uses AST instead of regular expressions
2018-12-24 01:01:11 -08:00
Ornithologist Coder
a9a2927814
Simplifies the regular expressions
...
but... removes the validation when the call has a message.
2018-12-24 01:01:11 -08:00
Ornithologist Coder
b760ef2362
Adds more examples
2018-12-24 01:01:11 -08:00
Ornithologist Coder
74bb9150fd
Improves regular expressions
2018-12-24 01:01:11 -08:00
Ornithologist Coder
96c434e21a
Adds xct_specific_matcher opt-in rule
2018-12-24 01:01:11 -08:00
Marcelo Fabri
9b19230a1e
Merge pull request #2527 from marcelofabri/discouraged_object_literal-configuration
...
Add configuration to discouraged_object_literal
2018-12-23 23:56:10 -08:00
Marcelo Fabri
4fa417e06f
Add configuration to discouraged_object_literal
...
Fixes #2439
2018-12-23 23:00:08 -08:00
JP Simard
3d211a4270
Add empty changelog section
2018-12-23 20:46:46 -08:00
JP Simard
a21a8b3344
release 0.29.2
2018-12-23 20:32:25 -08:00
Timofey Solonin
735567dcb4
Make modifier_order rule autocorrectable ( #2521 )
...
* #2353 - Move violating modifiers search to a private function
* #2353 - Add offset and length to the ModifierDescription
* #2353 - Make modifier_oder rule correctable
* #2353 - Add modifier_oder rule correction tests
* #2353 - Upadte the changelog
* #2353 - Add missing Foundation import
* #2353 - Fix linux tests
* Small edits to ModifierOrderRule and changelog entry
2018-12-23 19:53:38 -08:00
JP Simard
e6ff3521c8
Run analyze on CI with --strict ( #2524 )
...
and whitelist two intentional violations
2018-12-23 18:22:41 -08:00
JP Simard
6b78eb4b60
Add glob tests to LinuxMain.swift
2018-12-23 16:56:49 -08:00
JP Simard
ce8ea70492
Stringify swiftlint_version ( #2523 )
...
to treat any specified value that doesn't match the version string
to fail the lint.
2018-12-23 16:29:42 -08:00
Maksym Grebenets
46aed849d6
Support glob patterns without the star ( #2508 )
...
Enables use of '[abc]', '?' and '[a-z]' glob syntax without the need to use '*' in the pattern.
2018-12-23 16:02:42 -08:00
JP Simard
af14fb25f0
Run DocumentationTests on Linux
...
Used to terminate on Linux but was fixed in
https://github.com/apple/swift-corelibs-foundation/pull/1225
2018-12-23 15:11:18 -08:00
Kim de Vos
5da6028054
Convert rule examples to multiline string literals ( #2506 )
2018-12-23 15:11:03 -08:00
JP Simard
2d0d56985f
Clean up CryptoSwift references ( #2522 )
...
* Clean up CryptoSwift references
* Add a changelog entry
* Remove unused import
2018-12-20 10:59:49 -08:00
Yonas Kolb
bf5adc295f
Update Mint installation instructions ( #2514 )
...
* Update README.md
* Update README_KR.md
2018-12-17 15:55:39 -08:00
Kim de Vos
3f081b2a70
Allow private objc classes in private_unit_test ( #2505 )
2018-12-06 09:15:22 -08:00
Kim de Vos
d62e187b5c
Add Legacy Hashing rule ( #2496 )
2018-12-05 15:43:39 -08:00
Marcelo Fabri
742591d8bc
Update entry link to link to issue instead of PR
2018-12-04 22:49:30 -08:00
dirtydanee
58a54db21b
Fix non accessible declarations under @objcMembers ( #2501 )
...
* Fix non accessible declarations under @objcMembers
* Refactor to avoid false optionality
* fixup changelog
2018-12-04 22:47:07 -08:00
Niil Öhlin
cdbf50e753
Improve performance for unused_import and unused_private_declaration
2018-12-02 21:48:40 -08:00
JP Simard
0e862ca9c4
Enable vertical whitespace rules in SwiftLint
...
and fix violations
2018-12-02 14:01:23 -08:00
JP Simard
7afd7ccaf8
Rename cleanedKeysDict() to removingViolationMarkers()
2018-12-02 13:52:41 -08:00
Cihat Gündüz
89c88517e1
Vertical whitespace opening & closing braces ( #2291 )
...
* Add VerticalWhitespaceOpening/ClosingBraces rules with description
* Implement validate, correct & add rules to lists
* Fix minor issues & update docs
* Fix copy & paste issue
* Improve autocorrection + Cleanup triggering examples
* Update changelog with new rule entries
* Add more validation examples
* [CHANGELOG.md] Mark new rules as opt-in
* Point to exact location of violation + update tests
* Make rules severity configurable
* Fix issues after rebasing
* Fix issue with CHANGELOG.md
* Add more violating examples, improve pattern to catch more cases
* Move changelog entries to new version
* Fix issues after rebase
* Move Changelog entry to current master
* Fix failing tests
* Fixes after refactoring
* Fix changelog entry position
* Make range unicode-safe (as suggested by @jpsim)
* Share duplicate Dictionary extension code
2018-12-02 13:41:50 -08:00
JP Simard
c3d23ea771
release 0.29.1
2018-11-29 14:28:21 -08:00
Kim de Vos
5400a5e3d2
Fixed correct name 🤦♂️ ( #2493 )
2018-11-29 13:05:40 -08:00
Kim de Vos
bf97e08fa7
Exit immediately when linting with a version other than swift_version if defined ( #2491 )
2018-11-29 12:40:29 -08:00
JP Simard
a855ac27b0
Fix false positives and invalid corrections with unused import rule ( #2492 )
...
* Fix wrong correction when removing testable imports with UnusedImportRule
* Fix false positive with UnusedImportRule when importing Foundation when there are attributes in that file requiring Foundation.
* Update rules documentation
* Add changelog entries
2018-11-29 10:55:26 -08:00
Timofey Solonin
efa68177b2
#2435 - Make modifier_order rule rely on an explicit set of rules ( #2458 )
...
* #2435 - Adjust modifier_order rule to require explicit modifier order specified to conclude a violation
* #2435 - Move modifier order rule examples to a separate file
* #2435 - Add modifier interference tests
* #2435 - Fix whitespaces
* Minor edits
* Add changelog entry
2018-11-28 15:10:49 -08:00
JP Simard
b66446c05f
Fix changelog entry position
2018-11-28 13:43:34 -08:00
Jim Hildensperger
c3d72c2442
Only mark custom rules as enabled in your config when custom rules are configured.
2018-11-28 13:42:11 -08:00