digitalfabrik/integreat-app

View on GitHub
tools/manage-metadata.ts

Summary

Maintainability
C
7 hrs
Test Coverage

File manage-metadata.ts has 299 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { program } from 'commander'
import yaml from 'js-yaml'
import fs from 'node:fs'
import path from 'node:path'

Severity: Minor
Found in tools/manage-metadata.ts - About 3 hrs to fix

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

    const formatDevelopmentNotes = (params: { notes: NoteType[]; language: string; platforms: string[] }) => {
      const { notes, language, platforms } = params
      const emptyNotesMap = {
        common: [] as NoteType[],
        android: [] as NoteType[],
    Severity: Minor
    Found in tools/manage-metadata.ts - About 1 hr to fix

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

      const writeMetadata = (appName: string, storeName: string, overrideVersionName?: string) => {
        if (storeName !== 'appstore' && storeName !== 'playstore') {
          throw new Error(`Invalid store name ${storeName} passed!`)
        }
      
      
      Severity: Minor
      Found in tools/manage-metadata.ts - About 1 hr to fix

        Function parseReleaseNotes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        const parseReleaseNotes = ({ source, ios, android, web, production, language, appName }: ParseOptions): string => {
          const platforms: string[] = [
            android ? PLATFORM_ANDROID : undefined,
            ios ? PLATFORM_IOS : undefined,
            web ? PLATFORM_WEB : undefined,
        Severity: Minor
        Found in tools/manage-metadata.ts - About 55 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 formatNotes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        const formatNotes = (params: {
          notes: NoteType[]
          language: string
          production: boolean
          platformName?: string
        Severity: Minor
        Found in tools/manage-metadata.ts - 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 formatDevelopmentNotes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const formatDevelopmentNotes = (params: { notes: NoteType[]; language: string; platforms: string[] }) => {
          const { notes, language, platforms } = params
          const emptyNotesMap = {
            common: [] as NoteType[],
            android: [] as NoteType[],
        Severity: Minor
        Found in tools/manage-metadata.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

        There are no issues that match your filters.

        Category
        Status