sinProject-Inc/talk

View on GitHub

Showing 76 of 83 total issues

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

it('just long enough', () => {
    expect(() => {
        PinCode.generate(50)
    }).not.toThrow()
})
Severity: Minor
Found in src/lib/auth/pin_code.test.ts and 1 other location - About 35 mins to fix
src/lib/auth/pin_code.test.ts on lines 22..26

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

it('pin_code_lifetime_sec', async () => {
    expect(await Repository.app_setting.get_number(SettingKey.pin_code_lifetime_sec)).toEqual(300)
})
Severity: Minor
Found in src/lib/app/app_setting_repository.test.ts and 1 other location - About 35 mins to fix
src/lib/app/app_setting_repository.test.ts on lines 15..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 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

it('undefined: test_key', async () => {
    expect(await Repository.app_setting.get_number(SettingKey.test_key)).toEqual(0)
})
Severity: Minor
Found in src/lib/app/app_setting_repository.test.ts and 1 other location - About 35 mins to fix
src/lib/app/app_setting_repository.test.ts on lines 11..13

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

it('just short enough', () => {
    expect(() => {
        PinCode.generate(6)
    }).not.toThrow()
})
Severity: Minor
Found in src/lib/auth/pin_code.test.ts and 1 other location - About 35 mins to fix
src/lib/auth/pin_code.test.ts on lines 28..32

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

Avoid too many return statements within this function.
Open

        return true
Severity: Major
Found in src/lib/view/event_key.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            if (this._event.metaKey) return false
    Severity: Major
    Found in src/lib/view/event_key.ts - About 30 mins to fix

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

          test('indent message', async ({ page }) => {
              const input = 'Hello World!\nHello World!'
              const output = 'Hello World!\nHello World!'
      
              await test_send(page, input, output)
      Severity: Major
      Found in e2e/chat.spec.ts and 3 other locations - About 30 mins to fix
      e2e/chat.spec.ts on lines 99..104
      e2e/chat.spec.ts on lines 106..111
      e2e/chat.spec.ts on lines 120..125

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

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

          test('send message', async ({ page }) => {
              const input = 'Hello World!'
              const output = 'Hello World!'
      
              await test_send(page, input, output)
      Severity: Major
      Found in e2e/chat.spec.ts and 3 other locations - About 30 mins to fix
      e2e/chat.spec.ts on lines 106..111
      e2e/chat.spec.ts on lines 113..118
      e2e/chat.spec.ts on lines 120..125

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

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

          test('excess indentions', async ({ page }) => {
              const input = 'Hello World!\n\n\n\nHello World!'
              const output = 'Hello World!\n\nHello World!'
      
              await test_send(page, input, output)
      Severity: Major
      Found in e2e/chat.spec.ts and 3 other locations - About 30 mins to fix
      e2e/chat.spec.ts on lines 99..104
      e2e/chat.spec.ts on lines 106..111
      e2e/chat.spec.ts on lines 113..118

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

      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

      Avoid too many return statements within this function.
      Open

                  return OS.linux
      Severity: Major
      Found in src/lib/view/os_info.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return ''
        Severity: Major
        Found in src/lib/translation/translate_with_google_advanced.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return OS.unknown
          Severity: Major
          Found in src/lib/view/os_info.ts - About 30 mins to fix

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

                test('trim message', async ({ page }) => {
                    const input = '\nHello World!\n'
                    const output = 'Hello World!'
            
                    await test_send(page, input, output)
            Severity: Major
            Found in e2e/chat.spec.ts and 3 other locations - About 30 mins to fix
            e2e/chat.spec.ts on lines 99..104
            e2e/chat.spec.ts on lines 113..118
            e2e/chat.spec.ts on lines 120..125

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

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

                public static get_os(): OS {
                    const user_agent = window.navigator.userAgent
                    const platform = navigator?.userAgentData?.platform || navigator?.platform
            
                    if (this._macos_platforms.includes(platform)) {
            Severity: Minor
            Found in src/lib/view/os_info.ts - About 25 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 get_speech_sounds has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            async function get_speech_sounds(
                speech_texts: SpeechText[],
                locale_code: LocaleCode
            ): Promise<SpeechSound[]> {
                const speech_sounds: SpeechSound[] = []

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

                private _set_on_result(): void {
                    this._final_transcript = ''
            
                    // eslint-disable-next-line @typescript-eslint/no-explicit-any
                    this._recognition.onresult = (event: any): void => {
            Severity: Minor
            Found in src/lib/speech/web_speech_recognition.ts - About 25 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

            Severity
            Category
            Status
            Source
            Language