nfroidure/midievents

View on GitHub

Showing 167 of 167 total issues

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

      if (events[i].length >>> 7) {
        destination[index++] = ((events[i].length >>> 7) & 0x7f) | 0x80;
      }
Severity: Major
Found in src/midievents.js and 5 other locations - About 50 mins to fix
src/midievents.js on lines 388..390
src/midievents.js on lines 391..393
src/midievents.js on lines 394..396
src/midievents.js on lines 426..428
src/midievents.js on lines 429..431

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

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

Avoid deeply nested control flow statements.
Open

            if (strictMode && 59 < events[i].seconds) {
              throw new Error(
                'Event #' +
                  i +
                  ': SMTPE offset seconds value must' +
Severity: Major
Found in src/midievents.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                for (k = 0, l = events[i].length; k < l; k++) {
                  destination[index++] = events[i].data[k];
                }
    Severity: Major
    Found in src/midievents.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  if (
                    'number' !== typeof events[i].scale ||
                    0 > events[i].scale ||
                    1 < events[i].scale
                  ) {
      Severity: Major
      Found in src/midievents.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    if (strictMode && 99 < events[i].subframes) {
                      throw new Error(
                        'Event #' +
                          i +
                          ': SMTPE offset subframes amount' +
        Severity: Major
        Found in src/midievents.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                      for (k = 0, l = events[i].length; k < l; k++) {
                        destination[index++] = events[i].data[k];
                      }
          Severity: Major
          Found in src/midievents.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                        if (strictMode && 23 < events[i].hour) {
                          throw new Error(
                            'Event #' +
                              i +
                              ': SMTPE offset hour value must be' +
            Severity: Major
            Found in src/midievents.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          if (strictMode && 59 < events[i].minutes) {
                            throw new Error(
                              'Event #' +
                                i +
                                ': SMTPE offset minutes value must' +
              Severity: Major
              Found in src/midievents.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                            if (
                              'number' != typeof events[i].key ||
                              -7 > events[i].key ||
                              7 < events[i].scale
                            ) {
                Severity: Major
                Found in src/midievents.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                              if (strictMode && 30 < events[i].frames) {
                                throw new Error(
                                  'Event #' +
                                    i +
                                    ': SMTPE offset frames amount must' +
                  Severity: Major
                  Found in src/midievents.js - About 45 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return event;
                    Severity: Major
                    Found in src/midievents.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                    return event;
                      Severity: Major
                      Found in src/midievents.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                      return event;
                        Severity: Major
                        Found in src/midievents.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return event;
                          Severity: Major
                          Found in src/midievents.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                          return event;
                            Severity: Major
                            Found in src/midievents.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                            return event;
                              Severity: Major
                              Found in src/midievents.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                            return event;
                                Severity: Major
                                Found in src/midievents.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                            return event;
                                  Severity: Major
                                  Found in src/midievents.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                                return event;
                                    Severity: Major
                                    Found in src/midievents.js - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                  return event;
                                      Severity: Major
                                      Found in src/midievents.js - About 30 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language