opensheetmusicdisplay/opensheetmusicdisplay

View on GitHub
src/MusicalScore/Graphical/SkyBottomLineCalculator.ts

Summary

Maintainability
F
1 wk
Test Coverage

File SkyBottomLineCalculator.ts has 392 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { EngravingRules } from "./EngravingRules";
import { StaffLine } from "./StaffLine";
import { PointF2D } from "../../Common/DataObjects/PointF2D";
import { VexFlowMeasure } from "./VexFlow/VexFlowMeasure";
import { unitInPixels } from "./VexFlow/VexFlowMusicSheetDrawer";
Severity: Minor
Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts - About 5 hrs to fix

    Function calculateLines has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        public calculateLines(): void {
            const samplingUnit: number = this.mRules.SamplingUnit;
            const results: SkyBottomLineCalculationResult[] = [];
    
            // Create a temporary canvas outside the DOM to draw the measure in.
    Severity: Minor
    Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts - About 5 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

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

    export class SkyBottomLineCalculator {
        /** Parent Staffline where the skyline and bottom line is attached */
        private mStaffLineParent: StaffLine;
        /** Internal array for the skyline */
        private mSkyLine: number[];
    Severity: Minor
    Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts - About 4 hrs to fix

      Function calculateLines has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public calculateLines(): void {
              const samplingUnit: number = this.mRules.SamplingUnit;
              const results: SkyBottomLineCalculationResult[] = [];
      
              // Create a temporary canvas outside the DOM to draw the measure in.
      Severity: Major
      Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts - About 2 hrs to fix

        Function updateLines has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public updateLines(calculationResults: SkyBottomLineCalculationResult[]): void {
                const measures: VexFlowMeasure[] = this.StaffLineParent.Measures as VexFlowMeasure[];
        
                if (calculationResults.length !== measures.length) {
                    log.warn("SkyBottomLineCalculator: lengths of calculation result array and measure array do not match");
        Severity: Minor
        Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts - About 1 hr to fix

          Function updateLines has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              public updateLines(calculationResults: SkyBottomLineCalculationResult[]): void {
                  const measures: VexFlowMeasure[] = this.StaffLineParent.Measures as VexFlowMeasure[];
          
                  if (calculationResults.length !== measures.length) {
                      log.warn("SkyBottomLineCalculator: lengths of calculation result array and measure array do not match");
          Severity: Minor
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.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 updateWithBoundingBoxRecursively has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public updateWithBoundingBoxRecursively(boundingBox: BoundingBox): void {
                  if (boundingBox.ChildElements && boundingBox.ChildElements.length > 0) {
                      this.updateWithBoundingBoxRecursively(boundingBox);
                  } else {
                      const currentTopBorder: number = boundingBox.BorderTop + boundingBox.AbsolutePosition.y;
          Severity: Minor
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts - About 35 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

          Function updateSkyLineWithWedge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public updateSkyLineWithWedge(start: PointF2D, end: PointF2D): void {
                  // FIXME: Refactor if wedges will be added. Current status is that vexflow will be used for this
                  let startIndex: number = Math.floor(start.x * this.SamplingUnit);
                  let endIndex: number = Math.ceil(end.x * this.SamplingUnit);
          
          
          Severity: Minor
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.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

          Function getMaxInRange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private getMaxInRange(skyBottomArray: number[], startIndex: number, endIndex: number): number {
                  startIndex = Math.floor(startIndex * this.SamplingUnit);
                  endIndex = Math.ceil(endIndex * this.SamplingUnit);
          
                  if (!skyBottomArray) {
          Severity: Minor
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.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

          Function updateBottomLineWithWedge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public updateBottomLineWithWedge(start: PointF2D, end: PointF2D): void {
                  // FIXME: Refactor if wedges will be added. Current status is that vexflow will be used for this
                  let startIndex: number = Math.floor(start.x * this.SamplingUnit);
                  let endIndex: number = Math.ceil(end.x * this.SamplingUnit);
          
          
          Severity: Minor
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.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

          Function getMinInRange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private getMinInRange(skyBottomArray: number[], startIndex: number, endIndex: number): number {
                  startIndex = Math.floor(startIndex * this.SamplingUnit);
                  endIndex = Math.ceil(endIndex * this.SamplingUnit);
          
                  if (!skyBottomArray) {
          Severity: Minor
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.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

          Function updateInRange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private updateInRange(array: number[], startIndex: number = 0, endIndex: number = array.length, value: number = 0): void {
                  startIndex = Math.floor(startIndex * this.SamplingUnit);
                  endIndex = Math.ceil(endIndex * this.SamplingUnit);
          
                  if (endIndex < startIndex) {
          Severity: Minor
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.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

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

              private getMinInRange(skyBottomArray: number[], startIndex: number, endIndex: number): number {
                  startIndex = Math.floor(startIndex * this.SamplingUnit);
                  endIndex = Math.ceil(endIndex * this.SamplingUnit);
          
                  if (!skyBottomArray) {
          Severity: Major
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts and 1 other location - About 1 day to fix
          src/MusicalScore/Graphical/SkyBottomLineCalculator.ts on lines 601..626

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

          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

              private getMaxInRange(skyBottomArray: number[], startIndex: number, endIndex: number): number {
                  startIndex = Math.floor(startIndex * this.SamplingUnit);
                  endIndex = Math.ceil(endIndex * this.SamplingUnit);
          
                  if (!skyBottomArray) {
          Severity: Major
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts and 1 other location - About 1 day to fix
          src/MusicalScore/Graphical/SkyBottomLineCalculator.ts on lines 568..593

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

          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 (currentTopBorder < 0) {
                          const startPoint: number = Math.floor(boundingBox.AbsolutePosition.x + boundingBox.BorderLeft);
                          const endPoint: number = Math.ceil(boundingBox.AbsolutePosition.x + boundingBox.BorderRight) ;
          
                          this.updateInRange(this.mSkyLine, startPoint, endPoint, currentTopBorder);
          Severity: Major
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts and 1 other location - About 2 hrs to fix
          src/MusicalScore/Graphical/SkyBottomLineCalculator.ts on lines 449..454

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

          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

                      } else if (currentBottomBorder > this.StaffLineParent.StaffHeight) {
                          const startPoint: number = Math.floor(boundingBox.AbsolutePosition.x + boundingBox.BorderLeft);
                          const endPoint: number = Math.ceil(boundingBox.AbsolutePosition.x + boundingBox.BorderRight);
          
                          this.updateInRange(this.mBottomLine, startPoint, endPoint, currentBottomBorder);
          Severity: Major
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts and 1 other location - About 2 hrs to fix
          src/MusicalScore/Graphical/SkyBottomLineCalculator.ts on lines 444..454

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

          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

                          for (let y: number = 0; y < height; y++) {
                              const yOffset: number = y * width * rgbaLength;
                              const bufIndex: number = yOffset + x * rgbaLength;
                              const alpha: number = imageData.data[bufIndex + 3];
                              if (alpha > 0) {
          Severity: Major
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts and 1 other location - About 2 hrs to fix
          src/MusicalScore/Graphical/SkyBottomLineCalculator.ts on lines 168..176

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

          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

                          for (let y: number = height; y > 0; y--) {
                              const yOffset: number = y * width * rgbaLength;
                              const bufIndex: number = yOffset + x * rgbaLength;
                              const alpha: number = imageData.data[bufIndex + 3];
                              if (alpha > 0) {
          Severity: Major
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts and 1 other location - About 2 hrs to fix
          src/MusicalScore/Graphical/SkyBottomLineCalculator.ts on lines 158..166

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

          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

                      for (let idx: number = 0; idx < tmpBottomLine.length; idx++) {
                          if (tmpBottomLine[idx] === undefined) {
                              tmpBottomLine[idx] = Math.max(this.findPreviousValidNumber(idx, tmpBottomLine), this.findNextValidNumber(idx, tmpBottomLine));
                          }
                      }
          Severity: Major
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts and 1 other location - About 2 hrs to fix
          src/MusicalScore/Graphical/SkyBottomLineCalculator.ts on lines 179..183

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

          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

                      for (let idx: number = 0; idx < tmpSkyLine.length; idx++) {
                          if (tmpSkyLine[idx] === undefined) {
                              tmpSkyLine[idx] = Math.max(this.findPreviousValidNumber(idx, tmpSkyLine), this.findNextValidNumber(idx, tmpSkyLine));
                          }
                      }
          Severity: Major
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts and 1 other location - About 2 hrs to fix
          src/MusicalScore/Graphical/SkyBottomLineCalculator.ts on lines 184..188

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

          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

              public getRightIndexForPointX(x: number, length: number): number {
                  const index: number = Math.ceil(x * this.SamplingUnit);
          
                  if (index < 0) {
                      return 0;
          Severity: Major
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts and 1 other location - About 1 hr to fix
          src/MusicalScore/Graphical/SkyBottomLineCalculator.ts on lines 340..352

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

          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

              public getLeftIndexForPointX(x: number, length: number): number {
                  const index: number = Math.floor(x * this.SamplingUnit);
          
                  if (index < 0) {
                      return 0;
          Severity: Major
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts and 1 other location - About 1 hr to fix
          src/MusicalScore/Graphical/SkyBottomLineCalculator.ts on lines 354..366

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

          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

              public getSkyLineMinAtPoint(point: number): number {
                  const index: number = Math.round(point * this.SamplingUnit);
                  return this.mSkyLine[index];
              }
          Severity: Major
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts and 1 other location - About 1 hr to fix
          src/MusicalScore/Graphical/SkyBottomLineCalculator.ts on lines 406..409

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

          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

              public getBottomLineMaxAtPoint(point: number): number {
                  const index: number = Math.round(point * this.SamplingUnit);
                  return this.mBottomLine[index];
              }
          Severity: Major
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts and 1 other location - About 1 hr to fix
          src/MusicalScore/Graphical/SkyBottomLineCalculator.ts on lines 385..388

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

          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

              public updateSkyLineInRange(startIndex: number, endIndex: number, value: number): void {
                  this.updateInRange(this.mSkyLine, startIndex, endIndex, value);
              }
          Severity: Minor
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts and 1 other location - About 40 mins to fix
          src/MusicalScore/Graphical/SkyBottomLineCalculator.ts on lines 302..304

          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

              public updateBottomLineInRange(startIndex: number, endIndex: number, value: number): void {
                  this.updateInRange(this.BottomLine, startIndex, endIndex, value);
              }
          Severity: Minor
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts and 1 other location - About 40 mins to fix
          src/MusicalScore/Graphical/SkyBottomLineCalculator.ts on lines 292..294

          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

              public getBottomLineMax(): number {
                  return Math.max(...this.BottomLine.filter(s => !isNaN(s)));
              }
          Severity: Minor
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts and 1 other location - About 40 mins to fix
          src/MusicalScore/Graphical/SkyBottomLineCalculator.ts on lines 381..383

          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

              public getSkyLineMin(): number {
                  return Math.min(...this.SkyLine.filter(s => !isNaN(s)));
              }
          Severity: Minor
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts and 1 other location - About 40 mins to fix
          src/MusicalScore/Graphical/SkyBottomLineCalculator.ts on lines 402..404

          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

                  this.mBottomLine = this.mBottomLine.map(v => (v - highestBottomLine) / unitInPixels + this.StaffLineParent.BottomLineOffset);
          Severity: Minor
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts and 1 other location - About 35 mins to fix
          src/MusicalScore/Graphical/SkyBottomLineCalculator.ts on lines 97..97

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

          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

                  this.mSkyLine = this.mSkyLine.map(v => (v - lowestSkyLine) / unitInPixels + this.StaffLineParent.TopLineOffset);
          Severity: Minor
          Found in src/MusicalScore/Graphical/SkyBottomLineCalculator.ts and 1 other location - About 35 mins to fix
          src/MusicalScore/Graphical/SkyBottomLineCalculator.ts on lines 100..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 47.

          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