wikimedia/mediawiki-core

View on GitHub
resources/src/mediawiki.libs.jpegmeta/jpegmeta.js

Summary

Maintainability
F
4 days
Test Coverage

File jpegmeta.js has 528 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * This is JsJpegMeta v1.0
 * From: https://code.google.com/p/jsjpegmeta/downloads/list
 * From: https://github.com/bennoleslie/jsjpegmeta/blob/v1.0.0/jpegmeta.js
 *
Severity: Major
Found in resources/src/mediawiki.libs.jpegmeta/jpegmeta.js - About 1 day to fix

    Function _parseIfd has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        this.JpegMeta.JpegFile.prototype._parseIfd = function _parseIfd(endian, _binary_data, base, ifd_offset, tags, name, description) {
            var num_fields = JpegMeta.parseNum(endian, _binary_data, base + ifd_offset, 2);
            /* Per tag variables */
            var i, j;
            var tag_base;
    Severity: Major
    Found in resources/src/mediawiki.libs.jpegmeta/jpegmeta.js - About 2 hrs to fix

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

          JpegMeta.JpegFile = function JpegFile(binary_data, filename) {
              /* Change this to EOI if we want to parse. */
              var break_segment = this._SOS;
              
              this.metaGroups = {};
      Severity: Major
      Found in resources/src/mediawiki.libs.jpegmeta/jpegmeta.js - About 2 hrs to fix

        Function _exifHandler has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            JpegMeta.JpegFile.prototype._exifHandler = function _exifHandler(mark, pos) {
                if (this.exif !== undefined) {
                throw new Error("Multiple JFIF segments found");
                }
                
        Severity: Minor
        Found in resources/src/mediawiki.libs.jpegmeta/jpegmeta.js - About 1 hr to fix

          Function _parseIfd has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              this.JpegMeta.JpegFile.prototype._parseIfd = function _parseIfd(endian, _binary_data, base, ifd_offset, tags, name, description) {
          Severity: Major
          Found in resources/src/mediawiki.libs.jpegmeta/jpegmeta.js - About 50 mins to fix

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

                    if (this.gps.GPSLatitude) {
                        var latitude;
                        latitude = this.gps.GPSLatitude.value[0].asFloat() + 
                        (1 / 60) * this.gps.GPSLatitude.value[1].asFloat() + 
                        (1 / 3600) * this.gps.GPSLatitude.value[2].asFloat();
            Severity: Major
            Found in resources/src/mediawiki.libs.jpegmeta/jpegmeta.js and 1 other location - About 6 hrs to fix
            resources/src/mediawiki.libs.jpegmeta/jpegmeta.js on lines 718..727

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

            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.gps.GPSLongitude) {
                        var longitude;
                        longitude = this.gps.GPSLongitude.value[0].asFloat() + 
                        (1 / 60) * this.gps.GPSLongitude.value[1].asFloat() + 
                        (1 / 3600) * this.gps.GPSLongitude.value[2].asFloat();
            Severity: Major
            Found in resources/src/mediawiki.libs.jpegmeta/jpegmeta.js and 1 other location - About 6 hrs to fix
            resources/src/mediawiki.libs.jpegmeta/jpegmeta.js on lines 708..717

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

            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 (type == "SRATIONAL") {
                            num = JpegMeta.parseSnum(endian, _binary_data, value_offset, 4);
                            den = JpegMeta.parseSnum(endian, _binary_data, value_offset + 4, 4);
                            value.push(new JpegMeta.Rational(num, den));
                        }
            Severity: Major
            Found in resources/src/mediawiki.libs.jpegmeta/jpegmeta.js and 1 other location - About 1 hr to fix
            resources/src/mediawiki.libs.jpegmeta/jpegmeta.js on lines 610..614

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

            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 (type == "RATIONAL") {
                            num = JpegMeta.parseNum(endian, _binary_data, value_offset, 4);
                            den = JpegMeta.parseNum(endian, _binary_data, value_offset + 4, 4);
                            value.push(new JpegMeta.Rational(num, den));
                        }
            Severity: Major
            Found in resources/src/mediawiki.libs.jpegmeta/jpegmeta.js and 1 other location - About 1 hr to fix
            resources/src/mediawiki.libs.jpegmeta/jpegmeta.js on lines 615..619

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

            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 (type == "SBYTE" || type == "SSHORT" || type == "SLONG") {
                            value.push(JpegMeta.parseSnum(endian, _binary_data, value_offset, type_size));
                        }
            Severity: Minor
            Found in resources/src/mediawiki.libs.jpegmeta/jpegmeta.js and 1 other location - About 40 mins to fix
            resources/src/mediawiki.libs.jpegmeta/jpegmeta.js on lines 604..606

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 49.

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

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

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

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

            Refactorings

            Further Reading

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

                        if (type == "BYTE" || type == "SHORT" || type == "LONG") {
                            value.push(JpegMeta.parseNum(endian, _binary_data, value_offset, type_size));
                        }
            Severity: Minor
            Found in resources/src/mediawiki.libs.jpegmeta/jpegmeta.js and 1 other location - About 40 mins to fix
            resources/src/mediawiki.libs.jpegmeta/jpegmeta.js on lines 607..609

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 49.

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

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

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

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

            Refactorings

            Further Reading

            There are no issues that match your filters.

            Category
            Status