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

Assertion failed: anchorBefore == null || anchorBefore.getTreeParent() == parent in rule [kdoc-formatting] #1489

Closed
petertrr opened this issue Aug 4, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@petertrr
Copy link
Member

petertrr commented Aug 4, 2022

Describe the bug

package com.saveourtool.save.reporter.json

/**
 * Reporter that produces a JSON report as a [Report]
 *
 * @property out a sink for output
 *
 * @param builder additional configuration lambda for serializers module
 */
class JsonReporter(
    override val out: BufferedSink,
    builder: PolymorphicModuleBuilder<Plugin.TestFiles>.() -> Unit = {}
) : Reporter

Observed behavior

Run gradlew diktatFix on this piece of code.

java.lang.AssertionError: Assertion failed: anchorBefore == null || anchorBefore.getTreeParent() == parent
	at org.jetbrains.kotlin.com.intellij.openapi.diagnostic.DefaultLogger.error(DefaultLogger.java:57)
	at org.jetbrains.kotlin.com.intellij.openapi.diagnostic.Logger.error(Logger.java:187)
	at org.jetbrains.kotlin.com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:201)
	at org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.CompositeElement.addChild(CompositeElement.java:571)
	at org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocFormatting$checkBasicTagsOrder$2.invoke(KdocFormatting.kt:232)
	at org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocFormatting$checkBasicTagsOrder$2.invoke(KdocFormatting.kt:217)
	at org.cqfn.diktat.ruleset.constants.Warnings.warnAndFix(Warnings.kt:266)
	at org.cqfn.diktat.ruleset.constants.Warnings.warnAndFix$default(Warnings.kt:208)
	at org.cqfn.diktat.ruleset.rules.chapter2.kdoc.KdocFormatting.checkBasicTagsOrder(KdocFormatting.kt:217)
...

Environment information

  • diktat version: 1.2.3
  • build tool (maven/gradle): gradle
@petertrr petertrr added the bug Something isn't working label Aug 4, 2022
@0x6675636b796f75676974687562
Copy link
Member

Apparently, the problem was either present for almost as long as the check exists (ce7e810), or was caused by a somewhat later change (6843299).

icemachined added a commit that referenced this issue Sep 13, 2022
icemachined added a commit that referenced this issue Sep 14, 2022
icemachined added a commit that referenced this issue Sep 14, 2022
Assertion failed: anchorBefore == null || anchorBefore.getTreeParent() == parent in rule [kdoc-formatting] #1489

What's done:
- fix for KDOC_WRONG_TAGS_ORDER rule
- warning test "tags should be ordered assertion issue"
- fix test "extra new line with tags ordering should not cause assert"
@nulls nulls closed this as completed Nov 30, 2023
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

No branches or pull requests

4 participants