grissius/protocat

View on GitHub

Showing 7 of 7 total issues

Function updateClientInstance has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const updateClientInstance = <C extends grpc.Client>(
  grpcClient: C
): UpdatedClient<C> => {
  const resClient: any = {}
  for (const rpcName in grpcClient) {
Severity: Major
Found in src/lib/client/client.ts - About 3 hrs to fix

    Function wrapToHandler has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const wrapToHandler = (
      methodDefinition: grpc.MethodDefinition<any, any>,
      methodHandler: any
    ) => {
      const type = stubToType(methodDefinition)
    Severity: Minor
    Found in src/lib/server/application.ts - About 1 hr to fix

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

      function Home() {
        const context = useDocusaurusContext()
        const { siteConfig = {} } = context
        return (
          <Layout
      Severity: Minor
      Found in website/src/pages/index.js - About 1 hr to fix

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

          <E = unknown>(
            /** Response binary cache implementation */
            cache: CacheImplementation<E>,
            /** Optional callback to react on cache miss/hit. Called once per request ASAP after cache retrieval */
            cb?: (
        Severity: Minor
        Found in src/lib/server/middleware/cache.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 updateClientInstance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const updateClientInstance = <C extends grpc.Client>(
          grpcClient: C
        ): UpdatedClient<C> => {
          const resClient: any = {}
          for (const rpcName in grpcClient) {
        Severity: Minor
        Found in src/lib/client/client.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 composeMiddleware has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const composeMiddleware = (middleware: Middleware[]): Middleware => {
          return async (call, next) => {
            const dispatch = async (i: number): Promise<void> => {
              // TODO: Maybe throw / log on repeated next
              const fn = i === middleware.length ? next : middleware[i]
        Severity: Minor
        Found in src/lib/server/middleware/compose-middleware.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 createClient has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const createClient = <
          D extends
            | (new (...args: any[]) => grpc.Client)
            | Record<string, new (...args: any[]) => grpc.Client>
        >(
        Severity: Minor
        Found in src/lib/client/client.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