FabrizioBrancati/BFKit-Swift

View on GitHub
Sources/BFKit/Apple/Foundation/NSAttributedString+Extensions.swift

Summary

Maintainability
D
3 days
Test Coverage

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

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

    func textEffect(_ textEffect: String, range: NSRange? = nil) -> NSAttributedString {
        let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
        mutableAttributedString.addAttribute(NSAttributedString.Key.textEffect, value: textEffect, 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 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 underlineColor(_ underlineColor: Color, range: NSRange? = nil) -> NSAttributedString {
        let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
        mutableAttributedString.addAttribute(NSAttributedString.Key.underlineColor, value: underlineColor, 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 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 shadow(_ shadow: NSShadow, range: NSRange? = nil) -> NSAttributedString {
            let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
            mutableAttributedString.addAttribute(NSAttributedString.Key.shadow, value: shadow, 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 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 link(_ link: NSURL, range: NSRange? = nil) -> NSAttributedString {
        let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
        mutableAttributedString.addAttribute(NSAttributedString.Key.link, value: link, 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 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 backgroundColor(_ backgroundColor: Color, range: NSRange? = nil) -> NSAttributedString {
        let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
        mutableAttributedString.addAttribute(NSAttributedString.Key.backgroundColor, value: backgroundColor, 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 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 verticalGlyphForm(_ verticalGlyphForm: Bool, range: NSRange? = nil) -> NSAttributedString {
        let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
        mutableAttributedString.addAttribute(NSAttributedString.Key.verticalGlyphForm, value: verticalGlyphForm, 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 266..270

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 kern(_ kern: Float, range: NSRange? = nil) -> NSAttributedString {
        let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
        mutableAttributedString.addAttribute(NSAttributedString.Key.kern, value: kern, 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 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 strokeWidth(_ strokeWidth: Float, range: NSRange? = nil) -> NSAttributedString {
        let mutableAttributedString = NSMutableAttributedString(string: string, attributes: attributes())
        mutableAttributedString.addAttribute(NSAttributedString.Key.strokeWidth, value: strokeWidth, 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 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

There are no issues that match your filters.

Category
Status