FabrizioBrancati/BFKit-Swift

View on GitHub

Showing 93 of 147 total issues

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

//
//  UIColor+Extensions.swift
//  BFKit-Swift
//
//  The MIT License (MIT)
Severity: Major
Found in Sources/BFKit/Apple/UIKit/UIColor+Extensions.swift and 1 other location - About 2 hrs to fix
Sources/BFKit/Apple/UIKit/UIColor+Extensions.swift on lines 1..450

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 179.

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

    private static func handleErrorOS11(_ error: NSError) -> Result {
        switch error {
        case LAError.authenticationFailed:
            return .authenticationFailed

Severity: Major
Found in Sources/BFKit/Apple/BFKit/BFBiometrics.swift and 1 other location - About 2 hrs to fix
Sources/BFKit/Apple/BFKit/BFBiometrics.swift on lines 173..211

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 154.

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

        } else {
            switch error {
            case LAError.authenticationFailed:
                return .authenticationFailed

Severity: Major
Found in Sources/BFKit/Apple/BFKit/BFBiometrics.swift and 1 other location - About 2 hrs to fix
Sources/BFKit/Apple/BFKit/BFBiometrics.swift on lines 125..163

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 154.

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

        if size.width > newTargetSize.width || newTargetSize.width == newTargetSize.height, size.width > size.height {
            let factor: CGFloat = (newTargetSize.width * 100) / size.width
            let newWidth: CGFloat = (size.width * factor) / 100
            let newHeight: CGFloat = (size.height * factor) / 100
            
Severity: Major
Found in Sources/BFKit/Apple/UIKit/UIImage+Extensions.swift and 1 other location - About 2 hrs to fix
Sources/BFKit/Apple/UIKit/UIImage+Extensions.swift on lines 342..361

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 139.

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

        } else if size.height > newTargetSize.height || newTargetSize.width == newTargetSize.height, size.width < size.height {
            let factor: CGFloat = (newTargetSize.width * 100) / size.height
            let newWidth: CGFloat = (size.width * factor) / 100
            let newHeight: CGFloat = (size.height * factor) / 100
            
Severity: Major
Found in Sources/BFKit/Apple/UIKit/UIImage+Extensions.swift and 1 other location - About 2 hrs to fix
Sources/BFKit/Apple/UIKit/UIImage+Extensions.swift on lines 334..361

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 139.

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

    var brightness: CGFloat {
        if canProvideRGBComponents() {
            var hue: CGFloat = 0.0, saturation: CGFloat = 0.0, brightness: CGFloat = 0.0, alpha: CGFloat = 0.0

            getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: &alpha)
Severity: Major
Found in Sources/BFKit/Apple/UIKit/UIColor+Extensions.swift and 2 other locations - About 1 hr to fix
Sources/BFKit/Apple/UIKit/UIColor+Extensions.swift on lines 159..167
Sources/BFKit/Apple/UIKit/UIColor+Extensions.swift on lines 170..178

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 88.

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

    var hue: CGFloat {
        if canProvideRGBComponents() {
            var hue: CGFloat = 0.0, saturation: CGFloat = 0.0, brightness: CGFloat = 0.0, alpha: CGFloat = 0.0

            getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: &alpha)
Severity: Major
Found in Sources/BFKit/Apple/UIKit/UIColor+Extensions.swift and 2 other locations - About 1 hr to fix
Sources/BFKit/Apple/UIKit/UIColor+Extensions.swift on lines 170..178
Sources/BFKit/Apple/UIKit/UIColor+Extensions.swift on lines 181..189

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 88.

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

    var saturation: CGFloat {
        if canProvideRGBComponents() {
            var hue: CGFloat = 0.0, saturation: CGFloat = 0.0, brightness: CGFloat = 0.0, alpha: CGFloat = 0.0

            getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: &alpha)
Severity: Major
Found in Sources/BFKit/Apple/UIKit/UIColor+Extensions.swift and 2 other locations - About 1 hr to fix
Sources/BFKit/Apple/UIKit/UIColor+Extensions.swift on lines 159..167
Sources/BFKit/Apple/UIKit/UIColor+Extensions.swift on lines 181..189

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 88.

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 20 locations. Consider refactoring.
Open

    func baselineOffset(_ baselineOffset: Float, range: NSRange? = nil) -> NSAttributedString {
        let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
        mutableAttributedString.addAttribute(NSAttributedString.Key.baselineOffset, value: baselineOffset, range: attributedStringRange(range))
        return mutableAttributedString as NSAttributedString
    }
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 44..48
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 56..60
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 68..72
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 80..84
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 92..96
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 105..109
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 117..121
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 129..133
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 141..145
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 154..158
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 167..171
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 180..184
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 193..197
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 206..210
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 230..234
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 242..246
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 254..258
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 266..270
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 297..301

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 83.

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 20 locations. Consider refactoring.
Open

    func foregroundColor(_ foregroundColor: Color, range: NSRange? = nil) -> NSAttributedString {
        let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
        mutableAttributedString.addAttribute(NSAttributedString.Key.foregroundColor, value: foregroundColor, range: attributedStringRange(range))
        return mutableAttributedString as NSAttributedString
    }
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 44..48
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 56..60
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 80..84
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 92..96
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 105..109
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 117..121
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 129..133
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 141..145
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 154..158
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 167..171
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 180..184
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 193..197
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 206..210
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 218..222
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 230..234
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 242..246
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 254..258
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 266..270
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 297..301

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 83.

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 20 locations. Consider refactoring.
Open

    func strikethroughStyle(_ strikethroughStyle: Int, range: NSRange? = nil) -> NSAttributedString {
        let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
        mutableAttributedString.addAttribute(NSAttributedString.Key.strikethroughStyle, value: strikethroughStyle, range: attributedStringRange(range))
        return mutableAttributedString as NSAttributedString
    }
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 44..48
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 56..60
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 68..72
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 80..84
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 92..96
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 105..109
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 129..133
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 141..145
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 154..158
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 167..171
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 180..184
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 193..197
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 206..210
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 218..222
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 230..234
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 242..246
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 254..258
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 266..270
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 297..301

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 83.

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 20 locations. Consider refactoring.
Open

    func paragraphStyle(_ paragraphStyle: NSParagraphStyle, range: NSRange? = nil) -> NSAttributedString {
        let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
        mutableAttributedString.addAttribute(NSAttributedString.Key.paragraphStyle, value: paragraphStyle, range: attributedStringRange(range))
        return mutableAttributedString as NSAttributedString
    }
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 44..48
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 68..72
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 80..84
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 92..96
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 105..109
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 117..121
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 129..133
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 141..145
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 154..158
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 167..171
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 180..184
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 193..197
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 206..210
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 218..222
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 230..234
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 242..246
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 254..258
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 266..270
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 297..301

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 83.

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 20 locations. Consider refactoring.
Open

    func ligature(_ ligature: Bool, range: NSRange? = nil) -> NSAttributedString {
        let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
        mutableAttributedString.addAttribute(NSAttributedString.Key.ligature, value: ligature, range: attributedStringRange(range))
        return mutableAttributedString as NSAttributedString
    }
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 44..48
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 56..60
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 68..72
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 80..84
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 105..109
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 117..121
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 129..133
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 141..145
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 154..158
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 167..171
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 180..184
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 193..197
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 206..210
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 218..222
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 230..234
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 242..246
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 254..258
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 266..270
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 297..301

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 83.

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 20 locations. Consider refactoring.
Open

    func underlineStyle(_ underlineStyle: NSUnderlineStyle, range: NSRange? = nil) -> NSAttributedString {
        let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
        mutableAttributedString.addAttribute(NSAttributedString.Key.underlineStyle, value: underlineStyle, range: attributedStringRange(range))
        return mutableAttributedString as NSAttributedString
    }
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 44..48
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 56..60
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 68..72
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 80..84
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 92..96
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 105..109
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 117..121
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 141..145
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 154..158
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 167..171
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 180..184
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 193..197
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 206..210
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 218..222
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 230..234
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 242..246
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 254..258
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 266..270
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 297..301

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 83.

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 20 locations. Consider refactoring.
Open

    func obliqueness(_ obliqueness: Float, range: NSRange? = nil) -> NSAttributedString {
        let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
        mutableAttributedString.addAttribute(NSAttributedString.Key.obliqueness, value: obliqueness, range: attributedStringRange(range))
        return mutableAttributedString as NSAttributedString
    }
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 44..48
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 56..60
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 68..72
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 80..84
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 92..96
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 105..109
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 117..121
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 129..133
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 141..145
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 154..158
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 167..171
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 180..184
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 193..197
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 206..210
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 218..222
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 230..234
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 242..246
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 266..270
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 297..301

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 83.

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 20 locations. Consider refactoring.
Open

    func strikethroughColor(_ strikethroughColor: Color, range: NSRange? = nil) -> NSAttributedString {
        let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
        mutableAttributedString.addAttribute(NSAttributedString.Key.strikethroughColor, value: strikethroughColor, range: attributedStringRange(range))
        return mutableAttributedString as NSAttributedString
    }
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 44..48
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 56..60
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 68..72
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 80..84
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 92..96
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 105..109
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 117..121
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 129..133
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 141..145
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 154..158
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 167..171
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 180..184
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 193..197
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 206..210
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 218..222
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 230..234
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 254..258
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 266..270
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 297..301

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 83.

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 20 locations. Consider refactoring.
Open

    func expansion(_ expansion: Float, range: NSRange? = nil) -> NSAttributedString {
        let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
        mutableAttributedString.addAttribute(NSAttributedString.Key.expansion, value: expansion, range: attributedStringRange(range))
        return mutableAttributedString as NSAttributedString
    }
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 44..48
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 56..60
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 68..72
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 80..84
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 92..96
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 105..109
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 117..121
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 129..133
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 141..145
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 154..158
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 167..171
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 180..184
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 193..197
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 206..210
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 218..222
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 230..234
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 242..246
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 254..258
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 297..301

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 83.

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 20 locations. Consider refactoring.
Open

        func attachment(_ attachment: NSTextAttachment, range: NSRange? = nil) -> NSAttributedString {
            let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
            mutableAttributedString.addAttribute(NSAttributedString.Key.attachment, value: attachment, range: attributedStringRange(range))
            return mutableAttributedString as NSAttributedString
        }
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 44..48
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 56..60
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 68..72
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 80..84
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 92..96
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 105..109
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 117..121
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 129..133
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 141..145
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 154..158
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 167..171
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 180..184
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 206..210
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 218..222
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 230..234
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 242..246
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 254..258
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 266..270
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 297..301

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 83.

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 20 locations. Consider refactoring.
Open

    func font(_ font: Font, range: NSRange? = nil) -> NSAttributedString {
        let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
        mutableAttributedString.addAttribute(NSAttributedString.Key.font, value: font, range: attributedStringRange(range))
        return mutableAttributedString as NSAttributedString
    }
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 56..60
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 68..72
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 80..84
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 92..96
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 105..109
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 117..121
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 129..133
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 141..145
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 154..158
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 167..171
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 180..184
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 193..197
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 206..210
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 218..222
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 230..234
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 242..246
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 254..258
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 266..270
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 297..301

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 83.

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 20 locations. Consider refactoring.
Open

    func strokeColor(_ strokeColor: Color, range: NSRange? = nil) -> NSAttributedString {
        let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
        mutableAttributedString.addAttribute(NSAttributedString.Key.strokeColor, value: strokeColor, range: attributedStringRange(range))
        return mutableAttributedString as NSAttributedString
    }
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 44..48
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 56..60
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 68..72
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 80..84
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 92..96
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 105..109
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 117..121
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 129..133
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 154..158
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 167..171
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 180..184
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 193..197
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 206..210
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 218..222
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 230..234
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 242..246
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 254..258
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 266..270
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift on lines 297..301

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 83.

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