I'm writing custom code static analysis rules.
I want to find such override functions, which don't have super function call.
For example, regexp should find this:
override func testFunc(num: Int) {
print()
}
But, do not find this:
override func testFunc(num: Int) {
print()
super.testFunc(num: num)
print()
}
We should keep in mind that function can contain extra block inside. So, we have also not find this:
override func testFunc(num: Int) {
print()
super.testFunc(num: num)
let block = {
print("inside block")
}
print()
}
And we should not be interested in super function call inside blocks. Only inside that function.
I wrote this: override func\s(\w*)\(.*?\{.*?super\.\1.*?\}
But it is not consider blocks and it find functions where is super function call. And I don't know how to invert this.