XYOracleNetwork/sdk-core-swift

View on GitHub
Sources/sdk-core-swift/objectmodel/XyoBuffer.swift

Summary

Maintainability
D
2 days
Test Coverage

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

    public func getUInt64 (offset: Int) -> UInt64 {
        let eight = UInt64(data[allowedOffset + offset]) << 56
        let seven = UInt64(data[allowedOffset + offset + 1]) << 48
        let six = UInt64(data[allowedOffset + offset + 2]) << 40
        let five = UInt64(data[allowedOffset + offset + 3]) << 32
Severity: Major
Found in Sources/sdk-core-swift/objectmodel/XyoBuffer.swift and 1 other location - About 5 hrs to fix
sdk-core-swift/objectmodel/XyoBuffer.swift on lines 86..97

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

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

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

    @discardableResult
    public func put(bits: UInt64) -> XyoBuffer {
        data.append(UInt8((bits >> 56) & 0xFF))
        data.append(UInt8((bits >> 48) & 0xFF))
        data.append(UInt8((bits >> 40) & 0xFF))
Severity: Major
Found in Sources/sdk-core-swift/objectmodel/XyoBuffer.swift and 1 other location - About 3 hrs to fix
sdk-core-swift/objectmodel/XyoBuffer.swift on lines 145..156

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

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

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

    public func getUInt32 (offset: Int) -> UInt32 {
        let four = UInt32(data[allowedOffset + offset])
        let three = UInt32(data[allowedOffset + offset + 1])
        let two = UInt32(data[allowedOffset + offset + 2])
        let one = UInt32(data[allowedOffset + offset + 3])
Severity: Major
Found in Sources/sdk-core-swift/objectmodel/XyoBuffer.swift and 1 other location - About 2 hrs to fix
sdk-core-swift/objectmodel/XyoBuffer.swift on lines 77..84

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

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

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

    @discardableResult
    public func put(bits: UInt32) -> XyoBuffer {
        data.append(UInt8((bits >> 24) & 0xFF))
        data.append(UInt8((bits >> 16) & 0xFF))
        data.append(UInt8((bits >> 8) & 0xFF))
Severity: Major
Found in Sources/sdk-core-swift/objectmodel/XyoBuffer.swift and 1 other location - About 1 hr to fix
sdk-core-swift/objectmodel/XyoBuffer.swift on lines 136..143

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

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

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

    public func getUInt16 (offset: Int) -> UInt16 {
        let two = UInt16(data[allowedOffset + offset])
        let one = UInt16(data[allowedOffset + offset + 1])

        return (two << 8) + one
Severity: Major
Found in Sources/sdk-core-swift/objectmodel/XyoBuffer.swift and 1 other location - About 1 hr to fix
sdk-core-swift/objectmodel/XyoBuffer.swift on lines 70..75

Duplicated Code

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

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

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

Tuning

This issue has a mass of 88.

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

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

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

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

Refactorings

Further Reading

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

    public func copyRangeOf(from: Int, toEnd: Int) -> XyoBuffer {
        let returnBuffer = XyoBuffer()

        for index in from...toEnd - 1 {
            returnBuffer.put(bits: getUInt8(offset: index))
Severity: Major
Found in Sources/sdk-core-swift/objectmodel/XyoBuffer.swift and 1 other location - About 1 hr to fix
sdk-core-swift/objectmodel/XyoBuffer.swift on lines 99..107

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

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

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

    @discardableResult
    public func put(bits: UInt16) -> XyoBuffer {
        data.append(UInt8((bits >> 8) & 0xFF))
        data.append(UInt8(bits & 0xFF))
        return self
Severity: Major
Found in Sources/sdk-core-swift/objectmodel/XyoBuffer.swift and 1 other location - About 1 hr to fix
sdk-core-swift/objectmodel/XyoBuffer.swift on lines 129..134

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

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

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

    @discardableResult
    public func put(schema: XyoObjectSchema) -> XyoBuffer {
        let schemaBytes = schema.toByteArray()
        data.append(schemaBytes[0])
        data.append(schemaBytes[1])
Severity: Minor
Found in Sources/sdk-core-swift/objectmodel/XyoBuffer.swift and 1 other location - About 55 mins to fix
sdk-core-swift/objectmodel/XyoBuffer.swift on lines 109..115

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

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

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

    public func getSchema(offset: Int) -> XyoObjectSchema {
        return XyoObjectSchema(id: data[allowedOffset + offset + 1], encodingCatalogue: data[allowedOffset + offset])
    }
Severity: Minor
Found in Sources/sdk-core-swift/objectmodel/XyoBuffer.swift and 1 other location - About 50 mins to fix
sdk-core-swift/objectmodel/XyoBuffer.swift on lines 62..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 61.

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