Add a swiftlint rule to prefer final classes

Summary:
There were only 2 instances in which I had to add a disable comment for prefer_final_classes due to subclassing

Used the following to add the final keyword (Adds final to any class that doesn't have final or open before it and doesn't have func after it)
```
find . -name '*.swift' | xargs perl -pi -e 's/(?<!final )(?<!open )(class (?!func).*\{)/final \1/g'
```

Reviewed By: samodom

Differential Revision: D34119233

fbshipit-source-id: 963d64fefc1686095d0bfe18ac7cb9677606f4e6
This commit is contained in:
Jawwad Ahmad
2022-02-09 23:08:16 -08:00
committed by Facebook GitHub Bot
parent d48c929e53
commit 624db61799
219 changed files with 242 additions and 239 deletions

View File

@@ -14,7 +14,7 @@ import FBSDKLoginKit
import FBSDKShareKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
final class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.

View File

@@ -8,7 +8,7 @@
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?

View File

@@ -8,7 +8,7 @@
import UIKit
class ViewController: UIViewController {
final class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

View File

@@ -10,7 +10,7 @@ import UIKit
import FacebookCore
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
final class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

View File

@@ -8,7 +8,7 @@
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?

View File

@@ -8,7 +8,7 @@
import UIKit
class ViewController: UIViewController {
final class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()