Showing 94 of 254 total issues
File API.swift
has 3195 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Apollo
import Foundation
public final class FetchEventsQuery: GraphQLQuery {
/// The raw GraphQL definition of this operation.
File FilterViewController.swift
has 394 lines of code (exceeds 250 allowed). Consider refactoring. Open
import UIKit
import CoreLocation
protocol FilterDelegate {
func receive(filters: Filter)
File ApolloController.swift
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Foundation
import Apollo
import OktaOidc
import Cloudinary
File UserProfileVC.swift
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
import UIKit
import Apollo
extension UserProfileViewController: UICollectionViewDelegateFlowLayout, UITextFieldDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
File EventVC+CollectionView.swift
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
import UIKit
import JTAppleCalendar
extension EventViewController: JTACMonthViewDataSource, JTACMonthViewDelegate, UICollectionViewDelegateFlowLayout, UICollectionViewDelegate, UICollectionViewDataSource {
Function prepare
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "ShowFeaturedDetailSegue" {
guard let detailVC = segue.destination as? EventDetailViewController,
let indexPath = featuredCollectionView.indexPathsForSelectedItems?.first else { return }
detailVC.indexPath = indexPath
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function buttonTapped
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
func buttonTapped(cell: TagCollectionViewCell) {
guard let tag = cell.filterTag else { return }
if cell.isActive {
guard let indexPath = selectedTagsCollectionView.indexPath(for: cell) else { return }
for tagFilter in selectedFilters {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function setFilterLabel
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private func setFilterLabel() {
guard let filter = filter, let filterLabel = filterLabel else { return }
filterLabel.text = "All Events"
if let index = filter.index {
filterLabel.text = "By term \"\(index)\""
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function updateViews
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
func updateViews() {
guard let filter = filter, let filterUsedLabel = filterUsedLabel else { return }
imageButton.backgroundColor = UIColor(red: 0.84, green: 0.84, blue: 0.84, alpha: 1.0)
imageButton.layer.cornerRadius = 5
imageButton.layer.borderWidth = 1
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File HomeViewController.swift
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
import UIKit
import OktaOidc
class HomeViewController: UIViewController, ControllerDelegate {
Function showInCalendar
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
@IBAction func showInCalendar(_ sender: Any) {
eventStore.requestAccess(to: .event) { (granted, error) in
if let error = error {
NSLog("\(#file):L\(#line): Unable to request access to calendar in \(#function) with error: \(error)")
return
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function saveTapped
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
func saveTapped() {
guard
let firstName = firstNameTextField.text,
let lastName = lastNameTextField.text,
let apolloController = apolloController
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function fetchUserID
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
func fetchUserID(oktaID: String, completion: @escaping (Swift.Result<FetchUserIdQuery.Data.User, Error>) -> Void) {
apollo.fetch(query: FetchUserIdQuery(oktaId: oktaID), cachePolicy: .returnCacheDataElseFetch) { result in
switch result {
case .failure(let error):
print("Error getting user ID: \(error)")
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function loginUser
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
func loginUser() {
guard let tabBar = tabBarController as? EventTabBarController else { return }
tabBar.authController.signIn(viewController: self) { _ in
if let accessToken = self.authController?.stateManager?.accessToken {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function signOut
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
func signOut(with options: OktaSignOutOptions,
failedOptions: OktaSignOutOptions,
progressHandler: @escaping ((OktaSignOutOptions) -> Void),
completionHandler: @escaping ((Bool, OktaSignOutOptions) -> Void)) {
if options.isEmpty {
Function configureViews
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
func configureViews() {
imageBackgroundView.layer.cornerRadius = UIScreen.main.bounds.width / 4.2
imageBackgroundView2.layer.cornerRadius = UIScreen.main.bounds.width / 4.2 - 10
imageBackgroundView2.backgroundColor = UIColor.coral
Function checkCurrentuser
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
func checkCurrentuser() {
if let user = apolloController?.currentUser, let userEvents = user.userEvents {
if self.events.count != userEvents.count {
self.events = userEvents
self.noEventsLabel.isHidden = true
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function signOut
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
func signOut(with options: OktaSignOutOptions,
failedOptions: OktaSignOutOptions,
progressHandler: @escaping ((OktaSignOutOptions) -> Void),
completionHandler: @escaping ((Bool, OktaSignOutOptions) -> Void)) {
if options.isEmpty {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function updateViewsLogin
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
func updateViewsLogin(user: FetchUserIdQuery.Data.User) {
guard
let urlString = user.profileImage,
let url = URL(string: urlString),
let data = try? Data(contentsOf: url),
Function loginUser
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
func loginUser() {
guard let tabBar = tabBarController as? EventTabBarController else { return }
tabBar.authController.signIn(viewController: self) { _ in
if let accessToken = self.authController?.stateManager?.accessToken {