WeAreGenki/minna-ui

View on GitHub

Showing 53 of 62 total issues

Function run has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function run(
  env: NodeJS.ProcessEnv,
  argv: string[] = [],
): Promise<BuildLibResult | void> {
  const args = mri(argv.slice(ARGS_START), {
Severity: Major
Found in utils/build-lib/src/index.ts - About 2 hrs to fix

    Function generateBundle has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        async generateBundle(outputOpts, bundle) {
          const minifyCss = (css: string): string => {
            const cleancss = new CleanCSS({
              sourceMap: false, // TODO: Add source map support
              ...(typeof optimize === 'object' ? optimize : {}),
    Severity: Major
    Found in utils/rollup-plugin-emit-html/src/index.ts - About 2 hrs to fix

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

        it('attaches tooltip on hover', () => {
          expect.assertions(1);
          const target = document.createElement('div');
          // const component = new BasicTooltip({ target });
          new BasicTooltip({ target });
      Severity: Major
      Found in components/tooltip/src/__tests__/index.test.ts and 1 other location - About 2 hrs to fix
      components/tooltip/src/__tests__/index.test.ts on lines 5..13

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

      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

        it('renders nothing visible by default', () => {
          expect.assertions(1);
          const target = document.createElement('div');
          // const component = new BasicTooltip({ target });
          new BasicTooltip({ target });
      Severity: Major
      Found in components/tooltip/src/__tests__/index.test.ts and 1 other location - About 2 hrs to fix
      components/tooltip/src/__tests__/index.test.ts on lines 15..23

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

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

      function postcssRollup({
        exclude = [/node_modules\/@minna-ui/],
        include = [/\.(p|post)?css$/],
        ...options
      }: RollupPostcssOptions = {}): rollup.Plugin {
      Severity: Minor
      Found in utils/rollup-plugin-postcss/src/plugin.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

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

          if (pkgModule) {
            const bundleModule = await rollup({
              external,
              input,
              plugins,
      Severity: Major
      Found in utils/build-lib/src/build.ts and 1 other location - About 2 hrs to fix
      utils/build-lib/src/build.ts on lines 18..33

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

      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

          if (pkgMain) {
            const bundleMain = await rollup({
              external,
              input,
              plugins,
      Severity: Major
      Found in utils/build-lib/src/build.ts and 1 other location - About 2 hrs to fix
      utils/build-lib/src/build.ts on lines 35..50

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

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

      export async function run(
        env: NodeJS.ProcessEnv,
        argv: string[] = [],
      ): Promise<ProcessCssResult[]> {
        const args = mri(argv.slice(ARGS_START), {
      Severity: Minor
      Found in utils/build-css/src/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 style has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      export const style = (
        opts: StylePreprocessorOptions = {},
        // @ts-ignore - FIXME: Contribute types fix upstream
      ): Preprocessor => async ({ attributes, content, filename }) => {
        if (attributes.type !== 'text/postcss') return;
      Severity: Minor
      Found in utils/preprocess/src/style.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 generateBundle has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          generateBundle(outputOpts) {
            if (!styles.size) return;
      
            const processCss = (css: string, id: string): void => {
              if ((!css || !/\S/.test(css)) && !emitEmpty) {
      Severity: Minor
      Found in utils/rollup-plugin-emit-css/src/index.ts - About 1 hr to fix

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

          it('has no invalid config options', async () => {
            expect.assertions(1);
            const result = await stylelint.lint(stylelintOpts);
            expect(result.results[0].invalidOptionWarnings).toHaveLength(0);
          });
        Severity: Major
        Found in utils/stylelint-config/__tests__/index.test.ts and 1 other location - About 1 hr to fix
        utils/stylelint-config/__tests__/index.test.ts on lines 99..103

        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

          it('has no config deprecations', async () => {
            expect.assertions(1);
            const result = await stylelint.lint(stylelintOpts);
            expect(result.results[0].deprecations).toHaveLength(0);
          });
        Severity: Major
        Found in utils/stylelint-config/__tests__/index.test.ts and 1 other location - About 1 hr to fix
        utils/stylelint-config/__tests__/index.test.ts on lines 105..109

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

            async transform(code, id) {
              if (!filter(id)) return;
        
              try {
                const context = merge(
        Severity: Minor
        Found in utils/rollup-plugin-postcss/src/plugin.ts - About 1 hr to fix

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

          export async function run(
            env: NodeJS.ProcessEnv,
            argv: string[] = [],
          ): Promise<BuildLibResult | void> {
            const args = mri(argv.slice(ARGS_START), {
          Severity: Minor
          Found in utils/build-lib/src/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

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

            if (pkgMain) {
              config.push({
                external,
                input,
                output: {
          Severity: Major
          Found in utils/build-lib/src/watch.ts and 1 other location - About 1 hr to fix
          utils/build-lib/src/watch.ts on lines 37..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 60.

          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

            if (pkgModule) {
              config.push({
                external,
                input,
                output: {
          Severity: Major
          Found in utils/build-lib/src/watch.ts and 1 other location - About 1 hr to fix
          utils/build-lib/src/watch.ts on lines 23..35

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

          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

          describe('Rollup PostCSS plugin', () => {
            it('placeholder', () => {
              expect.assertions(1);
              expect(1 + 2).toBe(3);
            });
          Severity: Major
          Found in utils/rollup-plugin-postcss/src/__tests__/index.test.ts and 1 other location - About 1 hr to fix
          utils/rollup-plugin-emit-html/src/__tests__/index.test.ts on lines 5..10

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

          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

          describe('Rollup emit HTML plugin', () => {
            it('placeholder', () => {
              expect.assertions(1);
              expect(1 + 2).toBe(3);
            });
          Severity: Major
          Found in utils/rollup-plugin-emit-html/src/__tests__/index.test.ts and 1 other location - About 1 hr to fix
          utils/rollup-plugin-postcss/src/__tests__/index.test.ts on lines 5..10

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

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

          export const tooltip: SvelteAction = (node, text) => {
            const el = document.createElement('div');
            el.className = 'tooltip';
            el.textContent = text;
          
          
          Severity: Minor
          Found in components/tooltip/src/index.ts - About 1 hr to fix

            Function minify has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function minify(source: string, unsafe = false): string {
              let code = `${source}`;
              let count = 0;
            
              const tags = [
            Severity: Minor
            Found in utils/preprocess/src/markup.ts - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language