renzholy/mongood

View on GitHub

Showing 62 of 64 total issues

Function DocumentsList has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

export default function DocumentsList() {
  const displayMode = useAppSelector((state) => state.docs.displayMode)
  const [{ conn, database, collection }] = useRouterQuery()
  const connection = useConnection(conn)
  const index = useAppSelector((state) => state.docs.index)
Severity: Minor
Found in src/components/documents-list.tsx - About 5 hrs 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 stringify has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

export function stringify(
  val: MongoData,
  hasIndent = false,
  depth = 0,
): string {
Severity: Minor
Found in src/utils/ejson.ts - About 4 hrs 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 DatabaseNav has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

export default function DatabaseNav() {
  const theme = getTheme()
  const [{ conn, database, collection }, setRoute] = useRouterQuery()
  const expandedDatabases = useAppSelector(
    (state) => state.root.expandedDatabases,
Severity: Minor
Found in src/components/database-nav.tsx - About 3 hrs 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 ConnectionItem has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

function ConnectionItem(props: { connection: string; disabled?: boolean }) {
  const uri = useMemo(() => {
    try {
      return mongodbUri.parse(props.connection)
    } catch {
Severity: Minor
Found in src/components/connection-edit-modal.tsx - About 3 hrs 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 IndexFeatures has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

export default function IndexFeatures(props: { value: IndexDescription }) {
  const features = useMemo<{ text: string; data: object }[]>(
    () =>
      compact([
        size(props.value.key) > 1 && !('textIndexVersion' in props.value)
Severity: Minor
Found in src/components/pure/index-features.tsx - About 2 hrs 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 generate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function generate(doc: MongoData): Schema {
  if (typeof doc === 'string') {
    return {
      bsonType: ['string'],
    }
Severity: Minor
Found in src/utils/schema.ts - About 2 hrs 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 ProfilingSummary has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

export default function ProfilingSummary() {
  const [{ conn }, setRoute] = useRouterQuery()
  const connection = useConnection(conn)
  const { data: databases } = useCommandDatabases()
  const { data: hosts } = useCommandIsMaster()
Severity: Minor
Found in src/components/profiling-summary.tsx - About 1 hr 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 OperationsList has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

export default function OperationsList() {
  const { data, error, mutate } = useCommandCurrentOp()
  const [{ conn, collection }, setRoute] = useRouterQuery()
  const connection = useConnection(conn)
  const [target, setTarget] = useState<MouseEvent>()
Severity: Minor
Found in src/components/operations-list.tsx - About 1 hr 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 IndexesList has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

export default function IndexesList() {
  const { data } = useCommandIndexStats()
  const { data: collStats, error: collStatsError } = useCommandCollStats()
  const { data: indexes, error: indexesError, mutate } = useCommandListIndexes()
  const [{ conn, database, collection }] = useRouterQuery()
Severity: Minor
Found in src/components/indexes-list.tsx - About 1 hr 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 ProfilingList has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export default function ProfilingList() {
  const { data, error } = useCommandSystemProfileFind()
  const [{ collection }] = useRouterQuery()
  const invokedProfiling = useAppSelector(
    (state) => state.profiling.invokedProfiling,
Severity: Minor
Found in src/components/profiling-list.tsx - About 1 hr 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 Schema has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export default function Schema() {
  const [{ conn, database, collection }] = useRouterQuery()
  const { data, mutate } = useCommandListCollections()
  const isDarkMode = useDarkMode()
  const [validationAction, setValidationAction] =
Severity: Minor
Found in src/pages/schema.tsx - About 1 hr 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 parse has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  parse(uri: string): UriObject {
    const uriObject: UriObject = { hosts: [] }

    let i = uri.indexOf('://')
    if (i < 0) {
Severity: Minor
Found in src/utils/mongo-uri.ts - About 1 hr 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 getItem has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function getItem<T>(
  type: StorageType,
  key: string,
): string | number | T | undefined {
  if (typeof window === 'undefined') {
Severity: Minor
Found in src/utils/storage.ts - About 1 hr 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 ExecStage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export default function ExecStage(props: {
  value?: { [key: string]: MongoData }
}) {
  const theme = getTheme()
  const value = useMemo<ExecStats | undefined>(
Severity: Minor
Found in src/components/pure/exec-stage.tsx - About 1 hr 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 format has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  format(uriObject: UriObject) {
    if (!uriObject) {
      return (this.scheme || 'mongodb') + '://localhost'
    }

Severity: Minor
Found in src/utils/mongo-uri.ts - About 1 hr 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

Consider simplifying this complex logical expression.
Open

              if (databaseMatched || collectionMatched) {
                return {
                  key: _database,
                  name: _database,
                  title: _database,
Severity: Major
Found in src/components/database-nav.tsx - About 1 hr to fix

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

    export default function DocumentRowContextualMenu<
      T extends { [key: string]: MongoData },
    >(props: {
      hidden: boolean
      onDismiss(): void
    Severity: Minor
    Found in src/components/document-row-contextual-menu.tsx - 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 EditorModal has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function EditorModal<T extends MongoData>(props: {
      title: string
      readOnly?: boolean
      value?: T
      onChange?(value: T): void
    Severity: Minor
    Found in src/components/pure/editor-modal.tsx - 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 create has 5 return statements (exceeds 4 allowed).
    Open

    func create(uri string) (*mongo.Client, error) {
        if cached, ok := clients.Load(uri); ok && cached != nil {
            return cached.(*mongo.Client), nil
        }
    
    
    Severity: Major
    Found in go/main.go - About 35 mins to fix

      Function IndexCell has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function IndexCell(props: {
        item: IndexDescription
        column: IColumn
        size?: number
        accesses?: { ops: number; since: Date }
      Severity: Minor
      Found in src/components/pure/index-cell.tsx - 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

      Severity
      Category
      Status
      Source
      Language