New Rule: Classes should be sealed/final by default

I would propose to introduce a new rule that warns on classes that are neither static, abstract, of sealed/final.

Inheritance is one of the pillar of OOP. However, in the real world, most classes are not designed to be properly inheritable.

Properly designing a class to be inheritable is a tricky task. One must anticipate state initialization, state correctness, state mutability and also non-public methods calls from descendants. Anticipating well code re-use is hard and this requires experience. As a consequence there is no chance that a class gets well designed for inheritance by chance.

This is applicable to Java, .NET, PHP, and others.

The tricky part is - of course - how to make clear that a class is open for inheritance:

public /* virtual */ class MyVirtualClass { } // can be compliant, not my preference

[Inheritable]
public class MyInheritableClass { }  // Convention based attribute, my preferred option

public sealed class InheritsFrom : WithKnownInheritance { }
public class WithKnownInheritance { } // I'm not sure if this should be sufficient once in the same assembly

public class WithVirtualMethod // Compliant, making a method virtual is a sign of willingly inheritable
{
    public virtual void MyVirtualMethod() { }
}

public class WithVirtualProperty // Compliant, making a property virtual is a sign of willingly inheritable
{
    public virtual int MyVirtualProperty => 42;
}

What to pick is a debate, and might be language specific, although I would prefer to have a similar solution for all languages.