FabrizioBrancati/BFKit-Swift

View on GitHub

Showing 93 of 147 total issues

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

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

    static func freeDiskSpace() -> NSNumber {
        do {
            let attributes = try FileManager.default.attributesOfFileSystem(forPath: NSHomeDirectory())
            return attributes[.systemFreeSize] as? NSNumber ?? NSNumber(value: 0.0)
        } catch {
Severity: Major
Found in Sources/BFKit/Apple/UIKit/UIDevice+Extensions.swift and 1 other location - About 1 hr to fix
Sources/BFKit/Apple/UIKit/UIDevice+Extensions.swift on lines 389..396

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

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

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

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

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

Refactorings

Further Reading

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

    private static func lowercasedCharactersScore(_ password: String) -> Int {
        let lowercasedCharacters = password.countLowercasedCharacters()
        
        switch lowercasedCharacters {
        case 1:
Severity: Major
Found in Sources/BFKit/Linux/BFKit/BFPassword.swift and 3 other locations - About 1 hr to fix
Sources/BFKit/Linux/BFKit/BFPassword.swift on lines 114..130
Sources/BFKit/Linux/BFKit/BFPassword.swift on lines 136..152
Sources/BFKit/Linux/BFKit/BFPassword.swift on lines 180..196

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

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

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

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

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

Refactorings

Further Reading

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

    private static func uppercasedCharactersScore(_ password: String) -> Int {
        let uppercasedCharacters = password.countUppercasedCharacters()
        
        switch uppercasedCharacters {
        case 1:
Severity: Major
Found in Sources/BFKit/Linux/BFKit/BFPassword.swift and 3 other locations - About 1 hr to fix
Sources/BFKit/Linux/BFKit/BFPassword.swift on lines 114..130
Sources/BFKit/Linux/BFKit/BFPassword.swift on lines 136..152
Sources/BFKit/Linux/BFKit/BFPassword.swift on lines 158..174

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

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

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

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

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

Refactorings

Further Reading

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

    private static func symbolsScore(_ password: String) -> Int {
        let symbols = password.countPunctuations()
        
        switch symbols {
        case 1:
Severity: Major
Found in Sources/BFKit/Linux/BFKit/BFPassword.swift and 3 other locations - About 1 hr to fix
Sources/BFKit/Linux/BFKit/BFPassword.swift on lines 114..130
Sources/BFKit/Linux/BFKit/BFPassword.swift on lines 158..174
Sources/BFKit/Linux/BFKit/BFPassword.swift on lines 180..196

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

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

    static func totalDiskSpace() -> NSNumber {
        do {
            let attributes = try FileManager.default.attributesOfFileSystem(forPath: NSHomeDirectory())
            return attributes[.systemSize] as? NSNumber ?? NSNumber(value: 0.0)
        } catch {
Severity: Major
Found in Sources/BFKit/Apple/UIKit/UIDevice+Extensions.swift and 1 other location - About 1 hr to fix
Sources/BFKit/Apple/UIKit/UIDevice+Extensions.swift on lines 401..408

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

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

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

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

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

Refactorings

Further Reading

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

    private static func numbersScore(_ password: String) -> Int {
        let numbers = password.countNumbers()
        
        switch numbers {
        case 1:
Severity: Major
Found in Sources/BFKit/Linux/BFKit/BFPassword.swift and 3 other locations - About 1 hr to fix
Sources/BFKit/Linux/BFKit/BFPassword.swift on lines 136..152
Sources/BFKit/Linux/BFKit/BFPassword.swift on lines 158..174
Sources/BFKit/Linux/BFKit/BFPassword.swift on lines 180..196

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

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

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

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

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

Refactorings

Further Reading

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

    func move(file: String, from origin: PathType, to destination: PathType) throws {
        let paths = try check(file: file, origin: origin, destination: destination)
        
        if paths.fileExist {
            try FileManager.default.moveItem(atPath: paths.origin, toPath: paths.destination)
Severity: Major
Found in Sources/BFKit/Linux/Foundation/FileManager+Extensions.swift and 1 other location - About 1 hr to fix
Sources/BFKit/Linux/Foundation/FileManager+Extensions.swift on lines 300..306

Duplicated Code

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

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

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

Tuning

This issue has a mass of 79.

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

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

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

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

Refactorings

Further Reading

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

    func copy(file: String, from origin: PathType, to destination: PathType) throws {
        let paths = try check(file: file, origin: origin, destination: destination)
        
        if paths.fileExist {
            try FileManager.default.copyItem(atPath: paths.origin, toPath: paths.destination)
Severity: Major
Found in Sources/BFKit/Linux/Foundation/FileManager+Extensions.swift and 1 other location - About 1 hr to fix
Sources/BFKit/Linux/Foundation/FileManager+Extensions.swift on lines 284..290

Duplicated Code

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

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

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

Tuning

This issue has a mass of 79.

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

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

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

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

Refactorings

Further Reading

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

            self.init(red: CGFloat(((hex & 0xFF0000) >> 16)) / 255.0, green: CGFloat(((hex & 0xFF00) >> 8)) / 255.0, blue: CGFloat((hex & 0xFF)) / 255.0, alpha: alpha)
Severity: Major
Found in Sources/BFKit/Apple/UIKit/UIColor+Extensions.swift and 1 other location - About 1 hr to fix
Sources/BFKit/Apple/UIKit/UIColor+Extensions.swift on lines 219..219

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

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

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

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

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

Refactorings

Further Reading

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

    func nextIndexPath(row: Int, forSection section: Int) -> IndexPath? {
        let indexPath: [IndexPath] = indexPaths(section: section)
        guard indexPath.isNotEmpty else {
            return nil
        }
Severity: Major
Found in Sources/BFKit/Apple/UIKit/UITableView+Extensions.swift and 1 other location - About 1 hr to fix
Sources/BFKit/Apple/UIKit/UITableView+Extensions.swift on lines 72..79

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

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

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

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

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

Refactorings

Further Reading

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

    func previousIndexPath(row: Int, forSection section: Int) -> IndexPath? {
        let indexPath: [IndexPath] = indexPaths(section: section)
        guard indexPath.isNotEmpty else {
            return nil
        }
Severity: Major
Found in Sources/BFKit/Apple/UIKit/UITableView+Extensions.swift and 1 other location - About 1 hr to fix
Sources/BFKit/Apple/UIKit/UITableView+Extensions.swift on lines 57..64

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

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

            self.init(calibratedRed: CGFloat(((hex & 0xFF0000) >> 16)) / 255.0, green: CGFloat(((hex & 0xFF00) >> 8)) / 255.0, blue: CGFloat((hex & 0xFF)) / 255.0, alpha: alpha)
Severity: Major
Found in Sources/BFKit/Apple/UIKit/UIColor+Extensions.swift and 1 other location - About 1 hr to fix
Sources/BFKit/Apple/UIKit/UIColor+Extensions.swift on lines 217..217

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

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