philips-software/cogito

View on GitHub

Showing 102 of 119 total issues

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

  renderWithStore = ({ telepathError }, dispatch) => (
    <>
      <TelepathStatus>Reading identity...</TelepathStatus>
      <TimedErrorMessage
        error={telepathError}
workspaces/demo-app/src/components/cogito-contract/SimpleStorageFeedback.js on lines 13..21

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

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

  renderWithStore = ({ telepathError }, dispatch) => (
    <>
      <TelepathStatus>Executing contract...</TelepathStatus>
      <TimedErrorMessage
        error={telepathError}
workspaces/demo-app/src/components/cogito-address/IdentityFeedback.js on lines 9..17

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

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 execute has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    func execute() {
        let storyBoard = UIStoryboard(name: "SignTransaction", bundle: nil)
        // swiftlint:disable force_cast
        let viewController = storyBoard.instantiateInitialViewController() as! UINavigationController
        let explanationViewController = viewController.topViewController! as! ExplanationViewController

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

        <EncryptGridItem>
          <Button
            secondary color='black'
            onClick={() => dispatch(
              EncryptionActions.encrypt({
    workspaces/demo-app/src/components/cogito-crypto/CogitoSimpleEncryption.js on lines 70..82

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

    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

        <DecryptGridItem>
          <Button
            secondary color='black'
            onClick={() => dispatch(
              EncryptionActions.decrypt({
    workspaces/demo-app/src/components/cogito-crypto/CogitoSimpleEncryption.js on lines 52..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 68.

    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

    extension Attestation: Equatable {
        public static func == (lhs: Attestation, rhs: Attestation) -> Bool {
            return
                lhs.issuer == rhs.issuer &&
                lhs.attribute == rhs.attribute &&
    workspaces/cogito-ios-app/Cogito/Attestations service/AttestationsState.swift on lines 36..44

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

    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

    extension AttestationInProgress: Equatable {
        static func == (lhs: AttestationInProgress, rhs: AttestationInProgress) -> Bool {
            return lhs.nonce == rhs.nonce &&
                   lhs.subject == rhs.subject &&
                   lhs.identity == rhs.identity &&
    workspaces/cogito-attestations-ios/Attestations/Attestations.swift on lines 81..90

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

    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 FileStreamReaderWorkerScript has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const FileStreamReaderWorkerScript = () => {
      const FileStreamReaderWorker = function (file, callback) {
        // eslint-disable-next-line no-undef
        this.reader = new FileReaderSync()
        this.start = 0

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

      if (module.hot) {
        module.hot.accept('app', () => {
          const NextApp = require('app').default
          ReactDOM.render(
            <NextApp />,
      Severity: Major
      Found in workspaces/cogito-ios-app-distribution/src/index.js and 1 other location - About 1 hr to fix
      workspaces/demo-app/src/index.js on lines 12..17

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

      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

      if (module.hot) {
        module.hot.accept('app', () => {
          const NextApp = require('app').default
          ReactDOM.render(<NextApp />, rootEl)
        })
      Severity: Major
      Found in workspaces/demo-app/src/index.js and 1 other location - About 1 hr to fix
      workspaces/cogito-ios-app-distribution/src/index.js on lines 15..23

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

      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 reducer has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const reducer = (state = initialState, action) => {
        switch (action.type) {
          case 'SET_USER_ACCOUNT':
            return {
              ...state,
      Severity: Minor
      Found in workspaces/demo-app/src/user-data/reducer.js - About 1 hr to fix

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

          constructor ({ provider }) {
            this.provider = provider
            this.requestId = Math.floor(Math.random() * (Number.MAX_SAFE_INTEGER / 2))
          }
        Severity: Major
        Found in workspaces/cogito-web3-provider/source/json-rpc-client.js and 1 other location - About 1 hr to fix
        workspaces/cogito-attestations/source/retriever.js on lines 2..5

        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

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

          constructor ({ telepathChannel }) {
            this.telepathChannel = telepathChannel
            this.requestId = Math.floor(Math.random() * (Number.MAX_SAFE_INTEGER / 2))
          }
        Severity: Major
        Found in workspaces/cogito-attestations/source/retriever.js and 1 other location - About 1 hr to fix
        workspaces/cogito-web3-provider/source/json-rpc-client.js on lines 2..5

        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 attestationsReducer has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        func attestationsReducer(action: Action, state: AttestationsState?) -> AttestationsState {
            var state = state ?? initialAttestationsState
            switch action {
            case let action as OpenIDAttestationActions.Pending:
                state.open[action.nonce] = AttestationInProgress(

          Function Finish has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              static func Finish(params: [String: String]) -> Thunk<AppState> {
                  return Thunk { dispatch, getState in
                      guard let idToken = params["id_token"] else {
                          dispatch(FinishRejected(nonce: nil, error: "id token missing"))
                          return

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

                  const blob =
                    index === this.numberOfChunks - 1
                      ? this.file.slice(this.start)
                      : this.file.slice(this.start, this.endExclusive)
            workspaces/demo-app/src/services/file-reader/FileStreamReaderAsync.js on lines 38..41

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

            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

                const blob =
                  index === this.numberOfChunks - 1
                    ? this.file.slice(this.start)
                    : this.file.slice(this.start, this.endExclusive)
            workspaces/demo-app/src/services/file-reader/FileStreamReaderWorkerScript.js on lines 32..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 62.

            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

            extension ProtoAttestation: Equatable {
                public static func == (lhs: ProtoAttestation, rhs: ProtoAttestation) -> Bool {
                    return
                        lhs.issuer == rhs.issuer &&
                        lhs.attribute == rhs.attribute &&
            workspaces/cogito-ios-app/Cogito/Create identity/CreateIdentityState.swift on lines 35..42

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

            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

            extension CreateIdentityState: Equatable {
                static func == (lhs: CreateIdentityState, rhs: CreateIdentityState) -> Bool {
                    return lhs.description == rhs.description &&
                           lhs.pending == rhs.pending &&
                           lhs.newAddress == rhs.newAddress &&
            workspaces/cogito-attestations-ios/Attestations/Attestations.swift on lines 39..47

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

            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 diamondReducer has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            func diamondReducer(action: Action, state: DiamondState?) -> DiamondState {
                var state = state ?? initialDiamondState
                switch action {
                case let createFacet as DiamondActions.CreateFacet:
                    var newFacets = state.facets
            Severity: Minor
            Found in workspaces/cogito-ios-app/Cogito/Diamond/DiamondReducer.swift - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language