Showing 94 of 254 total issues
Function updateViewsHomeVC
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private func updateViewsHomeVC() {
guard
let event = event,
// let urlCreatorString = event.creator.profileImage,
// let urlCreator = URL(string: urlCreatorString),
- 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 editViewConstraints
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
func editViewConstraints() {
let window = UIApplication.shared.windows.filter {$0.isKeyWindow}.first
if let window = window {
Function loadImageFT
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
func loadImageFT(forCell cell: FeaturedCollectionViewCell, forItemAt indexPath: IndexPath) {
guard let event = events?[indexPath.item] else { return }
if let cachedImage = cache.value(for: event.id) {
cell.eventImageView?.image = cachedImage
Function loadImageTV
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
func loadImageTV(forCell cell: EventTableViewCell, forItemAt indexPath: IndexPath) {
guard let event = filteredEvents?[indexPath.item] else { return }
if let cachedImage = cache.value(for: event.id) {
cell.eventImageView?.image = cachedImage
Function setFilterLabel
has 27 lines of code (exceeds 25 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)\""
Function loadImageCV
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
func loadImageCV(forCell cell: EventCollectionViewCell, forItemAt indexPath: IndexPath) {
guard let event = filteredEvents?[indexPath.item] else { return }
if let cachedImage = cache.value(for: event.id) {
cell.eventImageView?.image = cachedImage
Function buttonTapped
has 26 lines of code (exceeds 25 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 {
Function saveTapped
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
func saveTapped() {
guard
let firstName = firstNameTextField.text,
let lastName = lastNameTextField.text,
let apolloController = apolloController
Function anchor
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
func anchor(top: NSLayoutYAxisAnchor?, leading: NSLayoutXAxisAnchor?, trailing: NSLayoutXAxisAnchor?, bottom: NSLayoutYAxisAnchor?, centerX: NSLayoutXAxisAnchor?, centerY: NSLayoutYAxisAnchor?, padding: UIEdgeInsets = .zero, size: CGSize = .zero) {
Function perform
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
static func perform(authRequest: OIDAuthorizationRequest, callback: @escaping OIDAuthorizationCallback) {
var urlRequest = URLRequest(url: authRequest.externalUserAgentRequestURL())
urlRequest.httpMethod = "GET"
urlRequest.allHTTPHeaderFields = [
"Accept": "application/json",
- 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 fetchEvents
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
func fetchEvents(completion: @escaping (Swift.Result<[FetchEventsQuery.Data.Event], Error>) -> Void) {
apollo.fetch(query: FetchEventsQuery(), cachePolicy: .returnCacheDataElseFetch) { result in
switch result {
case .failure(let error):
print("Error fetching events: \(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 signIn
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
func signIn(callback: @escaping ((OIDAuthState?, OktaOidcError?) -> Void)) {
self.downloadOidcConfiguration() { oidConfig, error in
guard let oidConfiguration = oidConfig else {
callback(nil, 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 signOutWithIdToken
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
func signOutWithIdToken(idToken: String,
callback: @escaping (Void?, OktaOidcError?) -> Void) {
self.downloadOidcConfiguration() { oidConfig, error in
guard let oidConfig = oidConfig else {
callback(nil, 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 updateViewsLogin
has a Cognitive Complexity of 9 (exceeds 5 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),
- 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 keyboardWillShow
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@objc func keyboardWillShow(notification: Notification) {
keyboardDismissTapGestureRecognizer.isEnabled = true
var keyboardSize: CGRect = .zero
- 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 constraint
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
@discardableResult func constraint(firstView: UIView, to secondView: UIView, top: NSLayoutConstraint? = nil, bot: NSLayoutConstraint? = nil, left: NSLayoutConstraint? = nil, right: NSLayoutConstraint? = nil) -> [NSLayoutConstraint] {
Function loadImageCV
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
func loadImageCV(forCell cell: EventCollectionViewCell, forItemAt indexPath: IndexPath) {
guard let event = filteredEvents?[indexPath.item] else { return }
if let cachedImage = cache.value(for: event.id) {
cell.eventImageView?.image = cachedImage
- 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 loadImageFT
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
func loadImageFT(forCell cell: FeaturedCollectionViewCell, forItemAt indexPath: IndexPath) {
guard let event = events?[indexPath.item] else { return }
if let cachedImage = cache.value(for: event.id) {
cell.eventImageView?.image = cachedImage
- 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 updateUserInfo
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func updateUserInfo(urlString: String?, firstName: String?, lastName: String?, graphQLID: String, accessToken: String, completion: @escaping (Swift.Result<UpdateUserInfoMutation.Data.UpdateUser, Error>) -> Void) {
Function dateTapped
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@objc func dateTapped(_ sender: Any) {
attendingButton.setAttributedTitle(createAttrText(with: "Attending", color: .unselectedDayButton, fontName: PoppinsFont.light.rawValue), for: .normal)
savedButton.setAttributedTitle(createAttrText(with: "Saved", color: .unselectedDayButton, fontName: PoppinsFont.light.rawValue), for: .normal)
createdButton.setAttributedTitle(createAttrText(with: "Created", color: .unselectedDayButton, fontName: PoppinsFont.light.rawValue), for: .normal)
if let date = self.dateSelected {
- 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"