periphery icon indicating copy to clipboard operation
periphery copied to clipboard

Feature Request: detect unneeded `open`s and missing `final`s

Open mildm8nnered opened this issue 2 years ago • 2 comments

I would like to be able to detect uses of open, where the class is not being subclassed outside its defining module, or the property or function is not being overridden outside its defining module.

I would also like to be able to detect where a class is not subclassed at all, or property or function is not overridden, and can therefore safely be declared final.

See https://github.com/realm/SwiftLint/issues/4838

mildm8nnered avatar Mar 26 '23 16:03 mildm8nnered

Thanks for the suggestion. This should be possible, as it's similar to redundant public accessibility analysis.

ileitch avatar Mar 26 '23 17:03 ileitch

That would be amazing. It would also be nice to know about these cases, which are legal, but slightly suspect:

public class Foo {
   open var bar = 0
}

mildm8nnered avatar Mar 26 '23 18:03 mildm8nnered