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

Rule 6.1.11 Use apply for object initialization #491

Merged
merged 9 commits into from
Nov 16, 2020

Conversation

petertrr
Copy link
Member

@petertrr petertrr commented Nov 3, 2020

What's done:

  • Added rule
  • Added tests on checks

This pull request closes #446

Actions checklist

  • Implemented Rule, added Warnings
  • Added tests on checks
  • Added tests on fixers
  • Updated diktat-analysis.yml
  • Updated available-rules.md

Fixme:

  • When assigned variable name is also a this@apply's property, it should be changed to qualified name:
    fun convertToOption(): Option {
        val resOption = Option(shortName, longName, hasArgs, helpDescr)
        resOption.isRequired = isRequired
        return resOption
// should be
    fun convertToOption() = Option(shortName, longName, hasArgs, helpDescr).apply {
        isRequired = this@CliArgument.isRequired
    }

### What's done:
* Added rule
* Added tests on checks
@codecov
Copy link

codecov bot commented Nov 3, 2020

Codecov Report

Merging #491 (06b9a5d) into master (eaa3fca) will increase coverage by 0.05%.
The diff coverage is 85.48%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #491      +/-   ##
============================================
+ Coverage     81.85%   81.90%   +0.05%     
- Complexity     1563     1576      +13     
============================================
  Files            74       75       +1     
  Lines          3912     3974      +62     
  Branches       1249     1259      +10     
============================================
+ Hits           3202     3255      +53     
- Misses          211      212       +1     
- Partials        499      507       +8     
Flag Coverage Δ Complexity Δ
unittests 81.90% <85.48%> (+0.05%) 0.00 <13.00> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
...at-rules/src/main/kotlin/generated/WarningNames.kt 0.00% <ø> (ø) 0.00 <0.00> (ø)
...tat/ruleset/rules/classes/CompactInitialization.kt 85.00% <85.00%> (ø) 13.00 <13.00> (?)
...tlin/org/cqfn/diktat/ruleset/constants/Warnings.kt 98.27% <100.00%> (+0.01%) 10.00 <0.00> (ø)
...cqfn/diktat/ruleset/rules/DiktatRuleSetProvider.kt 97.14% <100.00%> (+0.04%) 8.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eaa3fca...06b9a5d. Read the comment docs.

### What's done:
* Code style
### What's done:
* Fixing
### What's done:
* Code style
…#446

# Conflicts:
#	info/diktat-kotlin-coding-style-guide-en.md
### What's done:
* Fixes
@petertrr petertrr marked this pull request as ready for review November 9, 2020 10:06
### What's done:
* Code style
Copy link
Member

@orchestr7 orchestr7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@petertrr petertrr merged commit 7b86585 into master Nov 16, 2020
@petertrr petertrr deleted the feature/rule-6.1.11#446 branch November 16, 2020 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule 6.1.11: use apply for grouping object initialization
2 participants