philips-software/cogito

View on GitHub

Showing 102 of 119 total issues

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

        guard let cipherTextHex = request.params["cipherText"].string else {
            store.dispatch(TelepathActions.Send(id: request.id, error: EncryptionError.cipherTextMissing, on: channel))
            return
        }
workspaces/cogito-ios-app/Cogito/Encryption service/EncryptionService.swift on lines 40..43
workspaces/cogito-ios-app/Cogito/Encryption service/EncryptionService.swift on lines 54..57

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

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

        guard let tag = request.params["tag"].string else {
            store.dispatch(TelepathActions.Send(id: request.id, error: EncryptionError.tagMissing, on: channel))
            return
        }
workspaces/cogito-ios-app/Cogito/Encryption service/EncryptionService.swift on lines 54..57
workspaces/cogito-ios-app/Cogito/Encryption service/EncryptionService.swift on lines 59..62

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

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

        guard let tag = request.params["tag"].string else {
            store.dispatch(TelepathActions.Send(id: request.id, error: EncryptionError.tagMissing, on: channel))
            return
        }
workspaces/cogito-ios-app/Cogito/Encryption service/EncryptionService.swift on lines 40..43
workspaces/cogito-ios-app/Cogito/Encryption service/EncryptionService.swift on lines 59..62

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

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 GetAttestations has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    static func GetAttestations(requestId: JsonRpcId,
                                applicationName: String,
                                oidcRealmUrl: String,
                                subject: String?,
                                channel: TelepathChannel) -> Thunk<AppState> {

    Function StartAttestation has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            for identity: Identity,
            requestId: JsonRpcId,
            oidcRealmUrl: URL,
            subject: String?,
            requestedOnChannel channelId: ChannelID? = nil) -> Thunk<AppState> {

      Function send has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          static func send(requestId: JsonRpcId,
                           idToken: String,
                           dispatch: DispatchFunction,
                           state: AppState,
                           on channel: TelepathChannel) {

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

        private func mapDispatchToActions(dispatch: @escaping DispatchFunction)
            -> SelectedFacetViewController.Actions {
            return SelectedFacetViewController.Actions(
                resetCreateIdentity: { dispatch(CreateIdentityActions.ResetForm()) }
            )
        workspaces/cogito-ios-app/Cogito/Dialog presenter/DialogPresenter.swift on lines 92..96

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

        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

        private func mapDispatchToActions(dispatch: @escaping DispatchFunction) -> DialogPresenter.Actions {
            return DialogPresenter.Actions(
                didDismissAlert: { dispatch(DialogPresenterActions.DidDismissAlert()) }
            )
        }
        workspaces/cogito-ios-app/Cogito/Home/SelectedFacetViewController.swift on lines 130..135

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

        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 attempt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          async attempt () {
            while (this.waiting[0] && this.waiting[0].expiry <= this.currentAttempt) {
              this.waiting.shift().resolve(null)
            }
            if (this.waiting.length === 0) {
        Severity: Minor
        Found in workspaces/telepath-js/source/poller.js - About 35 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function diamondReducer has a Cognitive Complexity of 7 (exceeds 5 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 35 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function bindToViewModel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            func bindToViewModel() {
                self.tableView.dataSource = nil
        
                let dataSource = RxTableViewSectionedReloadDataSource<ViewModel.SectionModel>(
                    configureCell: { dataSource, table, indexPath, _ in

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function getWeb3 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        const getWeb3 = () =>
          new Promise((resolve) => {
            if (process.env.REACT_APP_USE_INJECTED_WEB3 === 'YES') {
              console.log('will try to use injected web3 if possible')
              /* istanbul ignore else  */
        Severity: Minor
        Found in workspaces/cogito-ethereum/source/getWeb3.js - About 35 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function receive has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public func receive(completion: @escaping (String?, Error?) -> Void) {
                queuing.receive(queueId: receivingQueue) { data, error in
                    guard error == nil else {
                        completion(nil, Failure.receivingFailed(cause: error!))
                        return
        Severity: Minor
        Found in workspaces/telepath-ios/Telepath/SecureChannel.swift - About 35 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function FileStreamReaderWorkerScript has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

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

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

            init(requestId: JsonRpcId,
                 applicationName: String,
                 oidcRealmUrl: URL,
                 subject: String?,
                 dispatch: @escaping DispatchFunction,
        workspaces/cogito-ios-app/Cogito/Geth/Transaction.swift on lines 40..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 43.

        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

        const Wrapper = styled.div({
          display: 'flex',
          flexFlow: 'column nowrap',
          justifyContent: 'center',
          alignItems: 'center',
        workspaces/homepage/src/pages/index.js on lines 63..70

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

        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

        const Page = styled.div({
          marginTop: '3rem',
          marginLeft: 'auto',
          marginRight: 'auto',
          maxWidth: '40rem',
        Severity: Minor
        Found in workspaces/homepage/src/pages/index.js and 1 other location - About 35 mins to fix
        workspaces/homepage/src/@confluenza/gatsby-theme-confluenza/components/home/index.js on lines 5..12

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

        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

            init(
                from: Address,
                to: Address,
                data: Data,
                nonce: BigInt,
        Severity: Minor
        Found in workspaces/cogito-ios-app/Cogito/Geth/Transaction.swift and 1 other location - About 35 mins to fix
        workspaces/cogito-ios-app/Cogito/Attestations service/GetAttestationsBuilder.swift on lines 80..96

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

        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

        import ReSwift
        
        func diamondReducer(action: Action, state: DiamondState?) -> DiamondState {
            var state = state ?? initialDiamondState
            switch action {
        Severity: Minor
        Found in workspaces/cogito-ios-app/Cogito/Diamond/DiamondReducer.swift and 1 other location - About 30 mins to fix
        workspaces/cogito-ios-app/Cogito/Diamond/DiamondReducer.swift on lines 1..37

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

        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 findChannel(id: ChannelID) -> TelepathChannel? {
                return channels.keys.first { $0.id == id }
            }
        Severity: Minor
        Found in workspaces/cogito-ios-app/Cogito/Telepath/TelepathState.swift and 1 other location - About 30 mins to fix
        workspaces/cogito-ios-app/Cogito/Diamond/DiamondState.swift on lines 22..24

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

        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