Commit Graph

2587 Commits

Author SHA1 Message Date
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
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
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 652e5dd59c
release 0.36.0 2019-10-24 15:25:32 -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
MarkoPejovic 109899c56c Implement #2888 2019-10-20 19:19: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
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 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 d4ef1f0ad0 Add `flatmap_over_map_reduce` opt-in rule
Fixes #2883
2019-09-26 10:07:12 -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
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 8dc8421a49
release 0.35.0 2019-09-03 10:07:31 -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 dae7a7b193 Don't trigger `missing_docs` on extensions
Fixes #2851
2019-08-30 14:29:32 -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 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 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 00d2b5d772 Add contains_over_filter_count opt-in rule
Fixes #2803
2019-08-25 20:00:50 -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 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 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
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 7344732799 PR: Create File+Hashable, symlink Array+SwiftLint, fix nits 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
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
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