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

Kdoc fixer: not ask @return on simple delegating getters: #1022

Merged
merged 10 commits into from
Aug 11, 2021

Conversation

Cheshiriks
Copy link
Member

What's done:

### What's done:
* fixed bug in WRONG_NEWLINES
* now don't ask @return on function with name same last reference Expression
Closes #965
@codecov
Copy link

codecov bot commented Aug 2, 2021

Codecov Report

Merging #1022 (9e2a471) into master (55b5724) will decrease coverage by 0.01%.
The diff coverage is 75.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1022      +/-   ##
============================================
- Coverage     83.80%   83.79%   -0.02%     
- Complexity     2424     2428       +4     
============================================
  Files           102      102              
  Lines          6108     6114       +6     
  Branches       1809     1811       +2     
============================================
+ Hits           5119     5123       +4     
  Misses          273      273              
- Partials        716      718       +2     
Flag Coverage Δ
unittests 83.79% <75.00%> (-0.02%) ⬇️

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

Impacted Files Coverage Δ
.../ruleset/rules/chapter6/classes/DataClassesRule.kt 75.00% <ø> (ø)
.../diktat/ruleset/rules/chapter2/kdoc/KdocMethods.kt 86.61% <75.00%> (-0.89%) ⬇️

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 55b5724...9e2a471. Read the comment docs.

if (node.isSingleLineGetterOrSetter()) {
return false
}
val lastDotQualifiedExpression = node.findChildByType(DOT_QUALIFIED_EXPRESSION)?.text?.substringAfterLast('.')
Copy link
Member

Choose a reason for hiding this comment

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

foo.bar(x.prop) will yield prop) with this logic, if I understand correctly. And you need bar

### What's done:
* fixed bug in WRONG_NEWLINES
Closes #965
### What's done:
* fixed bug in WRONG_NEWLINES
Closes #965
### What's done:
* fixed bug in WRONG_NEWLINES
* now don't ask @return on function with name same last reference Expression
Closes #965
### What's done:
* fixed bug in WRONG_NEWLINES
* now don't ask @return on function with name same last reference Expression
Closes #965
return funName == lastDotQualifiedExpression
}

@Suppress("WRONG_NEWLINES")
Copy link
Member

Choose a reason for hiding this comment

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

Why did you suppress it?)

Copy link
Member Author

Choose a reason for hiding this comment

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

The Diktat merge 2 lines into one, and then breaks down on LONG_LINE

Copy link
Member

@petertrr petertrr Aug 10, 2021

Choose a reason for hiding this comment

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

Then please create an issue with a reproducer, it looks like behavior that we need to avoid

import com.pinterest.ktlint.core.ast.ElementType.ENUM_KEYWORD
import com.pinterest.ktlint.core.ast.ElementType.FUN
import com.pinterest.ktlint.core.ast.ElementType.INNER_KEYWORD
import com.pinterest.ktlint.core.ast.ElementType.INTERFACE_KEYWORD
Copy link
Member

Choose a reason for hiding this comment

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

It's not the first time that I see how diktat removes unused imports in a file, on which it hasn't complained before. Do you have any thought, why this can happen?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. We need to investigate this

Copy link
Member

Choose a reason for hiding this comment

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

Please create an issue about this too

### What's done:
* fixed bug in WRONG_NEWLINES
Closes #965
@Cheshiriks Cheshiriks merged commit bad9569 into master Aug 11, 2021
@petertrr petertrr deleted the feature/simple_delegating_getters branch May 25, 2022 09:07
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.

Kdoc fixer false-negative: not generating a Kdoc for several public functions
2 participants