Showing 7 of 7 total issues
Function Home
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
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',
Function askGPT
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const askGPT = async (text: string, prompt: string): Promise<string> => {
const {
data: {
choices: [{ message: { content: content } = { content: '' } }],
},
Function generatePRBody
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const generatePRBody = (
inputFilePaths: string[],
outputFilePaths: string[] | string[][],
targetLang: string | string[],
issueNumber?: number,
Function generateOutputFilePaths
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const generateOutputFilePaths = (
inputFilePaths: string[],
outputFilePath: string,
): string[] => {
const outputSegments = path.normalize(outputFilePath).split(path.sep)
Function translateByManual
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const translateByManual = async (
inputFiles: string[],
outputFiles: string[],
languages: string[],
) => {
Function translateByCommand
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const translateByCommand = async (
inputFilePath: string,
outputFilePath: string,
targetLang: string,
) => {
Function commandValidator
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
export const commandValidator = async (
userCommand: string | undefined,
match: RegExpExecArray | null,
): Promise<{
inputFilePath: string
- Read upRead up
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"