mAAdhaTTah/brookjs

View on GitHub

Showing 36 of 74 total issues

File selectors.ts has 510 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// @todo: readd NpmInstallPlugin
// @todo: clean up this file (extra functions, commented out code, etc.)
import path from 'path';
// import address from 'address';
import webpack, { Loader } from 'webpack';
Severity: Major
Found in packages/brookjs-cli/src/webpack/selectors.ts - About 1 day to fix

    Function reducer has 91 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const reducer = (state: State, action: Action): State => {
      switch (action.type) {
        case 'INPUT':
          // Only handle input on configure step.
          if (state.step !== 'configure') {
    Severity: Major
    Found in packages/brookjs-cli/src/commands/NewCommand/reducer.ts - About 3 hrs to fix

      Function selectWebpackConfig has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const selectWebpackConfig = (
        state: BuildConfig,
      ): webpack.Configuration => {
        let entry = selectWebpackEntry(state);
      
      
      Severity: Major
      Found in packages/brookjs-cli/src/webpack/selectors.ts - About 2 hrs to fix

        Function reducer has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        const reducer = (state: State, action: Action): State => {
          switch (action.type) {
            case 'INPUT':
              // Only handle input on configure step.
              if (state.step !== 'configure') {
        Severity: Minor
        Found in packages/brookjs-cli/src/commands/NewCommand/reducer.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 toJunction has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function toJunction<E extends { [key: string]: any }>(
          _events: Events<E> | Combiner = {} as Events<E>,
          _combine: Combiner = id,
        ) {
          let events: Events<E>, combine: Combiner;
        Severity: Minor
        Found in packages/brookjs-silt/src/toJunction.tsx - About 1 hr to fix

          Function selectStyleLoaders has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const selectStyleLoaders = (
            state: BuildConfig,
            cssLoaderOptions: object,
            preProcessor?: string,
          ) => {
          Severity: Minor
          Found in packages/brookjs-cli/src/webpack/selectors.ts - About 1 hr to fix

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

              static load(target: string) {
                const filename = App.resolve(target);
            
                const oldNodeEnv = process.env.NODE_ENV;
                process.env.NODE_ENV = 'production';
            Severity: Minor
            Found in packages/brookjs-cli/src/cli/App.tsx - About 1 hr to fix

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

              export const reducer: EddyReducer<State, Action> = (
                state = initialState('/', null),
                action,
              ) => {
                switch (action.type) {
              Severity: Minor
              Found in packages/brookjs-cli/src/commands/TestCommand/Check/reducer.tsx - About 1 hr to fix

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

                export const reducer: EddyReducer<State, Action> = (
                  state = initialState('/', null),
                  action,
                ) => {
                  switch (action.type) {
                Severity: Minor
                Found in packages/brookjs-cli/src/commands/TestCommand/Lint/reducer.tsx - About 1 hr to fix

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

                  export function observeDelta<A extends { type: string }, S>(
                    ...sources: Delta<A, S>[]
                  ): Middleware<Ext, S> {
                    return store => {
                      const action$: Stream<A, never> = new (Kefir as any).Stream().setName(
                  Severity: Minor
                  Found in packages/brookjs-eddy/src/observeDelta.ts - About 1 hr to fix

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

                    const selectEnvPlugins = (state: BuildConfig) => {
                      const plugins = state.watch
                        ? [
                            // If you require a missing module and then `npm install` it, you still have
                            // to restart the development server for Webpack to discover it. This plugin
                    Severity: Minor
                    Found in packages/brookjs-cli/src/webpack/selectors.ts - About 1 hr to fix

                      Function exec has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const exec: Delta<Action, State> = (action$, state$) => {
                        const glob$ = glob.delta(
                          action$.thru(ofType(glob.actions.format.request)),
                          state$.map(state => ({
                            cwd: state.cwd,
                      Severity: Minor
                      Found in packages/brookjs-cli/src/commands/FormatCommand/index.tsx - About 1 hr to fix

                        Function addHotReload has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const addHotReload = (
                          entry: webpack.Configuration['entry'],
                        ): webpack.Configuration['entry'] => {
                          const client = require.resolve('react-dev-utils/webpackHotDevClient');
                        
                        
                        Severity: Minor
                        Found in packages/brookjs-cli/src/webpack/selectors.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 useDelta has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const useDelta = <S, A extends Action<string>>(
                          reducer: Reducer<S, A> | EddyReducer<S, A>,
                          initialState: S,
                          delta: Delta<A, S> = defaultDelta,
                        ) => {
                        Severity: Minor
                        Found in packages/brookjs-silt/src/useDelta.ts - About 1 hr to fix

                          Function toEmitFromJunction has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                toEmitFromJunction(
                                  this: any,
                                  element: any,
                                  expected: any,
                                  cb: (a: any, b: any, c: any) => void = noop,
                          Severity: Minor
                          Found in packages/brookjs-desalinate/src/jestPlugin.tsx - About 1 hr to fix

                            Function spawn has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              spawn(bin: string, command: string) {
                                this.process = {
                                  stdout: '',
                                  closed: false,
                                  code: null
                            Severity: Minor
                            Found in packages/brookjs-cli/features/support/world.ts - About 1 hr to fix

                              Function withRef$ has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              ) => (
                                WrappedComponent: React.ForwardRefRenderFunction<E, P> | React.ElementType<P>,
                              ) => {
                                // @TODO(mAAdhaTTah) why isn't this type working?
                                const Target = wrap(WrappedComponent) as any;
                              Severity: Minor
                              Found in packages/brookjs-silt/src/withRef.tsx - About 1 hr to fix

                                Function format has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const format = (
                                  path: string,
                                  buffer?: Buffer,
                                ): Observable<FormatResult, FormatError> => {
                                  const buffer$: Observable<Buffer, NodeJS.ErrnoException> = buffer
                                Severity: Minor
                                Found in packages/brookjs-cli/src/prettier/index.ts - About 1 hr to fix

                                  Function toEmitFromDelta has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                          this: jest.MatcherContext,
                                          delta: any,
                                          expected: any,
                                          cb: (a: any, b: any, c: any) => void = noop,
                                          { timeLimit = 10000 } = {},
                                  Severity: Minor
                                  Found in packages/brookjs-desalinate/src/jestPlugin.tsx - About 35 mins to fix

                                    Function toEmitFromJunction has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                            this: any,
                                            element: any,
                                            expected: any,
                                            cb: (a: any, b: any, c: any) => void = noop,
                                            { timeLimit = 10000 } = {},
                                    Severity: Minor
                                    Found in packages/brookjs-desalinate/src/jestPlugin.tsx - About 35 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language