Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve autofix in AVOID_NULL_CHECKS rule #899

Closed
petertrr opened this issue May 26, 2021 · 0 comments · Fixed by #1201
Closed

Improve autofix in AVOID_NULL_CHECKS rule #899

petertrr opened this issue May 26, 2021 · 0 comments · Fixed by #1201
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@petertrr
Copy link
Member

Describe the bug

  • val x = if (y != null) f(y) else g(y) should be simplified to val x = y?.let { f(y) } ?: g(y) without an additional run
  • val x = if (y != null) y else z should be simplified to val x = y ?: z, without any let or run

Environment information

  • diktat version: 0.5.3
@petertrr petertrr added the enhancement New feature or request label May 26, 2021
@orchestr7 orchestr7 added this to the 1.0.6 milestone Jan 26, 2022
sanyavertolet pushed a commit that referenced this issue Jan 31, 2022
### What's done:
 * improved autofix: now we don't use `let` and `run` in some cases
 * added tests

(#899)
sanyavertolet pushed a commit that referenced this issue Jan 31, 2022
### What's done:
 * improved autofix: now we don't use `let` and `run` in some cases
 * added tests

(#899)
sanyavertolet pushed a commit that referenced this issue Jan 31, 2022
### What's done:
 * improved autofix: now we don't use `let` and `run` in some cases
 * added tests

(#899)
sanyavertolet pushed a commit that referenced this issue Jan 31, 2022
### What's done:
 * improved autofix: now we don't use `let` and `run` in some cases
 * added tests

(#899)
sanyavertolet added a commit that referenced this issue Mar 9, 2022
* Improve autofix in AVOID_NULL_CHECKS rule

### What's done:
 * improved autofix: now we don't use `let` and `run` in some cases
 * added tests

(#899)

* Improve autofix in AVOID_NULL_CHECKS rule

### What's done:
 * improved autofix: now we don't use `let` and `run` in some cases
 * added tests

(#899)

* Improve autofix in AVOID_NULL_CHECKS rule

### What's done:
 * improved autofix: now we don't use `let` and `run` in some cases
 * added tests

(#899)

* Improve autofix in AVOID_NULL_CHECKS rule

### What's done:
 * improved autofix: now we don't use `let` and `run` in some cases
 * added tests

(#899)

* Improve autofix in AVOID_NULL_CHECKS rule

### What's done:
 * improved autofix: now we don't use `let` and `run` in some cases
 * added tests

(#1149)

* Improve autofix in AVOID_NULL_CHECKS rule

### What's done:
 * improved autofix: now we don't use `let` and `run` in some cases
 * improved autofix: now we count statements, not lines
 * added tests

(#1201)

* Improve autofix in AVOID_NULL_CHECKS rule

### What's done:
 * improved autofix: now we don't use `let` and `run` in some cases
 * improved autofix: now we count statements, not lines
 * added tests

(#1201)

* Improve autofix in AVOID_NULL_CHECKS rule

### What's done:
 * improved autofix: now we don't use `let` and `run` in some cases
 * improved autofix: now we count statements, not lines
 * added tests

(#1201)

Co-authored-by: sanyavertolet <[email protected]>
Co-authored-by: Andrey Kuleshov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants