sinProject-Inc/talk

View on GitHub

Showing 14 of 83 total issues

Function get_pin_code_from_mail has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function get_pin_code_from_mail(): Promise<string> {
    const gmail_user = process.env.GMAIL_USER ?? ''
    const gmail_password = process.env.GMAIL_PASS ?? ''

    // expect(gmail_user).toBeDefined()
Severity: Minor
Found in e2e/lib/get_pin_code_from_mail.ts - About 1 hr to fix

    Function find_many has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public async find_many(text_id: TextId, locale_code: LocaleCode): Promise<Text[]> {
            const text_repository: TextRepository = new TextRepositoryPrisma(this._prisma_client)
            const text = await text_repository.find_by_id(text_id)
            const locale_repository: LocaleRepository = new LocaleRepositoryPrisma(this._prisma_client)
            const locale = await locale_repository.find_unique(locale_code)
    Severity: Minor
    Found in src/lib/translation/translation_repository_prisma.ts - About 1 hr to fix

      Function execute has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public async execute(): Promise<Text[]> {
              const text_id = new TextId(this._text.id)
      
              const found_translations = await this._translation_repository.find_many(
                  text_id,
      Severity: Minor
      Found in src/lib/translation/get_translation_service.ts - About 1 hr to fix

        Function speak has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public async speak(): Promise<SpeechSound> {
                const speech_config = MicrosoftSpeechSdk.SpeechConfig.fromSubscription(
                    MICROSOFT_SPEECH_KEY,
                    SpeechByMicrosoft._region
                )
        Severity: Minor
        Found in src/lib/speech/speech_by_microsoft.ts - About 1 hr to fix

          Function execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public async execute(): Promise<Text[]> {
                  const text_id = new TextId(this._text.id)
          
                  const found_translations = await this._translation_repository.find_many(
                      text_id,
          Severity: Minor
          Found in src/lib/translation/get_translation_service.ts - About 45 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 execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public async execute(): Promise<Text> {
                  const found_text = await this._text_repository.find(this._locale_code, this._speech_text)
          
                  if (found_text) return found_text
          
          
          Severity: Minor
          Found in src/lib/text/get_text_service.ts - About 45 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

          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

              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

                    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