BuddhaNexus/buddhanexus-frontend

View on GitHub
src/views/data/data-view.js

Summary

Maintainability
D
2 days
Test Coverage

File data-view.js has 385 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @file data-view is the container component of table-view, numbers-view, table-view and graph-view.
 *
 * @todo:
 * - pass filter values inside an object instead of separately in order to simplify code.
Severity: Minor
Found in src/views/data/data-view.js - About 5 hrs to fix

    DataView has 34 functions (exceeds 20 allowed). Consider refactoring.
    Open

    @customElement('data-view')
    export class DataView extends LitElement {
      @property({ type: String }) fileName = '';
      @property({ type: String }) language;
      @property({ type: Number }) score;
    Severity: Minor
    Found in src/views/data/data-view.js - About 4 hrs to fix

      Function render has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          //prettier-ignore
          return html`
            <div class="data-view ${this.headerVisibility}" lang="${this.language}" view="${this.viewMode}">
              <div class="data-view__main-container">
      Severity: Major
      Found in src/views/data/data-view.js - About 3 hrs to fix

        Function initializeFilterValues has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          initializeFilterValues(lang) {
            switch (lang) {
              case LANGUAGE_CODES.TIBETAN:
                this.minLength = MIN_LENGTHS.TIBETAN;
                this.quoteLength = DEFAULT_LENGTHS.TIBETAN;
        Severity: Minor
        Found in src/views/data/data-view.js - About 1 hr to fix

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

                case LANGUAGE_CODES.TIBETAN:
                  this.minLength = MIN_LENGTHS.TIBETAN;
                  this.quoteLength = DEFAULT_LENGTHS.TIBETAN;
                  this.score = DEFAULT_SCORES.TIBETAN;
                  this.multiLingualMode = [LANGUAGE_CODES.TIBETAN];
          Severity: Major
          Found in src/views/data/data-view.js and 2 other locations - About 1 hr to fix
          src/views/data/data-view.js on lines 88..93
          src/views/data/data-view.js on lines 100..105

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

          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 3 locations. Consider refactoring.
          Open

                case LANGUAGE_CODES.PALI:
                  this.minLength = MIN_LENGTHS.PALI;
                  this.quoteLength = DEFAULT_LENGTHS.PALI;
                  this.score = DEFAULT_SCORES.PALI;
                  this.multiLingualMode = [LANGUAGE_CODES.PALI];
          Severity: Major
          Found in src/views/data/data-view.js and 2 other locations - About 1 hr to fix
          src/views/data/data-view.js on lines 82..87
          src/views/data/data-view.js on lines 100..105

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

          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 3 locations. Consider refactoring.
          Open

                case LANGUAGE_CODES.CHINESE:
                  this.minLength = MIN_LENGTHS.CHINESE;
                  this.quoteLength = DEFAULT_LENGTHS.CHINESE;
                  this.score = DEFAULT_SCORES.CHINESE;
                  this.multiLingualMode = [LANGUAGE_CODES.CHINESE];
          Severity: Major
          Found in src/views/data/data-view.js and 2 other locations - About 1 hr to fix
          src/views/data/data-view.js on lines 82..87
          src/views/data/data-view.js on lines 88..93

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

          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

            setScore = e => {
              if (e.target.value !== this.score) {
                this.score = e.target.value;
              }
            };
          Severity: Minor
          Found in src/views/data/data-view.js and 1 other location - About 55 mins to fix
          src/views/data/data-view.js on lines 225..229

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

          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

            setQuoteLength = e => {
              if (e.target.value !== this.quoteLength) {
                this.quoteLength = e.target.value;
              }
            };
          Severity: Minor
          Found in src/views/data/data-view.js and 1 other location - About 55 mins to fix
          src/views/data/data-view.js on lines 210..214

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

          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

          There are no issues that match your filters.

          Category
          Status