manuelbieh/react-ssr-setup

View on GitHub

Showing 8,686 of 8,694 total issues

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

    clientCompiler.watch({}, (error: any, stats: any) => {
        if (!error && !stats.hasErrors()) {
            console.log(stats.toString(clientConfig.stats));
            return;
        }
Severity: Major
Found in scripts/build-client.ts and 1 other location - About 3 hrs to fix
scripts/build-ssr.ts on lines 75..81

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 103.

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

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

    clientCompiler.watch({}, (error: any, stats: any) => {
        if (!error && !stats.hasErrors()) {
            console.log(stats.toString(clientConfig.stats));
            return;
        }
Severity: Major
Found in scripts/build-ssr.ts and 1 other location - About 3 hrs to fix
scripts/build-client.ts on lines 19..25

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 103.

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 exports has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = (api) => {
    api.cache.using(() => process.env.NODE_ENV);

    const isTargetWeb = api.caller((caller) => caller && caller.target === 'web');

Severity: Major
Found in babel.config.js - About 2 hrs to fix

    Function getRoute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    export const getRoute = (
        path: string,
        params?: { [key: string]: string | number },
        routesConfig: any = routes
    ) =>
    Severity: Minor
    Found in src/shared/routes.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 uploadTranslationSourceFile has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const uploadTranslationSourceFile = async (filename: string) => {
        const data = await fs.readFile(filename);
        try {
            // Export the i18n project
            const { data: imported } = await axios.post(
    Severity: Minor
    Found in scripts/i18n-push.ts - About 1 hr to fix

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

              new Date(fs.statSync(path.resolve(`${localesDir}/${locale}/${ns}.json`)).mtime).getTime()
      Severity: Minor
      Found in src/server/middleware/i18n.ts and 1 other location - About 40 mins to fix
      src/server/middleware/i18n.ts on lines 40..42

      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 49.

      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

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

                  updatedAt: new Date(
                      fs.statSync(path.resolve(`${localesDir}/${locale}/${ns}.json`)).mtime
                  ).getTime(),
      Severity: Minor
      Found in src/server/middleware/i18n.ts and 1 other location - About 40 mins to fix
      src/server/middleware/i18n.ts on lines 32..32

      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 49.

      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

          clientConfig.output.publicPath = [`${DEVSERVER_HOST}:${WEBPACK_PORT}`, publicPath]
              .join('/')
              .replace(/([^:+])\/+/g, '$1/');
      Severity: Minor
      Found in scripts/start-ssr.ts and 1 other location - About 40 mins to fix
      scripts/start-ssr.ts on lines 36..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 48.

      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

          serverConfig.output.publicPath = [`${DEVSERVER_HOST}:${WEBPACK_PORT}`, publicPath]
              .join('/')
              .replace(/([^:+])\/+/g, '$1/');
      Severity: Minor
      Found in scripts/start-ssr.ts and 1 other location - About 40 mins to fix
      scripts/start-ssr.ts on lines 32..34

      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 48.

      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 logMessage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      export const logMessage = (message: any, level: string = 'info') => {
          const color =
              level === 'error'
                  ? 'red'
                  : level === 'warning'
      Severity: Minor
      Found in scripts/utils.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

      Expected an indentation at 4 instead of at 2.
      Open

        dependencies:
      Severity: Minor
      Found in yarn.lock by editorconfig

      Expected an indentation at 4 instead of at 2.
      Open

        resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.8.3.tgz#33e25903d7481181534e12ec0a25f16b6fcf419e"
      Severity: Minor
      Found in yarn.lock by editorconfig

      Expected an indentation at 4 instead of at 2.
      Open

        dependencies:
      Severity: Minor
      Found in yarn.lock by editorconfig

      Expected an indentation at 4 instead of at 2.
      Open

        dependencies:
      Severity: Minor
      Found in yarn.lock by editorconfig

      Expected an indentation at 4 instead of at 2.
      Open

        dependencies:
      Severity: Minor
      Found in yarn.lock by editorconfig

      Expected an indentation at 4 instead of at 2.
      Open

        resolved "https://registry.yarnpkg.com/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.9.0.tgz#16bf391990b57732700a3278d4d9a81231ea8d32"
      Severity: Minor
      Found in yarn.lock by editorconfig

      Expected an indentation at 4 instead of at 2.
      Open

        dependencies:
      Severity: Minor
      Found in yarn.lock by editorconfig

      Expected an indentation at 4 instead of at 2.
      Open

        integrity sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ==
      Severity: Minor
      Found in yarn.lock by editorconfig

      Expected an indentation at 4 instead of at 2.
      Open

        version "7.8.4"
      Severity: Minor
      Found in yarn.lock by editorconfig

      Expected an indentation at 4 instead of at 2.
      Open

        resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.8.4.tgz#505fb053721a98777b2b175323ea4f090b7d3c1c"
      Severity: Minor
      Found in yarn.lock by editorconfig
      Severity
      Category
      Status
      Source
      Language