mAAdhaTTah/brookjs

View on GitHub

Showing 71 of 74 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const reducer: EddyReducer<State, Action> = (
  state = initialState('/', null),
  action,
) => {
  switch (action.type) {
Severity: Major
Found in packages/brookjs-cli/src/commands/TestCommand/Lint/reducer.tsx and 1 other location - About 2 days to fix
packages/brookjs-cli/src/commands/TestCommand/Check/reducer.tsx on lines 8..52

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 383.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const reducer: EddyReducer<State, Action> = (
  state = initialState('/', null),
  action,
) => {
  switch (action.type) {
packages/brookjs-cli/src/commands/TestCommand/Lint/reducer.tsx on lines 8..52

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 383.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      const lint$ = state$
        .thru(sampleByAction(action$, actions.lint.request))
        .flatMap(state =>
          service(selectLintGlob(state.cwd, state.rc?.dir ?? 'src'))
            .map(files => actions.lint.success(files))
    Severity: Major
    Found in packages/brookjs-cli/src/glob/index.ts and 1 other location - About 4 hrs to fix
    packages/brookjs-cli/src/glob/index.ts on lines 43..49

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 121.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      const format$ = state$
        .thru(sampleByAction(action$, actions.format.request))
        .flatMap(state =>
          service(selectFormatGlob(state.cwd, state.rc?.dir ?? 'src'))
            .map(files => actions.format.success(files))
    Severity: Major
    Found in packages/brookjs-cli/src/glob/index.ts and 1 other location - About 4 hrs to fix
    packages/brookjs-cli/src/glob/index.ts on lines 35..41

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 121.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          <Box flexDirection="column" marginBottom={1}>
            <Box marginBottom={1}>
              <Color redBright>Compilation errors:</Color>
            </Box>
            {errors.map((error, i) => (
      Severity: Major
      Found in packages/brookjs-cli/src/commands/components/webpack.tsx and 1 other location - About 3 hrs to fix
      packages/brookjs-cli/src/commands/components/webpack.tsx on lines 31..38

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 102.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              <Box flexDirection="column" marginBottom={1}>
                <Box marginBottom={1}>
                  <Color yellowBright>Compilation warnings:</Color>
                </Box>
                {warnings.map((warning, i) => (
      Severity: Major
      Found in packages/brookjs-cli/src/commands/components/webpack.tsx and 1 other location - About 3 hrs to fix
      packages/brookjs-cli/src/commands/components/webpack.tsx on lines 58..65

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 102.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                return {
                  pass: this.equals(log, expected),
                  message: () =>
                    this.utils.matcherHint(
                      `${this.isNot ? '.not' : ''}.toEmitFromJunction`,
        Severity: Major
        Found in packages/brookjs-desalinate/src/jestPlugin.tsx and 1 other location - About 2 hrs to fix
        packages/brookjs-desalinate/src/jestPlugin.tsx on lines 49..57

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 83.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                return {
                  pass: this.equals(log, expected),
                  message: () =>
                    this.utils.matcherHint(
                      `${this.isNot ? '.not' : ''}.toEmitFromDelta`,
        Severity: Major
        Found in packages/brookjs-desalinate/src/jestPlugin.tsx and 1 other location - About 2 hrs to fix
        packages/brookjs-desalinate/src/jestPlugin.tsx on lines 92..100

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 83.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                  return (
                    <Box flexDirection="column">
                      <Color green>Success! All files have been formatted.</Color>
                      <Color greenBright>
                        Formatted {total} file{total === 1 ? '' : 's'}
            Severity: Major
            Found in packages/brookjs-cli/src/commands/FormatCommand/index.tsx and 1 other location - About 1 hr to fix
            packages/brookjs-cli/src/commands/TestCommand/Lint/Completed.tsx on lines 73..80

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 69.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              return (
                <Box flexDirection="column">
                  <Color green>Success! All files are correctly linted.</Color>
                  <Color greenBright>
                    Checked {total} file{total === 1 ? '' : 's'}
            packages/brookjs-cli/src/commands/FormatCommand/index.tsx on lines 178..185

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 69.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              componentWillUnmount() {
                this.mounted = false;
                const { api } = this.props;
            
                api.off(STORY_RENDERED, this.handleStoryChange);
            Severity: Major
            Found in packages/brookjs-desalinate/src/storybook.tsx and 1 other location - About 1 hr to fix
            packages/brookjs-desalinate/src/storybook.tsx on lines 127..133

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 68.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              componentDidMount() {
                this.mounted = true;
                const { api } = this.props;
            
                api.on(EVENT_ID, this.addAction);
            Severity: Major
            Found in packages/brookjs-desalinate/src/storybook.tsx and 1 other location - About 1 hr to fix
            packages/brookjs-desalinate/src/storybook.tsx on lines 135..141

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 68.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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
                Severity
                Category
                Status
                Source
                Language