3ru/gpt-translate

View on GitHub

Showing 6 of 6 total issues

Function Home has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const Home = () => {
  return (
    <div
      className={[
        'mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 pb-16 pt-20 lg:pt-32 text-center',
Severity: Minor
Found in website/src/components/Home.tsx - About 1 hr to fix

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

    export const generatePRBody = (
      inputFilePaths: string[],
      outputFilePaths: string[] | string[][],
      targetLang: string | string[],
      issueNumber?: number,
    Severity: Minor
    Found in src/utils.ts - About 1 hr to fix

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

      export const generateOutputFilePaths = (
        inputFilePaths: string[],
        outputFilePath: string,
      ): string[] => {
        const outputSegments = path.normalize(outputFilePath).split(path.sep)
      Severity: Minor
      Found in src/file.ts - About 1 hr to fix

        Function translateByManual has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const translateByManual = async (
          inputFiles: string[],
          outputFiles: string[],
          languages: string[],
        ) => {
        Severity: Minor
        Found in src/translate.ts - About 1 hr to fix

          Function translateByCommand has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const translateByCommand = async (
            inputFilePath: string,
            outputFilePath: string,
            targetLang: string,
          ) => {
          Severity: Minor
          Found in src/translate.ts - About 1 hr to fix

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

            export const commandValidator = async (
              userCommand: string | undefined,
              match: RegExpExecArray | null,
            ): Promise<{
              inputFilePath: string
            Severity: Minor
            Found in src/validate.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

            Severity
            Category
            Status
            Source
            Language