I met warning like this "Cyclomatic Complexity Violation: Function should have complexity 10 or less: currently complexity equals 14 (cyclomatic_complexity)" when I used RxDataSource.
My code structure like this:
struct ItemDetailDataSource {
typealias DataSource = RxTableViewSectionedReloadDataSource
static func dataSource() -> DataSource<ItemDetailTableViewSection> {
return .init(configureCell: { (dataSource, tableView, indexPath, _) -> UITableViewCell in
switch dataSource[indexPath] {
case .itemInfoTopItem(let info):
guard let cell = tableView.dequeueReusableCell(withIdentifier: ConstantsForCell.infoTopTableViewCell,
for: indexPath)
as? InfoTopTableViewCell else {
return UITableViewCell()
}
cell.configure(info)
return cell
case .itemHintItem(let hint):
...
case .itemManaColdownItem(let manacd):
case .itemNotesItem(let notes):
case .itemAttribItem(let attrib):
case .itemLoreItem(let lore):
case .itemComponentsItem(let components):
}
Can anyone help me fix this? Thanks very much.