ramirezcgn/svgicons2svgfont

View on GitHub

Showing 54 of 54 total issues

File Matrix.js has 531 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable no-undef */
/*!
  2D Transformation Matrix v2.7.5
  (c) Epistemex.com 2014-2018
  License: MIT
Severity: Major
Found in src/Matrix.js - About 1 day to fix

    File index.js has 516 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* eslint-disable complexity,prefer-reflect,max-len,newline-after-var */
    /* eslint no-multi-str:0 */
    
    'use strict';
    
    
    Severity: Major
    Found in src/index.js - About 1 day to fix

      prototype has 56 functions (exceeds 20 allowed). Consider refactoring.
      Open

      Matrix.prototype = {
        _getPX: function () {
          var lst = ['t', 'oT', 'msT', 'mozT', 'webkitT', 'khtmlT'],
            i = 0,
            p,
      Severity: Major
      Found in src/Matrix.js - About 1 day to fix

        Function _transform has 177 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _transform(svgIconStream, _unused, svgIconStreamCallback) {
            // Parsing each icons asynchronously
            const saxStream = Sax.createStream(true);
            const parents = [];
            const defs = [];
        Severity: Major
        Found in src/index.js - About 7 hrs to fix

          Function _flush has 173 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            _flush(svgFontFlushCallback) {
              this.glyphs.forEach((glyph) => {
                if (
                  glyph.defaultHeight ||
                  glyph.defaultWidth ||
          Severity: Major
          Found in src/index.js - About 6 hrs to fix

            Function getMetadataService has 80 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function getMetadataService(options = {}) {
              let usedUnicodes = [];
            
              // Default options
              options.prependUnicode = !!options.prependUnicode;
            Severity: Major
            Found in src/metadata.js - About 3 hrs to fix

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

              function getMetadataService(options = {}) {
                let usedUnicodes = [];
              
                // Default options
                options.prependUnicode = !!options.prependUnicode;
              Severity: Minor
              Found in src/metadata.js - 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

              Function getMetadataFromFile has 66 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                return function getMetadataFromFile(file, cb) {
                  const basename = path.basename(file);
                  const metadata = {
                    path: file,
                    name: '',
              Severity: Major
              Found in src/metadata.js - About 2 hrs to fix

                Function fromTriangles has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Matrix.fromTriangles = function (t1, t2, context) {
                  var m1 = new Matrix(),
                    m2 = new Matrix(context),
                    r1,
                    r2,
                Severity: Major
                Found in src/Matrix.js - About 2 hrs to fix

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

                              if ('width' in tag.attributes) {
                                glyph.width = parseFloat(tag.attributes.width);
                              } else {
                                this.log(
                                  `Glyph "${glyph.name}" has no width attribute, using current glyph horizontal bounds.`
                  Severity: Major
                  Found in src/index.js and 1 other location - About 2 hrs to fix
                  src/index.js on lines 334..341

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

                  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 ('height' in tag.attributes) {
                                glyph.height = parseFloat(tag.attributes.height);
                              } else {
                                this.log(
                                  `Glyph "${glyph.name}" has no height attribute, using current glyph vertical bounds.`
                  Severity: Major
                  Found in src/index.js and 1 other location - About 2 hrs to fix
                  src/index.js on lines 326..333

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

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

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

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

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

                  Refactorings

                  Further Reading

                  Function decompose has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                    decompose: function (useLU) {
                      var me = this,
                        a = me.a,
                        b = me.b,
                        c = me.c,
                  Severity: Minor
                  Found in src/Matrix.js - 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

                  Function decompose has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    decompose: function (useLU) {
                      var me = this,
                        a = me.a,
                        b = me.b,
                        c = me.c,
                  Severity: Minor
                  Found in src/Matrix.js - About 1 hr to fix

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

                        if (
                          this.glyphs.some(
                            (anotherGlyph) =>
                              anotherGlyph !== glyph && anotherGlyph.unicode === glyph.unicode
                          )
                    Severity: Major
                    Found in src/index.js and 1 other location - About 1 hr to fix
                    src/index.js on lines 228..238

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

                    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.glyphs.some(
                            (anotherGlyph) =>
                              anotherGlyph !== glyph && anotherGlyph.name === glyph.name
                          )
                    Severity: Major
                    Found in src/index.js and 1 other location - About 1 hr to fix
                    src/index.js on lines 263..275

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

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

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

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

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

                    Refactorings

                    Further Reading

                    Function svgShapesToPathRectToPath has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function svgShapesToPathRectToPath(attributes) {
                      const x = 'undefined' !== typeof attributes.x ? parseFloat(attributes.x) : 0;
                      const y = 'undefined' !== typeof attributes.y ? parseFloat(attributes.y) : 0;
                      const width =
                        'undefined' !== typeof attributes.width ? parseFloat(attributes.width) : 0;
                    Severity: Minor
                    Found in src/svgshapes2svgpath.js - 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

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

                        r2 = [
                          t2.px - t2.rx,
                          t2.py - t2.ry,
                          t2.qx - t2.rx,
                          t2.qy - t2.ry,
                    Severity: Major
                    Found in src/Matrix.js and 1 other location - About 1 hr to fix
                    src/Matrix.js on lines 118..125

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

                    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

                        r1 = [
                          t1.px - t1.rx,
                          t1.py - t1.ry,
                          t1.qx - t1.rx,
                          t1.qy - t1.ry,
                    Severity: Major
                    Found in src/Matrix.js and 1 other location - About 1 hr to fix
                    src/Matrix.js on lines 126..133

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

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

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

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

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

                    Refactorings

                    Further Reading

                    Function from has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                    Matrix.from = function (a, b, c, d, e, f, context, dom) {
                      var m = new Matrix(context, dom),
                        scale,
                        dist,
                        q;
                    Severity: Minor
                    Found in src/Matrix.js - 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 _flush has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      _flush(svgFontFlushCallback) {
                        this.glyphs.forEach((glyph) => {
                          if (
                            glyph.defaultHeight ||
                            glyph.defaultWidth ||
                    Severity: Minor
                    Found in src/index.js - 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

                    Severity
                    Category
                    Status
                    Source
                    Language