Commit Graph

231 Commits

Author SHA1 Message Date
JP Simard 53d8a3aba9 Add UnusedPrivateDeclarationRule (#2385)
* Add UnusedPrivateDeclarationRule

* Temporarily disable UnusedPrivateDeclarationRule tests on Xcode 10

So we can merge UnusedPrivateDeclarationRule without having to wait
for CircleCI to update its Xcode 10 version.
2018-09-05 21:59:45 -07:00
JP Simard e460c5ef9c Add Unused Import analyzer rule (#2381) 2018-09-02 14:45:02 -07:00
JP Simard 2bcea4b04d Add ability for SwiftLint to lint files with full type-checked AST awareness (#2379)
* Add LintableFilesVisitor

* Move LintCommand logic into LintOrAnalyzeCommand

to prepare for the upcoming analyze command

* Add AnalyzeCommand (not fully implemented yet in SwiftLintFramework)

* Add analyzerRules configuration member

* Add AnalyzerRule protocol

* Pass compiler arguments to validate/correct

* Add requiresFileOnDisk member to RuleDescription

This will be used by AnalyzerRules because they need a file on disk
to pass in the compiler arguments to SourceKit.

* Exclusively run AnalyzerRules when the Linter has compiler arguments

* Enable testing AnalyzerRules in TestHelpers

* Add ExplicitSelfRule

* Update documentation

* Fix `analyze --autocorrect`

* Improve performance of CompilerArgumentsExtractor

* Fix lint command actually running analyze

* Move File operations in TestHelpers into a private extension

* Add analyzer column to rules command and markdown documentation

* Use a Set literal

* Make AnalyzerRule inherit from OptInRule

* Mention analyzer_rules in readme

* Mention that analyzer rules are slow
2018-09-02 00:13:27 -07:00
Dalton Claybrook b2babd0498 Update Rules.md with latest changes to Toggle Bool rule 2018-08-30 17:19:19 -04:00
Dalton Claybrook 585b9ab950 Fix incorrect triggering markers 2018-08-30 15:55:52 -04:00
Dalton Claybrook f70cb75680 Add Toggle Bool rule to Rules doc 2018-08-30 10:47:45 -04:00
Marcelo Fabri 53647b4e6e Add inert_defer rule
Fixes #2123
2018-08-26 03:10:16 -07:00
Marcelo Fabri 04b634cde7 Add prohibited_interface_builder opt-in rule
Fixes #2365
2018-08-25 22:53:15 -07:00
Marcelo Fabri 881978ea26 Fix crash on multiline_function_chains rule
Fixes #2360
2018-08-23 21:10:56 -07:00
Marcelo Fabri 5c9b6b9c62 Merge pull request #2342 from ornithocoder/closure_length
Adds closure_body_length opt-in rule
2018-08-09 07:55:49 -07:00
Marcelo Fabri 30fe00890c Fix comma rule false positives on object literals
Fixes #2345
2018-08-08 08:47:17 -07:00
Ornithologist Coder c4bf3dee10 Adds closure_body_length opt-in rule
because closure bodies should not span too many lines. Implements #52.
Requires Swift 4.2.
2018-08-07 00:13:50 +02:00
Marcelo Fabri f7f3f3dee5 Merge pull request #2318 from mattremmel/nef10_missing_docs
Added back 'missing_docs' (Nef10)
2018-07-30 00:05:05 -07:00
Cihat Gündüz b4f960bd48 Add config option allow_redundancy 2018-07-27 11:12:46 +02:00
Cihat Gündüz d616282892 Add failing test for false positive in rule explicit_type_interface 2018-07-27 11:12:46 +02:00
Marcelo Fabri 8197236995 Fix autocorrection for redundant_type_annotation
Fixes #2314
2018-07-26 07:54:35 -07:00
Matthew Remmel 89adc4224c Patch created from Nef10 (https://github.com/Nef10/SwiftLint.git) missing_docs branch, to remove merge commits that were preventing merging the PR (https://github.com/realm/SwiftLint/pull/2172) 2018-07-25 11:34:53 -04:00
Marcelo Fabri f2d14e7c5a redundant_optional_initialization rule now lints local variables
Fixes #2233
2018-07-21 21:35:24 -07:00
Marcelo Fabri 90a2134a18 Merge pull request #2239 from sjavora/master
Opt-in rule to check for redundant type annotations
2018-07-19 08:24:51 -07:00
Ornithologist Coder 95fb5ab759 Change minimum Swift compiler version to 4.1
Because it doesn't work on Swift 4.0 for Linux.
2018-07-11 08:39:48 +02:00
Ornithologist Coder b6698c0da4 Fix Linux build 2018-07-11 08:39:48 +02:00
Ornithologist Coder c5dd67e433 Make anyobject_protocol opt-in 2018-07-11 08:39:41 +02:00
Ornithologist Coder 9f3cb13389 Add @objc example 2018-07-08 09:50:52 +02:00
Ornithologist Coder e8d3d1c08e Make anyobject_protocol correctable 2018-07-07 21:15:57 +02:00
Ornithologist Coder 2161515d36 Set minimum Swift compiler version to 4 2018-07-07 19:22:10 +02:00
Ornithologist Coder ec06fe6e82 Change the place where the violation is triggered 2018-07-07 19:01:55 +02:00
Ornithologist Coder 01dc00f576 Add default rule anyobject_protocol
This commit implements #2283.
2018-07-07 18:54:09 +02:00
Marcelo Fabri b168296d07 Fix generic_type_rule when using Swift 4.2 2018-06-24 00:20:50 -07:00
Marcelo Fabri 82f3362d78 Fix identifier_name rule when using Swift 4.2
Fixes #2231
2018-06-23 22:49:06 -07:00
Allen Wu abe3dd01c5 Fix ControlStatement rule failing to apply when clauses contain commas 2018-06-23 15:15:36 -07:00
Marcelo Fabri 1d28025789 Add convenience_type opt-in rule
Fixes #1871
2018-06-16 21:08:49 -07:00
Anders Hasselqvist 58202772d3 Support placeholder for forbidden_pattern
- Move regex creation for *_pattern to FileHeaderConfiguration
- Switch to using test fixures for the tests
2018-06-13 19:55:27 +09:00
Austin Belknap e6517d9a2b Fix Rules.md entries. 2018-06-11 09:47:30 -07:00
Austin Belknap 723a1f9004 Find the correct case colon. 2018-06-11 09:30:19 -07:00
Austin Belknap d2981d779f Fix XCode build issues. 2018-06-11 09:30:19 -07:00
Austin Belknap 1fdc5fda94 Add "No Fallthrough Only" Rule. 2018-06-11 09:30:19 -07:00
Eric Horacek 97dbf5dd40 Update README 2018-06-10 19:49:03 -07:00
Eric Horacek 56827ac0f3 Fix crashes 2018-06-10 19:49:03 -07:00
Eric Horacek 7b8c97ad02 Add multiline function chain rule
See #2214
2018-06-10 19:49:03 -07:00
Šimon Javora 96c1422f23 Added a rule to check for redundant type annotations. 2018-06-10 11:28:33 +02:00
Marcelo Fabri 6e987a763e Fix a false positive in unused_closure_parameter rule
Fixes #2062
2018-06-02 20:56:24 -07:00
JP Simard 2f287ef3e7 Merge pull request #2208 from erichoracek/eh--mark-autocorrection-improvements
Improve mark rule autocorrection
2018-05-30 13:46:34 +10:00
Daniel Metzing d12919a076 Making UntypedErrorInCatchRule correctable 2018-05-22 22:23:23 +02:00
Marcelo Fabri f2297d7387 Fix false positives in prohibited_super_call rule
Fixes #2212
2018-05-21 20:50:34 -07:00
Marcelo Fabri 09061b05c3 Fix false positives in attributes rule when @testable is used
Fixes #2211
2018-05-20 12:04:40 -07:00
Eric Horacek 139df3d612 Improve mark rule autocorrection
Adds a few additional cases for the MARK rule to autocorrect.

In our project, this made it so that the all MARK rule failures were corrected automatically. Before this change, we had over 30 failures that could not be autocorrected.
2018-05-16 11:08:24 -07:00
Marcelo Fabri 7a0f07c664 Mention #1341 on CHANGELOG
Fix #1341
2018-05-15 22:33:04 -07:00
JP Simard 24ec44d288 Add file_name opt-in rule
validating that file names contain the name of a
type or extension declared in the file (if any).
2018-05-11 22:17:39 -07:00
JP Simard 62a3b707fa Merge pull request #2185 from marcelofabri/default-params-end
Add function_default_parameter_at_end rule
2018-05-11 20:42:08 -07:00
JP Simard cfd43e3231 Merge pull request #2198 from erichoracek/eh—literal-expression-end-indentation-autocorrect
Make literal end indentation rule correctable
2018-05-11 20:41:47 -07:00