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

Remove dependencies on discouraged-comment-location rule #2371

Merged
merged 7 commits into from
Nov 22, 2023

Commits on Nov 21, 2023

  1. Configuration menu
    Copy the full SHA
    37a2819 View commit details
    Browse the repository at this point in the history
  2. - Add utility methods afterCodeSibling, beforeCodeSibling and `be…

    …tweenCodeSiblings` to ASTNodeExtensions
    
    - Break dependency between `if-else-wrapping` and `discouraged-comment-location`
    paul-dingemans committed Nov 21, 2023
    Configuration menu
    Copy the full SHA
    8d740f9 View commit details
    Browse the repository at this point in the history
  3. Add missing tests

    paul-dingemans committed Nov 21, 2023
    Configuration menu
    Copy the full SHA
    e690027 View commit details
    Browse the repository at this point in the history
  4. Remove dependency on discouraged-comment-location rule

    The `discouraged-comment-location` rule contained several unrelated comment locations. When disabling the rule, ktlint might throw an exception when another rule depends on it. It is understandable that users do not instantly understand the relation between for example the `if-else-wrapping` and the `discouraged-comment-location` rule. So rules now have to emit warnings themselves whenever comments can not be processed.
    
    For the `type-argument/type-argument-list`, `type-projection/type-parameter-list`, `value-argument/value-argument-list`, `value-parameter/value-parameter-list` new rules have been created to disallow comments. As those rules are more specific, it is more reasonable why specific rules depend on those rules.
    paul-dingemans committed Nov 21, 2023
    Configuration menu
    Copy the full SHA
    0b79a75 View commit details
    Browse the repository at this point in the history

Commits on Nov 22, 2023

  1. Configuration menu
    Copy the full SHA
    7c1c571 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8efae45 View commit details
    Browse the repository at this point in the history
  3. Remove logic DiscouragedCommentLocationRule

    Logic of this rule has been moved to normal rule classes in case a discouraged comment location was added for one specific rule only. Comment locations that are more generic (e.g. used by at least two different rules) are moved to separate rules as this provides more clarity about rule dependencies.
    
    Logic from this class has been removed, except for what is needed to avoid a breaking change.
    paul-dingemans committed Nov 22, 2023
    Configuration menu
    Copy the full SHA
    0213ca2 View commit details
    Browse the repository at this point in the history