feathersjs/feathers

View on GitHub

Showing 13 of 36 total issues

File adapter.ts has 503 lines of code (exceeds 300 allowed). Consider refactoring.
Open

import {
  ObjectId,
  Collection,
  FindOptions,
  BulkWriteOptions,
Severity: Major
Found in packages/mongodb/src/adapter.ts - About 6 hrs to fix

    File config.sidebar.ts has 491 lines of code (exceeds 300 allowed). Consider refactoring.
    Open

    const comparisonSidebar = [
      {
        text: 'Compare Feathers',
        items: [
          {
    Severity: Minor
    Found in docs/.vitepress/config.sidebar.ts - About 6 hrs to fix

      Function feathersExpress has a Cognitive Complexity of 29 (exceeds 8 allowed). Consider refactoring.
      Open

      export default function feathersExpress<S = any, C = any>(
        feathersApp?: FeathersApplication<S, C>,
        expressApp: Express = express()
      ): Application<S, C> {
        if (!feathersApp) {
      Severity: Minor
      Found in packages/express/src/index.ts - 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 _find has a Cognitive Complexity of 23 (exceeds 8 allowed). Consider refactoring.
      Open

        async _find(params: ServiceParams = {} as ServiceParams): Promise<Paginated<Result> | Result[]> {
          const { paginate } = this.getOptions(params)
          const { query, filters } = this.getQuery(params)
      
          let values = _.values(this.store)
      Severity: Minor
      Found in packages/memory/src/index.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 useQuery has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring.
      Open

      export const useQuery = <T extends FieldType>(reference: Ref<T>, field: string) => {
        function getQuery() {
          return queryString.parse(window.location.search, {
            parseNumbers: true,
            parseBooleans: true,
      Severity: Minor
      Found in docs/ecosystem/useQuery.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 generate has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
      Open

      export const generate = (ctx: ServiceGeneratorArguments) =>
        Promise.resolve(ctx)
          .then(initializeBaseContext())
          .then(checkPreconditions())
          .then(
      Severity: Minor
      Found in packages/generators/src/service/index.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 resolveExternal has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
      Open

        <H extends HookContext>(...resolvers: Resolver<any, H>[]) =>
        async (context: H, next: NextFunction) => {
          if (typeof next !== 'function') {
            throw new Error('The resolveExternal hook must be used as an around hook')
          }
      Severity: Minor
      Found in packages/schema/src/hooks/resolve.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 errorHandler has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring.
      Open

      export function errorHandler(error: any) {
        const { message } = error
        let feathersError = error
      
        if (error.sqlState && error.sqlState.length) {
      Severity: Minor
      Found in packages/knex/src/error-handler.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 redirectHook has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
      Open

      export const redirectHook = () => async (context: HookContext, next: NextFunction) => {
        try {
          await next()
      
          const { location } = context.result
      Severity: Minor
      Found in packages/authentication-oauth/src/service.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 _find has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
      Open

        async _find(params: ServiceParams = {} as ServiceParams): Promise<Paginated<Result> | Result[]> {
          const { filters, paginate } = this.filterQuery(params)
          const { name, id } = this.getOptions(params)
          const builder = params.knex ? params.knex.clone() : this.createQuery(params)
          const countBuilder = builder.clone().clearSelect().clearOrder().count(`${name}.${id} as total`)
      Severity: Minor
      Found in packages/knex/src/adapter.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

      Function oauth has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
      Open

        (settings: Partial<OauthSetupSettings> = {}) =>
        (app: Application) => {
          const authService = app.defaultAuthentication ? app.defaultAuthentication(settings.authService) : null
      
          if (!authService) {
      Severity: Minor
      Found in packages/authentication-oauth/src/index.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

      Function errorHandler has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring.
      Open

      export const errorHandler = () => async (ctx: FeathersKoaContext, next: () => Promise<any>) => {
        try {
          await next()
      
          if (ctx.body === undefined) {
      Severity: Minor
      Found in packages/koa/src/handlers.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 lookup has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
      Open

        lookup(path: string[], info: LookupData): LookupResult<T> | null {
          if (path.length === this.depth) {
            return this.data === undefined
              ? null
              : {
      Severity: Minor
      Found in packages/transport-commons/src/routing/router.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