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
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
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
08816840ef
Re-add outputFilename
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
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
c338f292c3
Make shim autorelease function generic over its return value
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
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
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
94c6009fc4
Fix false positive in `function_default_parameter_at_end`
...
Fixes #2788
2019-07-04 22:25:52 -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
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
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
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
Alvar Hansen
af72c06be4
Skip module import if cursor info is missing module info ( #2746 )
2019-05-06 08:57:01 -07:00
Marcelo Fabri
a3aa36757b
Add `unowned_variable_capture` opt-in rule
...
Fixes #2097
2019-04-30 10:12:20 -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
Javier Soto
49c288eb3f
Fixed typo in `nslocalizedstring_require_bundle` rule description
2019-04-29 17:06:28 -07:00
Marcelo Fabri
d14d79d2c4
Don’t trigger redundant_void_return when using subscripts
2019-04-29 09:47:00 -07:00
JP Simard
6534946fe3
release 0.32.0
2019-04-28 21:30:19 -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
Dalton Claybrook
d0ce8b6ac8
Fix false positive in UnusedCaptureListRule ( #2726 )
2019-04-23 11:51:44 -07: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
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
Frederick Pietschmann
43e18458de
Update file headers for new sourcery version
2019-04-12 17:13:27 +02:00
Frederick Pietschmann
81abf9f3f2
Let "disable all" command override "superfluous_disable_command" rule
2019-04-12 16:27:43 +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
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
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
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
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
f54e7406d9
[nslocalizedstring_require_bundle] Implement NSLocalizedStringRequireBundleRule
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
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
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
jsloop
3d528030d6
Update documentation #2684
2019-03-27 15:14:50 +05:30
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
311965f23c
Fix issues after rebase
2019-03-27 10:34:58 +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
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
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
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
7c2e4dfd19
Add ReduceIntoRule
2019-03-24 16:22:19 -04:00
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
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
8fa2d0bcfc
Remove punctuation from anchor
2019-03-09 17:12:22 +00:00
Marcelo Fabri
6b3b89cff4
Colon rule now catches violations on generic type declarations
...
Fixes #2628
2019-03-03 20:06:13 -08: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
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
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
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
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
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
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
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
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
04ce4f8c49
[explicit_type_interface] Make sure type reference assignments are detected with allow_redundancy
2019-02-12 14:44:26 +01: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
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
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
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
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
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
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
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
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
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
b2d428a4e2
release 0.30.1
2019-01-23 11:08:50 -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
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
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