Skip to content

[CM-997] Add linter rules and fix warnings #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ opt_in_rules: # some rules are turned off by default, so you need to opt-in
- empty_count
- first_where
- force_unwrapping
- implicit_return
- missing_docs
- multiline_arguments
- multiline_arguments_brackets
- multiline_function_chains
Expand Down
2 changes: 1 addition & 1 deletion Sources/YComponentBrowser/CatalogFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public enum CatalogFactory {
with categories: [Classification],
navigationTitle: String? = nil
) -> UIViewController {
return ClassificationViewController(
ClassificationViewController(
datasource: ClassificationDataSource(
navigationTitle: navigationTitle,
classification: categories
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ public final class ClassificationDataSource: NSObject, CatalogDataSource {

/// :nodoc:
public func category(for indexPath: IndexPath) -> Classification {
return categories[indexPath.row]
categories[indexPath.row]
}

/// :nodoc:
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return categories.count
categories.count
}

/// :nodoc:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public final class ClassificationViewController<DataSource: CatalogDataSource>:
}

/// :nodoc:
public required init?(coder: NSCoder) { return nil }
public required init?(coder: NSCoder) { nil }

/// :nodoc:
public override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public struct CatalogDetailDestination<View: ContentView>: Destination {

/// Creates a tableview controller that displays the model data within the specified view
public func getDestinationController() -> UIViewController {
return CatalogFactory.createGenericDisplayViewController(
CatalogFactory.createGenericDisplayViewController(
viewType: View.self,
models: models,
navigationTitle: navigationTitle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ public struct SubcategoryDetailDestination: Destination {

/// Creates a subcategory view controller
public func getDestinationController() -> UIViewController {
return CatalogFactory.createClassificationViewController(with: subcategories, navigationTitle: navigationTitle)
CatalogFactory.createClassificationViewController(with: subcategories, navigationTitle: navigationTitle)
}
}
2 changes: 1 addition & 1 deletion Sources/YComponentBrowser/Protocols/Identifiable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ public protocol Identifiable {
/// Default implementation that returns the object type as the identifier
public extension Identifiable {
/// Unique identifier for the type of object
static var identifier: String { return "\(self)" }
static var identifier: String { "\(self)" }
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public final class GenericCollectionViewCell<View: ContentView>: UICollectionVie
}

/// :nodoc:
public required init?(coder: NSCoder) { return nil }
public required init?(coder: NSCoder) { nil }

/// :nodoc:
public override func prepareForReuse() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ public final class GenericTableViewCell<View: ContentView>: UITableViewCell, Ide
}

/// :nodoc:
public required init?(coder: NSCoder) {
return nil
}
public required init?(coder: NSCoder) { nil }

/// :nodoc:
public override func setHighlighted(_ highlighted: Bool, animated: Bool) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final public class GenericCollectionViewController<View: ContentView>: UICollect
_ collectionView: UICollectionView,
numberOfItemsInSection section: Int
) -> Int {
return models.count
models.count
}

/// :nodoc:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final public class GenericTableViewController<View: ContentView>: UITableViewCon

/// :nodoc:
public override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return models.count
models.count
}

/// :nodoc:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ class Demo: Classification {
}

class Demodestination: Destination {
func getDestinationController() -> UIViewController {
return controller
}
func getDestinationController() -> UIViewController { controller }

var presentationStyle: Presentation
var navigationTitle: String?
Expand Down