Tim Oltjenbruns

    Tim Oltjenbruns

    8 months ago
    Is there a way to customize the order that the ClassOrdering rule enforces? We use companion objects almost exclusively for factory methods, and we want those near the top of our classes next to the constructors. Checking for that order, or at least disabling the ordering rule specifically for companion objects, would be super helpful.
    marschwar

    marschwar

    8 months ago
    No, there is no such option. The
    ClassOrdering
    rule verifies that the class layout conforms to the conventions from https://kotlinlang.org/docs/coding-conventions.html#class-layout
    Tim Oltjenbruns

    Tim Oltjenbruns

    8 months ago
    Yeah, I've seen the doc about that being conventional. We still want to break it, uniformly if possible. Or at least, not at the cost of losing consistency for the other member's order.
    gammax

    gammax

    8 months ago
    I think you’ll have to make a custom rule that either subclass
    ClassOrdering
    or you just copy over the body (far from ideal I know).
    Tim Oltjenbruns

    Tim Oltjenbruns

    7 months ago
    Thanks Nicola, I was thinking that would be the road I could go down!