tanaikech/ImgApp

View on GitHub
ImgApp.js

Summary

Maintainability
D
2 days
Test Coverage

File ImgApp.js has 427 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Generated by CoffeeScript 1.12.7

/**
 * Title  ImgApp<br>
 * Author  Tanaike<br>
Severity: Minor
Found in ImgApp.js - About 6 hrs to fix

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

        ImgApp.prototype.DoResize = function(fileId, width) {
          var blob, e, headers, method, mimetype, n, res, resized, rs, thumbUrl, turl, url;
          try {
            url = "https://www.googleapis.com/drive/v3/files/" + fileId + "?supportsAllDrives=true&fields=thumbnailLink%2CmimeType";
            method = "get";
    Severity: Minor
    Found in ImgApp.js - About 1 hr to fix

      Function UpdateThumbnail has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ImgApp.prototype.UpdateThumbnail = function(imgFileId_, srcFileId_) {
            var boundary, data, fields, headers, img4thumb, metadata, method, mime, payload, url;
            if (imgFileId_ == null) {
              throw new Error("No image file ID.");
            }
      Severity: Minor
      Found in ImgApp.js - About 1 hr to fix

        Function GetSize has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            ImgApp.prototype.GetSize = function(blob) {
              var res;
              this.bytear = (function(blob) {
                var e;
                try {
        Severity: Minor
        Found in ImgApp.js - About 1 hr to fix

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

              getInfPNG = function() {
                return {
                  identification: "PNG",
                  width: byte2num(this.bytear.slice(16, 20), false),
                  height: byte2num(this.bytear.slice(20, 24), false),
          Severity: Major
          Found in ImgApp.js and 2 other locations - About 2 hrs to fix
          ImgApp.js on lines 391..398
          ImgApp.js on lines 400..407

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

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

              getInfBMP = function() {
                return {
                  identification: "BMP",
                  width: byte2num(this.bytear.slice(18, 22), true),
                  height: byte2num(this.bytear.slice(22, 26), true),
          Severity: Major
          Found in ImgApp.js and 2 other locations - About 2 hrs to fix
          ImgApp.js on lines 400..407
          ImgApp.js on lines 409..416

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

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

              getInfGIF = function() {
                return {
                  identification: "GIF",
                  width: byte2num(this.bytear.slice(6, 8), true),
                  height: byte2num(this.bytear.slice(8, 10), true),
          Severity: Major
          Found in ImgApp.js and 2 other locations - About 2 hrs to fix
          ImgApp.js on lines 391..398
          ImgApp.js on lines 409..416

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

          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

                var _, b, croppedBlob, height, l, object, presentationId, ref, rs, setHeight, setL, setT, setWidth, size, slide, slides, t, unit, width;
          Severity: Major
          Found in ImgApp.js and 1 other location - About 1 hr to fix
          ImgApp.js on lines 72..72

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

          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

              var GetImage, GetResizedSize, byte2hex, byte2hexNum, byte2num, cropImage, fetch, getFormat, getImageFromSlide, getInfBMP, getInfGIF, getInfJPG, getInfPNG, hex2num, mergeImages, pixelToEmu, pixelToPt, ptToEmu, ptToPixel;
          Severity: Major
          Found in ImgApp.js and 1 other location - About 1 hr to fix
          ImgApp.js on lines 164..164

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

          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