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

Bugfix. Newline at the beginning of code block is not removed if there are more than one #537

Merged
merged 6 commits into from
Nov 23, 2020

Conversation

aktsay6
Copy link
Collaborator

@aktsay6 aktsay6 commented Nov 17, 2020

What's done:

  • Fixed bugs

This pull request closes #519

### What's done:
  * Fixed bugs
@aktsay6 aktsay6 added the bug Something isn't working label Nov 17, 2020
@aktsay6 aktsay6 requested review from petertrr and kentr0w November 17, 2020 09:11
@codecov
Copy link

codecov bot commented Nov 17, 2020

Codecov Report

Merging #537 (21658c0) into master (052bd9d) will increase coverage by 0.00%.
The diff coverage is 88.23%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #537   +/-   ##
=========================================
  Coverage     81.68%   81.69%           
- Complexity     1641     1665   +24     
=========================================
  Files            79       83    +4     
  Lines          4139     4211   +72     
  Branches       1307     1314    +7     
=========================================
+ Hits           3381     3440   +59     
- Misses          229      238    +9     
- Partials        529      533    +4     
Flag Coverage Δ Complexity Δ
unittests 81.69% <88.23%> (+<0.01%) 0.00 <7.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> (ø)
...lin/org/cqfn/diktat/ruleset/rules/PackageNaming.kt 93.75% <33.33%> (-1.19%) 32.00 <0.00> (ø)
...qfn/diktat/ruleset/rules/classes/SingleInitRule.kt 78.46% <100.00%> (+0.68%) 16.00 <0.00> (+6.00)
.../cqfn/diktat/ruleset/rules/files/BlankLinesRule.kt 100.00% <100.00%> (ø) 13.00 <7.00> (+1.00)
...rg/cqfn/diktat/ruleset/rules/files/NewlinesRule.kt 83.95% <100.00%> (+0.17%) 110.00 <0.00> (+6.00)
...g/cqfn/diktat/ruleset/rules/kdoc/KdocFormatting.kt 77.12% <100.00%> (-0.15%) 73.00 <0.00> (ø)
...rg/cqfn/diktat/plugin/gradle/DiktatGradlePlugin.kt 100.00% <0.00%> (ø) 2.00% <0.00%> (?%)
...n/org/cqfn/diktat/plugin/gradle/DiktatExtension.kt 100.00% <0.00%> (ø) 4.00% <0.00%> (?%)
...qfn/diktat/plugin/gradle/DiktatJavaExecTaskBase.kt 79.31% <0.00%> (ø) 5.00% <0.00%> (?%)
...main/kotlin/org/cqfn/diktat/plugin/gradle/Utils.kt 62.50% <0.00%> (ø) 0.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 090e575...21658c0. Read the comment docs.

@@ -53,7 +56,10 @@ class BlankLinesRule(private val configRules: List<RulesConfig>) : Rule("blank-l

private fun handleTooManyBlankLines(node: ASTNode) {
TOO_MANY_BLANK_LINES.warnAndFix(configRules, emitWarn, isFixMode, "do not use more than two consecutive blank lines", node.startOffset, node) {
node.leaveExactlyNumNewLines(2)
if (node.treeParent.findAllNodesWithSpecificType(WHITE_SPACE).first() == node)
Copy link
Member

Choose a reason for hiding this comment

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

Isn't findChildByType enough here?

@aktsay6 aktsay6 requested a review from petertrr November 23, 2020 11:02
@aktsay6 aktsay6 merged commit 0bf93cf into master Nov 23, 2020
@aktsay6 aktsay6 deleted the bugfix/newline-is-not-removed(#519) branch November 23, 2020 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Newline at the beginning of code block is not removed if there are more than one
2 participants