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

Create project to enable AnnotationRule #502

Closed
uziassantosferreira opened this issue Jun 24, 2019 · 2 comments
Closed

Create project to enable AnnotationRule #502

uziassantosferreira opened this issue Jun 24, 2019 · 2 comments

Comments

@uziassantosferreira
Copy link

uziassantosferreira commented Jun 24, 2019

I created a project to enable AnnotationRule() and when I run and I get this error
Internal Error (custom-ktlint-rules:annotation). Please create a ticket at https://github.com/shyiko/ktlint/issue (if possible, provide the source code that triggered an error) (cannot be auto-corrected)

My custom RuleSet

import com.pinterest.ktlint.core.RuleSet
import com.pinterest.ktlint.core.RuleSetProvider
import com.pinterest.ktlint.ruleset.experimental.ImportOrderingRule
import com.pinterest.ktlint.ruleset.standard.AnnotationRule
import com.pinterest.ktlint.ruleset.standard.IndentationRule
import com.pinterest.ktlint.ruleset.standard.MultiLineIfElseRule
import com.pinterest.ktlint.ruleset.standard.NoWildcardImportsRule

class CustomRuleSetProvider : RuleSetProvider {
    override fun get() = RuleSet("custom-ktlint-rules",
        NoWildcardImportsRule(),
        MultiLineIfElseRule(),
        ImportOrderingRule(),
        AnnotationRule(),
        IndentationRule())
}

When I remove AnnotationRule the ktlint works normal

@shashachu
Copy link
Contributor

The AnnotationRule was disabled in the standard ruleset due to errors; it may be fixed by #497

shashachu added a commit that referenced this issue Jul 5, 2019
* Fix AnnotationRule exception
    * Return if there's no annotations found instead of throwing an exception
    * Fixes #490 and #502
    * Re-enable rule in standard ruleset
@shashachu
Copy link
Contributor

PR #509 fixes this. It will be released in 0.34.0

sowmyav24 pushed a commit to sowmyav24/ktlint that referenced this issue Jul 18, 2019
* Fix AnnotationRule exception
    * Return if there's no annotations found instead of throwing an exception
    * Fixes pinterest#490 and pinterest#502
    * Re-enable rule in standard ruleset
orchestr7 pushed a commit to saveourtool/diktat that referenced this issue Jun 29, 2020
* Fix AnnotationRule exception
    * Return if there's no annotations found instead of throwing an exception
    * Fixes pinterest/ktlint#490 and pinterest/ktlint#502
    * Re-enable rule in standard ruleset
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

No branches or pull requests

2 participants