opensheetmusicdisplay/opensheetmusicdisplay

View on GitHub
src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts

Summary

Maintainability
F
2 wks
Test Coverage

File ExpressionReader.ts has 785 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {MusicSheet} from "../../MusicSheet";
import {Fraction} from "../../../Common/DataObjects/Fraction";
import {MultiTempoExpression} from "../../VoiceData/Expressions/MultiTempoExpression";
import {ContDynamicEnum, ContinuousDynamicExpression} from "../../VoiceData/Expressions/ContinuousExpressions/ContinuousDynamicExpression";
import {ContinuousTempoExpression} from "../../VoiceData/Expressions/ContinuousExpressions/ContinuousTempoExpression";
Severity: Major
Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 1 day to fix

    Function readExpressionParameters has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
    Open

        public readExpressionParameters(xmlNode: IXmlElement, currentInstrument: Instrument, divisions: number,
                                        inSourceMeasureCurrentFraction: Fraction,
                                        inSourceMeasureFormerFraction: Fraction,
                                        currentMeasureIndex: number,
                                        ignoreDivisionsOffset: boolean): void {
    Severity: Minor
    Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 1 day 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 createExpressionFromString has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        private createExpressionFromString(prefix: string, stringTrimmed: string,
                                           currentMeasure: SourceMeasure, inSourceMeasureCurrentFraction, inputString: string,
                                           fontStyle: FontStyles,
                                           fontColor: string,
                                           defaultYXml: number = undefined): boolean {
    Severity: Minor
    Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.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

    Function addOctaveShift has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        public addOctaveShift(directionNode: IXmlElement, currentMeasure: SourceMeasure, endTimestamp: Fraction): void {
            let octaveStaffNumber: number = 1;
            const staffNode: IXmlElement = directionNode.element("staff");
            if (staffNode) {
                try {
    Severity: Minor
    Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.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

    Function read has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

        public read(directionNode: IXmlElement, currentMeasure: SourceMeasure,
                    inSourceMeasureCurrentFraction: Fraction, inSourceMeasurePreviousFraction: Fraction = undefined): void {
            let isTempoInstruction: boolean = false;
            let isDynamicInstruction: boolean = false;
            const n: IXmlElement = directionNode.element("sound");
    Severity: Minor
    Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.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

    Function addPedalMarking has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        public addPedalMarking(directionNode: IXmlElement, currentMeasure: SourceMeasure, endTimestamp: Fraction): void {
            const directionTypeNode: IXmlElement = directionNode.element("direction-type");
            if (directionTypeNode) {
                const pedalNode: IXmlElement = directionTypeNode.element("pedal");
                if (pedalNode !== undefined && pedalNode.hasAttributes) {
    Severity: Minor
    Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 4 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

    Function readExpressionParameters has 102 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public readExpressionParameters(xmlNode: IXmlElement, currentInstrument: Instrument, divisions: number,
                                        inSourceMeasureCurrentFraction: Fraction,
                                        inSourceMeasureFormerFraction: Fraction,
                                        currentMeasureIndex: number,
                                        ignoreDivisionsOffset: boolean): void {
    Severity: Major
    Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 4 hrs to fix

      Function createExpressionFromString has 96 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private createExpressionFromString(prefix: string, stringTrimmed: string,
                                             currentMeasure: SourceMeasure, inSourceMeasureCurrentFraction, inputString: string,
                                             fontStyle: FontStyles,
                                             fontColor: string,
                                             defaultYXml: number = undefined): boolean {
      Severity: Major
      Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 3 hrs to fix

        Function interpretInstantaneousDynamics has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            private interpretInstantaneousDynamics(dynamicsNode: IXmlElement,
                                                   currentMeasure: SourceMeasure,
                                                   inSourceMeasureCurrentFraction: Fraction,
                                                   fromNotation: boolean): void {
                if (dynamicsNode.hasElements) {
        Severity: Minor
        Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 3 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

        Function read has 93 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public read(directionNode: IXmlElement, currentMeasure: SourceMeasure,
                        inSourceMeasureCurrentFraction: Fraction, inSourceMeasurePreviousFraction: Fraction = undefined): void {
                let isTempoInstruction: boolean = false;
                let isDynamicInstruction: boolean = false;
                const n: IXmlElement = directionNode.element("sound");
        Severity: Major
        Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 3 hrs to fix

          Consider simplifying this complex logical expression.
          Open

                  if (inputString === "coda" ||
                      inputString === "tocoda" ||
                      inputString === "to coda" ||
                      inputString === "fine" ||
                      inputString === "d.c." ||
          Severity: Critical
          Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 3 hrs to fix

            Function addWedge has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

                private addWedge(wedgeNode: IXmlElement, currentMeasure: SourceMeasure, inSourceMeasureCurrentFraction: Fraction): void {
                    if (wedgeNode !== undefined && wedgeNode.hasAttributes) {
                        const numberXml: number = this.readNumber(wedgeNode);
                        const type: string = wedgeNode.attribute("type").value.toLowerCase();
                        try {
            Severity: Minor
            Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 3 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

            Function interpretWords has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                private interpretWords(wordsNode: IXmlElement, currentMeasure: SourceMeasure, inSourceMeasureCurrentFraction: Fraction): void {
                    const text: string = wordsNode.value;
                    if (currentMeasure.Rules.IgnoreBracketsWords && (
                        /^\(\s*\)$/.test(text) || /^\[\s*\]$/.test(text) // (*) and [*]
                    )) { // regex: brackets with arbitrary white space in-between
            Severity: Minor
            Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.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

            ExpressionReader has 25 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export class ExpressionReader {
                private musicSheet: MusicSheet;
                private placement: PlacementEnum;
                private soundTempo: number;
                private soundDynamic: number;
            Severity: Minor
            Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 2 hrs to fix

              Function addOctaveShift has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public addOctaveShift(directionNode: IXmlElement, currentMeasure: SourceMeasure, endTimestamp: Fraction): void {
                      let octaveStaffNumber: number = 1;
                      const staffNode: IXmlElement = directionNode.element("staff");
                      if (staffNode) {
                          try {
              Severity: Major
              Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 2 hrs to fix

                Function addPedalMarking has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public addPedalMarking(directionNode: IXmlElement, currentMeasure: SourceMeasure, endTimestamp: Fraction): void {
                        const directionTypeNode: IXmlElement = directionNode.element("direction-type");
                        if (directionTypeNode) {
                            const pedalNode: IXmlElement = directionTypeNode.element("pedal");
                            if (pedalNode !== undefined && pedalNode.hasAttributes) {
                Severity: Major
                Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 2 hrs to fix

                  Function interpretWords has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private interpretWords(wordsNode: IXmlElement, currentMeasure: SourceMeasure, inSourceMeasureCurrentFraction: Fraction): void {
                          const text: string = wordsNode.value;
                          if (currentMeasure.Rules.IgnoreBracketsWords && (
                              /^\(\s*\)$/.test(text) || /^\[\s*\]$/.test(text) // (*) and [*]
                          )) { // regex: brackets with arbitrary white space in-between
                  Severity: Minor
                  Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 1 hr to fix

                    Function interpretInstantaneousDynamics has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private interpretInstantaneousDynamics(dynamicsNode: IXmlElement,
                                                               currentMeasure: SourceMeasure,
                                                               inSourceMeasureCurrentFraction: Fraction,
                                                               fromNotation: boolean): void {
                            if (dynamicsNode.hasElements) {
                    Severity: Minor
                    Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 1 hr to fix

                      Function addWedge has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private addWedge(wedgeNode: IXmlElement, currentMeasure: SourceMeasure, inSourceMeasureCurrentFraction: Fraction): void {
                              if (wedgeNode !== undefined && wedgeNode.hasAttributes) {
                                  const numberXml: number = this.readNumber(wedgeNode);
                                  const type: string = wedgeNode.attribute("type").value.toLowerCase();
                                  try {
                      Severity: Minor
                      Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                if (this.lastWedge && this.lastWedge.parentMeasure.MeasureNumberXML === currentMeasure.MeasureNumberXML &&
                                        this.lastWedge.StaffNumber === this.staffNumber &&
                                        this.placement === this.lastWedge.Placement &&
                                        this.WedgeYPosXml !== undefined &&
                                        this.lastWedge.YPosXml === this.WedgeYPosXml &&
                        Severity: Critical
                        Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 1 hr to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                      if (multiTempoExpression.EntriesList[0].label.indexOf(stringTrimmed) >= 0) {
                                                          return false;
                                                  } else {
                                                      break;
                                                  }
                          Severity: Major
                          Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                        if (this.openOctaveShift) {
                                                            this.getMultiExpression = this.createNewMultiExpressionIfNeeded(
                                                                currentMeasure, this.openOctaveShift.numberXml, endTimestamp);
                                                            const octaveShiftStartExpression: MultiExpression = this.getMultiExpression;
                                                            octaveShiftStartExpression.OctaveShiftEnd = this.openOctaveShift;
                            Severity: Major
                            Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                          if (placement === PlacementEnum.Above) {
                                                              type = "down";
                                                          } else if (placement === PlacementEnum.Below) {
                                                              type = "up";
                                                          }
                              Severity: Major
                              Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        else if (!type) {
                                                            log.debug("octave-shift missing type in xml");
                                                        }
                                Severity: Major
                                Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if (openCont.NumberXml === numberXml) {
                                                              // if (openCont.NumberXml === numberXml) { // was there supposed to be another check here? someone wrote the same check twice.
                                                              this.closeOpenContinuousDynamic(openCont, currentMeasure, inSourceMeasureCurrentFraction);
                                                          }
                                  Severity: Major
                                  Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 45 mins to fix

                                    Consider simplifying this complex logical expression.
                                    Open

                                            if (!existingMultiExpression ||
                                                existingMultiExpression &&
                                                (existingMultiExpression.SourceMeasureParent !== currentMeasure ||
                                                    existingMultiExpression.numberXml !== numberXml ||
                                                    (existingMultiExpression.SourceMeasureParent === currentMeasure && !existingMultiExpression.Timestamp.Equals(timestamp)))) {
                                    Severity: Major
                                    Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 40 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                  return true;
                                      Severity: Major
                                      Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                return false;
                                        Severity: Major
                                        Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                      return;
                                          Severity: Major
                                          Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                        return;
                                            Severity: Major
                                            Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                                              return false;
                                              Severity: Major
                                              Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts - About 30 mins to fix

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

                                                    private createNewMultiExpressionIfNeeded(currentMeasure: SourceMeasure, numberXml: number,
                                                        timestamp: Fraction = undefined): MultiExpression {
                                                        if (!timestamp) {
                                                            timestamp = this.directionTimestamp;
                                                        }
                                                Severity: Minor
                                                Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.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

                                                        if (staffNode) {
                                                            try {
                                                                octaveStaffNumber = parseInt(staffNode.value, 10);
                                                            } catch (ex) {
                                                                const errorMsg: string = ITextTranslation.translateText(  "ReaderErrorMessages/OctaveShiftStaffError",
                                                src/MusicalScore/ScoreIO/InstrumentReader.ts on lines 1270..1282

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

                                                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 (this.offsetDivisions > 0) {
                                                            if (inSourceMeasureCurrentFraction.RealValue > 0) {
                                                                offsetFraction = Fraction.multiply(Fraction.minus(inSourceMeasureCurrentFraction, inSourceMeasureFormerFraction), offsetFraction);
                                                                this.directionTimestamp = Fraction.plus(offsetFraction, inSourceMeasureCurrentFraction);
                                                            } else { this.directionTimestamp = Fraction.createFromFraction(offsetFraction); }
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 74..79

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

                                                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 (this.offsetDivisions < 0) {
                                                            if (inSourceMeasureCurrentFraction.RealValue > 0) {
                                                                offsetFraction = Fraction.multiply(Fraction.minus(inSourceMeasureCurrentFraction, inSourceMeasureFormerFraction), offsetFraction);
                                                                this.directionTimestamp = Fraction.minus(inSourceMeasureCurrentFraction, offsetFraction);
                                                            } else { this.directionTimestamp = Fraction.createFromFraction(offsetFraction); }
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 69..79

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

                                                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

                                                            try {
                                                                const placementString: string = placeAttr.value;
                                                                if (placementString === "below") {
                                                                    this.placement = PlacementEnum.Below;
                                                                } else if (placementString === "above") {
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 114..150

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

                                                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

                                                            try {
                                                                if (directionTypeNode) {
                                                                    const dynamicsNode: IXmlElement = directionTypeNode.element("dynamics");
                                                                    if (dynamicsNode) {
                                                                        const defAttr: IXmlAttribute = dynamicsNode.attribute("default-y");
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 98..111

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

                                                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

                                                                try {
                                                                    const numberXml: number = this.readNumber(octaveShiftNode);
                                                                    if (octaveShiftNode.attribute("size")) {
                                                                        const size: number = parseInt(octaveShiftNode.attribute("size").value, 10);
                                                                        let octave: number = 0;
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 354..413

                                                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

                                                                try {
                                                                    if (pedalNode.attribute("line")?.value === "yes") {
                                                                        line = true;
                                                                    } else if (pedalNode.attribute("line")?.value === "no"){
                                                                        line = false;
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 300..344

                                                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 (xOrY < 0) {
                                                                this.placement = PlacementEnum.Below;
                                                            } else if (xOrY > 0) {
                                                                this.placement = PlacementEnum.Above;
                                                            }
                                                Severity: Minor
                                                Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts and 1 other location - About 55 mins to fix
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 443..447

                                                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

                                                            if (y < 0) {
                                                                this.placement = PlacementEnum.Below;
                                                            } else if (y > 0) {
                                                                this.placement = PlacementEnum.Above;
                                                            }
                                                Severity: Minor
                                                Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts and 1 other location - About 55 mins to fix
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 455..459

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

                                                                    if (wedgeNode) {
                                                                        const defAttr: IXmlAttribute = wedgeNode.attribute("default-y");
                                                                        if (defAttr) {
                                                                            this.readExpressionPlacement(defAttr, "read wedge y pos");
                                                                        }
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 117..122
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 130..135
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 137..142

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

                                                                    if (wordsNode) {
                                                                        const defAttr: IXmlAttribute = wordsNode.attribute("default-y");
                                                                        if (defAttr) {
                                                                            this.readExpressionPlacement(defAttr, "read words y pos");
                                                                        }
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 117..122
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 123..128
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 137..142

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

                                                                    if (rehearsalNode) {
                                                                        const defAttr: IXmlAttribute = rehearsalNode.attribute("default-y");
                                                                        if (defAttr) {
                                                                            this.readExpressionPlacement(defAttr, "read rehearsal pos");
                                                                        }
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 117..122
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 123..128
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 130..135

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

                                                                    if (dynamicsNode) {
                                                                        const defAttr: IXmlAttribute = dynamicsNode.attribute("default-y");
                                                                        if (defAttr) {
                                                                            this.readExpressionPlacement(defAttr, "read dynamics y pos");
                                                                        }
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 123..128
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 130..135
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 137..142

                                                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

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

                                                                    if (this.activeInstantaneousDynamic !== undefined &&
                                                                        this.activeInstantaneousDynamic.StaffNumber === continuousDynamicExpression.StaffNumber) {
                                                                        this.activeInstantaneousDynamic = undefined;
                                                                    }
                                                Severity: Minor
                                                Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts and 1 other location - About 35 mins to fix
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 803..805

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

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

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

                                                            if (this.activeInstantaneousDynamic !== undefined && this.activeInstantaneousDynamic.StaffNumber === continuousDynamicExpression.StaffNumber) {
                                                                this.activeInstantaneousDynamic = undefined;
                                                            }
                                                Severity: Minor
                                                Found in src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts and 1 other location - About 35 mins to fix
                                                src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts on lines 670..673

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

                                                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