Mordil/RediStack

View on GitHub
Sources/RediStack/Commands/SetCommands.swift

Summary

Maintainability
A
50 mins
Test Coverage

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

    @inlinable
    public static func sadd<Value: RESPValueConvertible>(_ elements: [Value], to key: RedisKey) -> RedisCommand<Int> {
        assert(elements.count > 0, "at least 1 element should be provided")

        var args = [RESPValue(from: key)]
Severity: Major
Found in Sources/RediStack/Commands/SetCommands.swift and 2 other locations - About 1 hr to fix
Sources/RediStack/Commands/ListCommands.swift on lines 184..192
Sources/RediStack/Commands/ListCommands.swift on lines 509..517

Duplicated Code

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

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

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

Tuning

This issue has a mass of 98.

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

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

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

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

Refactorings

Further Reading

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

    public static func sunionstore(as destination: RedisKey, sources keys: [RedisKey]) -> RedisCommand<Int> {
        assert(!keys.isEmpty, "at least 1 key should be provided")

        var args = [RESPValue(from: destination)]
        args.append(convertingContentsOf: keys)
Severity: Major
Found in Sources/RediStack/Commands/SetCommands.swift and 2 other locations - About 1 hr to fix
Sources/RediStack/Commands/SetCommands.swift on lines 69..76
Sources/RediStack/Commands/SetCommands.swift on lines 96..103

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

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

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

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

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

Refactorings

Further Reading

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

    public static func sinterstore(as destination: RedisKey, sources keys: [RedisKey]) -> RedisCommand<Int> {
        assert(!keys.isEmpty, "at least 1 key should be provided")

        var args = [RESPValue(from: destination)]
        args.append(convertingContentsOf: keys)
Severity: Major
Found in Sources/RediStack/Commands/SetCommands.swift and 2 other locations - About 1 hr to fix
Sources/RediStack/Commands/SetCommands.swift on lines 69..76
Sources/RediStack/Commands/SetCommands.swift on lines 222..229

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

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

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

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

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

Refactorings

Further Reading

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

    public static func sdiffstore(as destination: RedisKey, sources keys: [RedisKey]) -> RedisCommand<Int> {
        assert(!keys.isEmpty, "at least 1 key should be provided")

        var args = [RESPValue(from: destination)]
        args.append(convertingContentsOf: keys)
Severity: Major
Found in Sources/RediStack/Commands/SetCommands.swift and 2 other locations - About 1 hr to fix
Sources/RediStack/Commands/SetCommands.swift on lines 96..103
Sources/RediStack/Commands/SetCommands.swift on lines 222..229

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

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

    @inlinable
    public static func sismember<Value: RESPValueConvertible>(_ element: Value, of key: RedisKey) -> RedisCommand<Bool> {
        let args: [RESPValue] = [
            .init(from: key),
            element.convertedToRESPValue()
Severity: Major
Found in Sources/RediStack/Commands/SetCommands.swift and 3 other locations - About 1 hr to fix
Sources/RediStack/Commands/ListCommands.swift on lines 210..217
Sources/RediStack/Commands/ListCommands.swift on lines 534..541
Sources/RediStack/Commands/PubSubCommands.swift on lines 25..35

Duplicated Code

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

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

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

Tuning

This issue has a mass of 84.

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

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

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

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

Refactorings

Further Reading

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

    public static func sinter(of keys: [RedisKey]) -> RedisCommand<[RESPValue]> {
        assert(!keys.isEmpty, "at least 1 key should be provided")

        let args = keys.map(RESPValue.init(from:))
        return .init(keyword: "SINTER", arguments: args)
Severity: Major
Found in Sources/RediStack/Commands/SetCommands.swift and 1 other location - About 1 hr to fix
Sources/RediStack/Commands/SetCommands.swift on lines 53..58

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

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

    public static func sdiff(of keys: [RedisKey]) -> RedisCommand<[RESPValue]> {
        assert(!keys.isEmpty, "at least 1 key should be provided")

        let args = keys.map(RESPValue.init(from:))
        return .init(keyword: "SDIFF", arguments: args)
Severity: Major
Found in Sources/RediStack/Commands/SetCommands.swift and 1 other location - About 1 hr to fix
Sources/RediStack/Commands/SetCommands.swift on lines 80..85

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

//===----------------------------------------------------------------------===//
//
// This source file is part of the RediStack open source project
//
// Copyright (c) 2019-2022 RediStack project authors
Severity: Major
Found in Sources/RediStack/Commands/SetCommands.swift and 2 other locations - About 50 mins to fix
Sources/RediStack/Commands/HashCommands.swift on lines 1..341
Sources/RediStack/Commands/SortedSetCommands.swift on lines 1..1506

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

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

    @inlinable
    public static func srem<Value: RESPValueConvertible>(_ elements: Value..., from key: RedisKey) -> RedisCommand<Int> {
        return .srem(elements, from: key)
    }
Severity: Major
Found in Sources/RediStack/Commands/SetCommands.swift and 3 other locations - About 45 mins to fix
Sources/RediStack/Commands/ListCommands.swift on lines 524..527
Sources/RediStack/Commands/SetCommands.swift on lines 39..42
Sources/RediStack/Commands/SortedSetCommands.swift on lines 714..717

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

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

    @inlinable
    public static func sadd<Value: RESPValueConvertible>(_ elements: Value..., to key: RedisKey) -> RedisCommand<Int> {
        return .sadd(elements, to: key)
    }
Severity: Major
Found in Sources/RediStack/Commands/SetCommands.swift and 3 other locations - About 45 mins to fix
Sources/RediStack/Commands/ListCommands.swift on lines 524..527
Sources/RediStack/Commands/SetCommands.swift on lines 202..205
Sources/RediStack/Commands/SortedSetCommands.swift on lines 714..717

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

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

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

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

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

Refactorings

Further Reading

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

    public static func smembers(of key: RedisKey) -> RedisCommand<[RESPValue]> {
        let args = [RESPValue(from: key)]
        return .init(keyword: "SMEMBERS", arguments: args)
    }
Severity: Major
Found in Sources/RediStack/Commands/SetCommands.swift and 2 other locations - About 45 mins to fix
Sources/RediStack/Commands/HashCommands.swift on lines 102..105
Sources/RediStack/Commands/HashCommands.swift on lines 205..208

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

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

    public static func scard(of key: RedisKey) -> RedisCommand<Int> {
        let args = [RESPValue(from: key)]
        return .init(keyword: "SCARD", arguments: args)
    }
Severity: Major
Found in Sources/RediStack/Commands/SetCommands.swift and 6 other locations - About 45 mins to fix
Sources/RediStack/Commands/ConnectionCommands.swift on lines 23..26
Sources/RediStack/Commands/ConnectionCommands.swift on lines 49..52
Sources/RediStack/Commands/ConnectionCommands.swift on lines 56..59
Sources/RediStack/Commands/HashCommands.swift on lines 109..112
Sources/RediStack/Commands/ListCommands.swift on lines 166..169
Sources/RediStack/Commands/SortedSetCommands.swift on lines 166..169

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

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