championswimmer/vuex-module-decorators

View on GitHub

Showing 5 of 5 total issues

Function mutationActionDecoratorFactory has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function mutationActionDecoratorFactory<T extends Object>(params: MutationActionParams<T>) {
  return function (
    target: T,
    key: string | symbol,
    descriptor: TypedPropertyDescriptor<(...args: any[]) => Promise<Partial<T> | undefined>>
Severity: Major
Found in src/mutationaction.ts - About 2 hrs to fix

    Function moduleDecoratorFactory has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function moduleDecoratorFactory<S>(moduleOptions: ModuleOptions) {
      return function <TFunction extends Function>(constructor: TFunction): TFunction | void {
        const module: Function & Mod<S, any> = constructor
        const stateFactory = () => sf(module)
    
    
    Severity: Minor
    Found in src/module/index.ts - About 2 hrs to fix

      Function actionDecoratorFactory has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function actionDecoratorFactory<T>(params?: ActionDecoratorParams): MethodDecorator {
        const { commit = undefined, rawError = !!config.rawError, root = false } = params || {}
        return function (target: Object, key: string | symbol, descriptor: TypedPropertyDescriptor<any>) {
          const module = target.constructor as Mod<T, any>
          if (!module.hasOwnProperty('actions')) {
      Severity: Minor
      Found in src/action.ts - About 1 hr to fix

        Function action has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            const action: Act<typeof target, any> = async function (
              context: ActionContext<typeof target, any>,
              payload: Payload
            ) {
              try {
        Severity: Minor
        Found in src/action.ts - About 1 hr to fix

          Function getModule has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          export function getModule<M extends VuexModule>(
            moduleClass: ConstructorOf<M>,
            store?: Store<any>
          ): M {
            const moduleName = getModuleName(moduleClass)
          Severity: Minor
          Found in src/vuexmodule.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