adboco/Unsplasher-SDK

View on GitHub

Showing 41 of 70 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public func statistics(username: String, resolution: Unsplash.StatisticsResolution? = nil, quantity: UInt32 = 30, completion: @escaping (StatisticsResult) -> Void) {
        var parameters: Parameters = [:]
        if let resolution = resolution {
            parameters["resolution"] = resolution
        }
Severity: Major
Found in Unsplasher/Unsplash/Requests/UserRequests.swift and 1 other location - About 2 hrs to fix
Unsplasher/Unsplash/Requests/PhotoRequests.swift on lines 224..236

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 178.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public func statistics(photoId: String, resolution: Unsplash.StatisticsResolution? = nil, quantity: UInt32 = 30, completion: @escaping (StatisticsResult) -> Void) {
        var parameters: Parameters = [:]
        if let resolution = resolution {
            parameters["resolution"] = resolution
        }
Severity: Major
Found in Unsplasher/Unsplash/Requests/PhotoRequests.swift and 1 other location - About 2 hrs to fix
Unsplasher/Unsplash/Requests/UserRequests.swift on lines 66..78

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 178.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public func remove(photoId: String, from collectionId: UInt32, completion: @escaping (CollectionPhotoResult) -> Void) {
        let requiredScope: Unsplash.PermissionScope = .writeCollections
        guard self.manager.scopes.contains(requiredScope) else {
            completion(.failure(UnsplashError.scopeRequiredError(requiredScope)))
            return
Severity: Major
Found in Unsplasher/Unsplash/Requests/CollectionRequests.swift and 1 other location - About 2 hrs to fix
Unsplasher/Unsplash/Requests/CollectionRequests.swift on lines 156..165

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 156.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public func add(photoId: String, to collectionId: UInt32, completion: @escaping (CollectionPhotoResult) -> Void) {
        let requiredScope: Unsplash.PermissionScope = .writeCollections
        guard self.manager.scopes.contains(requiredScope) else {
            completion(.failure(UnsplashError.scopeRequiredError(requiredScope)))
            return
Severity: Major
Found in Unsplasher/Unsplash/Requests/CollectionRequests.swift and 1 other location - About 2 hrs to fix
Unsplasher/Unsplash/Requests/CollectionRequests.swift on lines 173..182

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 156.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public func like(id: String, completion: @escaping (LikeResult) -> Void) {
        let requiredScope: Unsplash.PermissionScope = .writeLikes
        guard self.manager.scopes.contains(requiredScope) else {
            completion(.failure(UnsplashError.scopeRequiredError(requiredScope)))
            return
Severity: Major
Found in Unsplasher/Unsplash/Requests/PhotoRequests.swift and 1 other location - About 1 hr to fix
Unsplasher/Unsplash/Requests/PhotoRequests.swift on lines 113..121

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 127.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public func unlike(id: String, completion: @escaping (LikeResult) -> Void) {
        let requiredScope: Unsplash.PermissionScope = .writeLikes
        guard self.manager.scopes.contains(requiredScope) else {
            completion(.failure(UnsplashError.scopeRequiredError(requiredScope)))
            return
Severity: Major
Found in Unsplasher/Unsplash/Requests/PhotoRequests.swift and 1 other location - About 1 hr to fix
Unsplasher/Unsplash/Requests/PhotoRequests.swift on lines 98..106

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 127.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    func next<T: Codable>(_ type: T.Type, completion: @escaping (Result<T>) -> Void) {
        guard let url = pagination.next?.absoluteString else {
            completion(.failure(UnsplashError.noPaginationError("No next page available.")))
            return
        }
Severity: Major
Found in Unsplasher/Unsplash/Requests/Requests.swift and 3 other locations - About 1 hr to fix
Unsplasher/Unsplash/Requests/Requests.swift on lines 227..233
Unsplasher/Unsplash/Requests/Requests.swift on lines 238..244
Unsplasher/Unsplash/Requests/Requests.swift on lines 260..266

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 98.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    func prev<T: Codable>(_ type: T.Type, completion: @escaping (Result<T>) -> Void) {
        guard let url = pagination.prev?.absoluteString else {
            completion(.failure(UnsplashError.noPaginationError("No previous page available.")))
            return
        }
Severity: Major
Found in Unsplasher/Unsplash/Requests/Requests.swift and 3 other locations - About 1 hr to fix
Unsplasher/Unsplash/Requests/Requests.swift on lines 227..233
Unsplasher/Unsplash/Requests/Requests.swift on lines 238..244
Unsplasher/Unsplash/Requests/Requests.swift on lines 249..255

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 98.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    func first<T: Codable>(_ type: T.Type, completion: @escaping (Result<T>) -> Void) {
        guard let url = pagination.first?.absoluteString else {
            completion(.failure(UnsplashError.noPaginationError("No first page available.")))
            return
        }
Severity: Major
Found in Unsplasher/Unsplash/Requests/Requests.swift and 3 other locations - About 1 hr to fix
Unsplasher/Unsplash/Requests/Requests.swift on lines 238..244
Unsplasher/Unsplash/Requests/Requests.swift on lines 249..255
Unsplasher/Unsplash/Requests/Requests.swift on lines 260..266

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 98.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    func last<T: Codable>(_ type: T.Type, completion: @escaping (Result<T>) -> Void) {
        guard let url = pagination.last?.absoluteString else {
            completion(.failure(UnsplashError.noPaginationError("No last page available.")))
            return
        }
Severity: Major
Found in Unsplasher/Unsplash/Requests/Requests.swift and 3 other locations - About 1 hr to fix
Unsplasher/Unsplash/Requests/Requests.swift on lines 227..233
Unsplasher/Unsplash/Requests/Requests.swift on lines 249..255
Unsplasher/Unsplash/Requests/Requests.swift on lines 260..266

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 98.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    func testAddPhotoToCollection() {
        let expectation = self.expectation(description: "Add Photo to Collection")
        
        let photoId = "dtCTfjTEOgg"
        let id: UInt32 = 4378364
Severity: Major
Found in UnsplasherTests/Requests/CollectionRequestsTests.swift and 1 other location - About 1 hr to fix
UnsplasherTests/Requests/CollectionRequestsTests.swift on lines 113..125

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 94.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    func testRemovePhotoFromCollection() {
        let expectation = self.expectation(description: "Remove Photo from Collection")
        
        let photoId = "dtCTfjTEOgg"
        let id: UInt32 = 4378364
Severity: Major
Found in UnsplasherTests/Requests/CollectionRequestsTests.swift and 1 other location - About 1 hr to fix
UnsplasherTests/Requests/CollectionRequestsTests.swift on lines 99..111

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 94.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    func testGetRelatedCollections() {
        let expectation = self.expectation(description: "Related Collections")
        
        let id: UInt32 = 206
        
Severity: Major
Found in UnsplasherTests/Requests/CollectionRequestsTests.swift and 2 other locations - About 1 hr to fix
UnsplasherTests/Requests/CollectionRequestsTests.swift on lines 39..50
UnsplasherTests/Requests/CollectionRequestsTests.swift on lines 52..63

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 84.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    func testGetCollectionPhotos() {
        let expectation = self.expectation(description: "Collection Photos")
        
        let id: UInt32 = 206
        
Severity: Major
Found in UnsplasherTests/Requests/CollectionRequestsTests.swift and 2 other locations - About 1 hr to fix
UnsplasherTests/Requests/CollectionRequestsTests.swift on lines 39..50
UnsplasherTests/Requests/CollectionRequestsTests.swift on lines 65..76

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 84.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    func testGetCollectionById() {
        let expectation = self.expectation(description: "Collection")
        
        let id: UInt32 = 206
        
Severity: Major
Found in UnsplasherTests/Requests/CollectionRequestsTests.swift and 2 other locations - About 1 hr to fix
UnsplasherTests/Requests/CollectionRequestsTests.swift on lines 52..63
UnsplasherTests/Requests/CollectionRequestsTests.swift on lines 65..76

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 84.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    fileprivate var scrollView: UIScrollView? {
        set {
            if let newValue = newValue {
                objc_setAssociatedObject(self, &AssociatedObjectKeys.scrollView, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN)
            }
Severity: Major
Found in Example/Utils/UIViewControllerExtension.swift and 3 other locations - About 1 hr to fix
Example/Utils/UIScrollViewExtension.swift on lines 20..31
Example/Utils/UIViewControllerExtension.swift on lines 32..42
Example/Utils/UIViewControllerExtension.swift on lines 44..54

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 79.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    fileprivate var pullRefreshAction: Action? {
        set {
            if let newValue = newValue {
                // Computed properties get stored as associated objects
                objc_setAssociatedObject(self, &AssociatedObjectKeys.pullRefreshCompletion, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN)
Severity: Major
Found in Example/Utils/UIScrollViewExtension.swift and 3 other locations - About 1 hr to fix
Example/Utils/UIViewControllerExtension.swift on lines 20..30
Example/Utils/UIViewControllerExtension.swift on lines 32..42
Example/Utils/UIViewControllerExtension.swift on lines 44..54

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 79.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    fileprivate var gradientLayer: CAGradientLayer? {
        set {
            if let newValue = newValue {
                objc_setAssociatedObject(self, &AssociatedObjectKeys.gradientLayer, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN)
            }
Severity: Major
Found in Example/Utils/UIViewControllerExtension.swift and 3 other locations - About 1 hr to fix
Example/Utils/UIScrollViewExtension.swift on lines 20..31
Example/Utils/UIViewControllerExtension.swift on lines 20..30
Example/Utils/UIViewControllerExtension.swift on lines 44..54

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 79.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    fileprivate var basicAnimation: CABasicAnimation? {
        set {
            if let newValue = newValue {
                objc_setAssociatedObject(self, &AssociatedObjectKeys.basicAnimation, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN)
            }
Severity: Major
Found in Example/Utils/UIViewControllerExtension.swift and 3 other locations - About 1 hr to fix
Example/Utils/UIScrollViewExtension.swift on lines 20..31
Example/Utils/UIViewControllerExtension.swift on lines 20..30
Example/Utils/UIViewControllerExtension.swift on lines 32..42

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 79.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    func testLikePhoto() {
        let expectation = self.expectation(description: "Like Photo")
        
        let photoId = "2PODhmrvLik"
        
Severity: Major
Found in UnsplasherTests/Requests/StatisticsRequestsTests.swift and 3 other locations - About 1 hr to fix
UnsplasherTests/Requests/PhotoRequestsTests.swift on lines 96..107
UnsplasherTests/Requests/StatisticsRequestsTests.swift on lines 42..53
UnsplasherTests/Requests/StatisticsRequestsTests.swift on lines 55..66

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 78.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language