Commit Graph

219 Commits

Author SHA1 Message Date
Mikhail Glukhikh 76d1d6ff12 Allow to move suspend lambda out of parentheses
#KT-26674 Fixed
#KT-26676 Fixed
2018-09-13 16:38:29 +03:00
Roman Elizarov e2713501ce Rename SuccessOrFailure to Result and hide Failure from ABI
* The members of Result are isSuccess, isFailure, exceptionOrNull, getOrNull
* The rest of API is implemented via inline-only extensions
* There are two internal functions to hide detailed mechanics of an internal
  Result.Failure class: createFailure and throwOnFailure
* Result.toString is explicit: either Success(v) or Failure(x)

See KT-26538
2018-09-09 11:34:31 +03:00
Toshiaki Kameyama 1d2e18e263 SimplifyCallChainFix: Keep comments in place #KT-22552 Fixed 2018-09-07 17:26:15 +03:00
Mikhail Glukhikh 485e098ced Handle implicit receivers more accurately in if-then to safe access
#KT-26599 Fixed
2018-09-07 17:24:19 +03:00
Mikhail Glukhikh dead2516c2 Redundant override inspection: don't report for ambiguous derivation
#KT-24405 Fixed
#KT-25883 Fixed
2018-09-07 16:32:11 +03:00
Toshiaki Kameyama be30761ec4 "Convert to 'also'" intention: Fix for call expression has this receiver #KT-26009 Fixed 2018-09-04 19:29:44 +03:00
Toshiaki Kameyama b5ba475696 "Redundant lambda arrow" inspection: Also report arrow with single underscore parameter #KT-24728 Fixed 2018-09-04 18:29:46 +03:00
Toshiaki Kameyama 53c10238d6 Introduce inspection for safe cast + return #KT-26230 Fixed 2018-08-31 15:03:25 +03:00
Toshiaki Kameyama 2c71b3873e Introduce "flatMap { it } -> flatten" inspection #KT-25969 Fixed 2018-08-31 15:03:24 +03:00
Toshiaki Kameyama bae754a266 Foldable if-then: do not highlight for is checks #KT-24978 Fixed 2018-08-30 18:30:45 +03:00
Toshiaki Kameyama fba539debf "Nested lambda has shadowed implicit parameter": minor improvements 2018-08-30 17:37:36 +03:00
Toshiaki Kameyama b7c4248524 "Nested lambda has shadowed implicit parameter": add quickfix to rename shadowing 'it' 2018-08-30 17:37:36 +03:00
Toshiaki Kameyama 97150cb0e2 "Nested lambda has shadowed implicit parameter": show warning on the shadowing 'it' reference 2018-08-30 17:37:36 +03:00
Toshiaki Kameyama 7800f42840 "Nested lambda has shadowed implicit parameter": Do not report if 'it' paramerter is not used #KT-26268 Fixed 2018-08-30 17:37:36 +03:00
Toshiaki Kameyama 6a140fb9ed "Useless call on collection type" inspection: Apply to 'kotlin.sequences.orEmpty' 2018-08-30 14:50:56 +03:00
Toshiaki Kameyama ae4ff45750 "Remove redundant let" inspection: do not report for long call chains #KT-26289 Fixed 2018-08-27 13:42:25 +03:00
Toshiaki Kameyama b34f32d4f3 "Remove redundant backticks": Fix false positive for yield #KT-25968 Fixed 2018-08-27 13:10:57 +03:00
kenji tomita e59427edab Fix false positive for if-else 2018-08-27 12:53:35 +03:00
Mikhail Glukhikh c12f29ae30 Enhance inspection about SuccessOrFailure (related to KT-25621)
Increase performance by searching first SuccessOrFailure/runCatching/etc
in text of functions without return type.
Remove stdlib false positives, like success() & failure().
For catching extension, check also non-catching members.
Add "rename to *Catching" fix.
2018-08-24 18:00:46 +03:00
Mikhail Glukhikh 7a2d0a3bb2 Add inspection "Redundant runCatching {}" (related to KT-25621) 2018-08-24 18:00:44 +03:00
Mikhail Glukhikh 2084e94099 Add quick-fix "add .getOrThrow()" for SuccessOrFailure inspection
#KT-25621 Fixed
2018-08-24 18:00:42 +03:00
Mikhail Glukhikh 023b1b1880 Shorten quick-fix text of "Redundant async" #KT-25712 Fixed 2018-08-23 18:35:01 +03:00
Mikhail Glukhikh 5b77def0e0 "if-then to safe access": treat transformation to 'let' as intention
Related to KT-7675
2018-08-15 12:36:01 +03:00
Toshiaki Kameyama f5cfec4a91 "if-then to safe access" inspection: support call expression -> let
#KT-7675 Fixed
2018-08-15 12:36:01 +03:00
Toshiaki Kameyama 2dcbf6aa34 Introduce "Redundant return label" inspection #KT-25270 Fixed 2018-08-15 12:36:01 +03:00
Toshiaki Kameyama b91f30ab15 Suspicious callable reference: no quick fix with invalid reference type
#KT-23467 Fixed
2018-08-15 12:36:00 +03:00
Toshiaki Kameyama 2bf3b435f2 Redundant semicolon: fix false positive between modifier and declaration
#KT-25579 Fixed
2018-08-14 15:32:26 +03:00
kenji tomita 443b1834bc Add "Replace assertBoolean() with assertEquals() inspection"
#KT-23445 Fixed
2018-08-14 14:11:14 +03:00
Mikhail Glukhikh 911f16845e For each parameter unused: add quick-fix "introduce anonymous parameter"
Related to KT-22068
2018-08-13 19:03:01 +03:00
Mikhail Glukhikh 6048647812 For each parameter unused: support correctly it() case
Related to KT-22068
2018-08-13 19:02:58 +03:00
Toshiaki Kameyama f2fec6b078 Fix messages #KT-25177 2018-08-09 15:24:20 +03:00
Toshiaki Kameyama 605736b6ba Introduce "redundant asDynamic" inspection #KT-25177 Fixed 2018-08-09 15:24:20 +03:00
Mikhail Glukhikh 87d81a75f3 Fix secondary constructor deletion in "sealed class -> object" 2018-08-09 13:33:03 +03:00
Toshiaki Kameyama 7e28cb1fe3 Call chain --> Sequence: take termination into account
Related to KT-15476
2018-08-08 11:02:47 +03:00
Toshiaki Kameyama 108dea5b46 Introduce "Call chain on collection should be converted into 'Sequence'"
So #KT-15476 Fixed
2018-08-08 10:29:10 +03:00
Natalia Selezneva be2d4964fd Fix testData, add script-runtime 2018-08-03 15:25:35 +03:00
Toshiaki Kameyama 1ac6f18a47 "Convert put to assignment": Fix false positive inside elvis expression
So #KT-22072 Fixed
2018-08-03 13:21:50 +03:00
Toshiaki Kameyama a059d50c8f "Call chain may be simplified": fix false positive on Java Map
So #KT-25089 Fixed
2018-08-03 13:15:53 +03:00
Toshiaki Kameyama 4c34ced1fa Introduct "Redundant 'with' call" inspection #KT-6633 Fixed 2018-08-02 09:23:27 +03:00
Mikhail Glukhikh cc1d9e88d5 1.3 migration: make inspections working for non-experimental coroutines 2018-07-24 10:24:18 +03:00
Toshiaki Kameyama 3e207fd6b2 Move lambda out: don't apply to multiple/default functional parameters
So #KT-24694 Fixed
2018-07-23 18:21:37 +03:00
Toshiaki Kameyama a9c91099a4 Correct "Redundant override" inspection message #KT-25608 Fixed 2018-07-23 18:21:37 +03:00
Dmitry Petrov acf0bb349c Update testData for restricted expression annotations retention 2018-07-20 10:39:51 +03:00
Nikolay Krasko 1973860e70 Indent content of when (KT-14066)
#KT-14066 Fixed
2018-06-22 19:19:12 +03:00
kenji tomita 817d75a47f Introduce ReplaceToStringWithStringTemplateInspection #KT-13782 Fixed 2018-06-20 17:18:17 +03:00
Toshiaki Kameyama 6675d7814c KT-14779 Inspection to replace String.format with string templates (#1645)
* Add inspection to replace String.format with string templates #KT-14779 Fixed

* KT-14779 Fixed
2018-06-20 16:23:04 +03:00
Toshiaki Kameyama e41a34af88 KT-11850 Add nested lambdas with implicit parameters warning (#1664)
* Add `Nested lambda has shadowed implicit parameter` inspection #KT-11850 Fixed

* KT-11850 Fixed
2018-06-20 15:57:03 +03:00
Toshiaki Kameyama 69d2e8898a "Main should return Unit" inspection: extend on JUnit test methods
So #KT-24509 Fixed
2018-06-19 12:48:11 +03:00
Toshiaki Kameyama 5ad98a139d "Redundant Companion": Don't suggest if same callable name is in use
So #KT-24425 Fixed
2018-06-19 12:48:10 +03:00
Mikhail Glukhikh 9ef89447b3 Sealed sub-class -> object: handle equals, suggest "add equals"
Before this commit, sealed sub-class without state was considered
a style issue.
After this commit, sealed sub-class without state AND custom equals
is considered a probable bug,
because comparison of its instances is very fragile.
Alternative fix (generate equals & hashCode by identity) is added.
2018-06-19 11:20:26 +03:00