BuddhaNexus/buddhanexus-frontend

View on GitHub

Showing 280 of 280 total issues

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

var superscript = function(sup, below) {
  var tmpSet = m_superscripts.get(sup);
  if (tmpSet == null) return false;
  return tmpSet.contains(below);
};
Severity: Major
Found in src/views/utility/tibetan-transliteration.js and 3 other locations - About 50 mins to fix
src/views/utility/tibetan-transliteration.js on lines 1055..1059
src/views/utility/tibetan-transliteration.js on lines 1063..1067
src/views/utility/tibetan-transliteration.js on lines 1074..1078

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

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

var suff2 = function(suff, before) {
  var tmpSet = m_suff2.get(suff);
  if (tmpSet == null) return false;
  return tmpSet.contains(before);
};
Severity: Major
Found in src/views/utility/tibetan-transliteration.js and 3 other locations - About 50 mins to fix
src/views/utility/tibetan-transliteration.js on lines 1047..1051
src/views/utility/tibetan-transliteration.js on lines 1055..1059
src/views/utility/tibetan-transliteration.js on lines 1063..1067

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

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

function EnglishViewHeaderLeftColumn({
  isInfoDialogLeftOpen,
  setIsInfoDialogLeftOpen,
  openDialogLeft,
}) {
Severity: Minor
Found in src/views/englishview/english-view-header.js and 1 other location - About 50 mins to fix
src/views/englishview/english-view-header.js on lines 10..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 51.

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

var subscript = function(sub, above) {
  var tmpSet = m_subscripts.get(sub);
  if (tmpSet == null) return false;
  return tmpSet.contains(above);
};
Severity: Major
Found in src/views/utility/tibetan-transliteration.js and 3 other locations - About 50 mins to fix
src/views/utility/tibetan-transliteration.js on lines 1047..1051
src/views/utility/tibetan-transliteration.js on lines 1063..1067
src/views/utility/tibetan-transliteration.js on lines 1074..1078

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

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

var prefix = function(pref, after) {
  var tmpSet = m_prefixes.get(pref);
  if (tmpSet == null) return false;
  return tmpSet.contains(after);
};
Severity: Major
Found in src/views/utility/tibetan-transliteration.js and 3 other locations - About 50 mins to fix
src/views/utility/tibetan-transliteration.js on lines 1047..1051
src/views/utility/tibetan-transliteration.js on lines 1055..1059
src/views/utility/tibetan-transliteration.js on lines 1074..1078

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

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

function EnglishViewHeaderRightColumn({
  isInfoDialogRightOpen,
  setIsInfoDialogRightOpen,
  openDialogRight,
}) {
Severity: Minor
Found in src/views/englishview/english-view-header.js and 1 other location - About 50 mins to fix
src/views/englishview/english-view-header.js on lines 40..73

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

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 getLeftSegmentColors has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  current_parallels,
  segText,
  segmentNr,
  lang,
  leftSideSelected,
Severity: Minor
Found in src/views/textview/LeftSegment.js - About 45 mins to fix

    Function LeftSegmentContainer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function LeftSegmentContainer({
      segmentNr,
      segText,
      current_parallels,
      number,
    Severity: Minor
    Found in src/views/textview/LeftSegment.js - About 45 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

    Avoid deeply nested control flow statements.
    Open

              if (m_tokens.contains(tr)) {
                tokens.push(tr);
                i += len;
                continue TOKEN;
              }
    Severity: Major
    Found in src/views/utility/tibetan-transliteration.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

          } else if (state == State.SUFF2) {
            consonants.push(stack.single_consonant);
            if (isSuff2(stack.single_consonant)) {
              if (!suff2(stack.single_consonant, prev_cons)) {
                warns.push(
      Severity: Major
      Found in src/views/utility/tibetan-transliteration.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                  if (o != null) {
                    out += o;
                    continue ESC;
                  }
        Severity: Major
        Found in src/views/utility/tibetan-transliteration.js - About 45 mins to fix

          Function adjustChartHeight has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            adjustChartHeight() {
              this.chartHeight = '84vh';
              if (!this.graphData || !this.graphData[this.currentPage]) {
                return;
              }
          Severity: Minor
          Found in src/views/visual/visual-view-graph.js - About 45 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

          Avoid deeply nested control flow statements.
          Open

                    if (opts.check_strict && !plus) {
                      var prev = consonantStringBackwards(tokens, i - 1, orig_i);
                      if (!subscript(t2, prev)) {
                        prev = prev.replace(/\+/g, '');
                        warns.push(
          Severity: Major
          Found in src/views/utility/tibetan-transliteration.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                        if (position > rootOffsetEnd) {
                          word.classList.remove(C_HIGHLIGHTED_SEGMENT);
                        } else {
                          word.classList.add(C_HIGHLIGHTED_SEGMENT);
                        }
            Severity: Major
            Found in src/views/textview/text-view.js - About 45 mins to fix

              Function scrollAfterEndlessReload has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                scrollAfterEndlessReload() {
                  if (this.noScrolling && this.EndlessScrollFlag) {
                    if (this.activeSegment) {
                      let mainScrollPosition = this.scrollTop;
                      let mainElement = document.querySelector('html');
              Severity: Minor
              Found in src/views/textview/text-view-right.js - About 45 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

              Avoid deeply nested control flow statements.
              Open

                        if (position < parallels[i].root_offset_end) {
                          colourValues[j] += 1;
                        }
              Severity: Major
              Found in src/views/textview/textViewUtils.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                          while (tokens[i] != null && tokens[i] == '^') {
                            caret++;
                            i++;
                          }
                Severity: Major
                Found in src/views/utility/tibetan-transliteration.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                        if (opts.check_strict) {
                          if (!isSuffix(stack.single_consonant)) {
                            warns.push(
                              'Invalid suffix consonant: "' + stack.single_consonant + '".'
                            );
                  Severity: Major
                  Found in src/views/utility/tibetan-transliteration.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                              if (t2 == 'l' && consonants > 1) break;
                    Severity: Major
                    Found in src/views/utility/tibetan-transliteration.js - About 45 mins to fix

                      Function fetchDataText has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                        async fetchDataText() {
                          if (!this.rightFileName) {
                            this.fetchLoading = false;
                            return;
                          }
                      Severity: Minor
                      Found in src/views/textview/text-view-right.js - About 45 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

                      Severity
                      Category
                      Status
                      Source
                      Language