Bloombox/Swift

View on GitHub

Showing 103 of 106 total issues

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

    if let c = context {
      var exported = c.export()
      let globalContext = settings.export()
      let serialized = try globalContext.serializedData()
      try exported.merge(serializedData: serialized)
Severity: Major
Found in Sources/Client/TelemetryClient+Commercial.swift and 2 other locations - About 1 hr to fix
Sources/Client/TelemetryClient+Generic.swift on lines 181..189
Sources/Client/TelemetryClient+Search.swift on lines 66..74

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

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

    if let c = context {
      var exported = c.export()
      let globalContext = settings.export()
      let serialized = try globalContext.serializedData()
      try exported.merge(serializedData: serialized)
Severity: Major
Found in Sources/Client/TelemetryClient+Search.swift and 2 other locations - About 1 hr to fix
Sources/Client/TelemetryClient+Commercial.swift on lines 99..107
Sources/Client/TelemetryClient+Generic.swift on lines 181..189

Duplicated Code

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

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

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

Tuning

This issue has a mass of 73.

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

    if let c = context {
      var exported = c.export()
      let globalContext = settings.export()
      let serialized = try globalContext.serializedData()
      try exported.merge(serializedData: serialized)
Severity: Major
Found in Sources/Client/TelemetryClient+Generic.swift and 2 other locations - About 1 hr to fix
Sources/Client/TelemetryClient+Commercial.swift on lines 99..107
Sources/Client/TelemetryClient+Search.swift on lines 66..74

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

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

Function checkinByCard has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

  public func checkinByCard(cardType: String,
                            payload: String,
                            signature: String? = nil,
                            partner: PartnerCode? = nil,
                            location: LocationCode? = nil,
Severity: Major
Found in Sources/Client/CheckinClient.swift - About 1 hr to fix

    Function resolveSearchContext has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      fileprivate func resolveSearchContext(method: SearchEvent,
                                            activeUser: UserKey? = nil,
                                            activeOrder: OrderID? = nil,
                                            partner: PartnerCode? = nil,
                                            location: LocationCode? = nil,
    Severity: Major
    Found in Sources/Client/TelemetryClient+Search.swift - About 1 hr to fix

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

          return try self.service(apiKey).shopInfo(ShopInfo.Request.with { builder in
            builder.location = LocationKey.with { builder in
              builder.code = locationCode
              builder.partner = PartnerKey.with { builder in
                builder.code = partnerCode
      Severity: Minor
      Found in Sources/Client/ShopClient.swift and 1 other location - About 55 mins to fix
      Sources/Client/ShopClient.swift on lines 241..248

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

      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

          return try self.service(apiKey).shopInfo(ShopInfo.Request.with { builder in
            builder.location = LocationKey.with { builder in
              builder.code = locationCode
              builder.partner = PartnerKey.with { builder in
                builder.code = partnerCode
      Severity: Minor
      Found in Sources/Client/ShopClient.swift and 1 other location - About 55 mins to fix
      Sources/Client/ShopClient.swift on lines 267..276

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

      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

      Function checkinByCard has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        public func checkinByCard(cardType: String,
                                  payload: String,
                                  signature: String? = nil,
                                  partner: PartnerCode? = nil,
                                  location: LocationCode? = nil,
      Severity: Major
      Found in Sources/Client/CheckinClient.swift - About 50 mins to fix

        Function checkinByID has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          public func checkinByID(scan: String,
                                  partner: PartnerCode? = nil,
                                  location: LocationCode? = nil,
                                  deviceName: DeviceCode? = nil,
                                  fingerprint: String? = nil,
        Severity: Major
        Found in Sources/Client/CheckinClient.swift - About 50 mins to fix

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

              return try self.service(apiKey).card(CheckinByCard.Request.with { builder in
                builder.cardType = cardType
                builder.payload = payload
                builder.agent = deviceName
                builder.scope = "partner/\(partnerCode)/location/\(locationCode)"
          Severity: Minor
          Found in Sources/Client/CheckinClient.swift and 1 other location - About 50 mins to fix
          Sources/Client/CheckinClient.swift on lines 252..260

          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

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

              return try service.card(CheckinByCard.Request.with { builder in
                builder.cardType = cardType
                builder.payload = payload
                builder.agent = deviceName
                builder.scope = "partner/\(partnerCode)/location/\(locationCode)"
          Severity: Minor
          Found in Sources/Client/CheckinClient.swift and 1 other location - About 50 mins to fix
          Sources/Client/CheckinClient.swift on lines 290..300

          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

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

              return try service.activate(DeviceActivation.Request.with { builder in
                builder.serial = name
          
                if let f = fingerprint {
                  builder.fingerprint = f
          Severity: Minor
          Found in Sources/Client/DevicesClient.swift and 1 other location - About 45 mins to fix
          Sources/Client/DevicesClient.swift on lines 146..155

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

          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

              return try service.activate(DeviceActivation.Request.with { builder in
                builder.serial = name
          
                if let f = fingerprint {
                  builder.fingerprint = f
          Severity: Minor
          Found in Sources/Client/DevicesClient.swift and 1 other location - About 45 mins to fix
          Sources/Client/DevicesClient.swift on lines 178..189

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 57.

          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

          Function getOrder has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            public func getOrder(id: OrderID,
                                 isLocal: Bool = false,
                                 partner: PartnerCode? = nil,
                                 location: LocationCode? = nil,
                                 apiKey: APIKey? = nil,
          Severity: Minor
          Found in Sources/Client/ShopClient.swift - About 45 mins to fix

            Function event has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              public func event(collection: EventCollection,
                                uuid: String? = nil,
                                payload: [String: Any]? = nil,
                                occurred: Double? = nil,
                                context: EventContext? = nil,
            Severity: Minor
            Found in Sources/Client/TelemetryClient+Generic.swift - About 45 mins to fix

              Function checkinByID has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                public func checkinByID(scan: String,
                                        partner: PartnerCode? = nil,
                                        location: LocationCode? = nil,
                                        deviceName: DeviceCode? = nil,
                                        fingerprint: String? = nil,
              Severity: Minor
              Found in Sources/Client/CheckinClient.swift - About 45 mins to fix

                Function submitOrder has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  public func submitOrder(order: Order,
                                          partner: PartnerCode? = nil,
                                          location: LocationCode? = nil,
                                          deviceName: DeviceCode? = nil,
                                          apiKey: APIKey? = nil,
                Severity: Minor
                Found in Sources/Client/ShopClient.swift - About 45 mins to fix

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

                      return try service.identification(CheckinByID.Request.with { builder in
                        builder.raw = scan
                        builder.serialNumber = deviceName
                        builder.scope = "partner/\(partnerCode)/location/\(locationCode)"
                        if let f = fingerprint {
                  Severity: Minor
                  Found in Sources/Client/CheckinClient.swift and 1 other location - About 45 mins to fix
                  Sources/Client/CheckinClient.swift on lines 211..220

                  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

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

                      return try self.service(apiKey).identification(CheckinByID.Request.with { builder in
                        builder.raw = scan
                        builder.serialNumber = deviceName
                        builder.scope = "partner/\(partnerCode)/location/\(locationCode)"
                        if let f = fingerprint {
                  Severity: Minor
                  Found in Sources/Client/CheckinClient.swift and 1 other location - About 45 mins to fix
                  Sources/Client/CheckinClient.swift on lines 174..181

                  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

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

                      return try self.service(try resolveContext(apiKey)).keyResolve(ResolveKey.Request.with { builder in
                        // we support SHA1 and MD5 here, for now
                        switch algorithm {
                        case .sha1: builder.sha1 = subject
                        case .md5: builder.md5 = subject
                  Severity: Minor
                  Found in Sources/Client/IdentityClient.swift and 1 other location - About 45 mins to fix
                  Sources/Client/IdentityClient.swift on lines 226..235

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

                  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