adobe/brackets

View on GitHub
src/language/HTMLInstrumentation.js

Summary

Maintainability
F
2 wks
Test Coverage

File HTMLInstrumentation.js has 395 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2013 - present Adobe Systems Incorporated. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
Severity: Minor
Found in src/language/HTMLInstrumentation.js - About 5 hrs to fix

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

        DOMUpdater.prototype.update = function () {
            var markCache = {},
                newSubtree = this.build(true, markCache),
                result = {
                    // default result if we didn't identify a changed portion
    Severity: Minor
    Found in src/language/HTMLInstrumentation.js - About 1 hr to fix

      Function DOMUpdater has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function DOMUpdater(previousDOM, editor, changeList) {
              var text, startOffset = 0, startOffsetPos;
      
              this.isIncremental = false;
      
      
      Severity: Minor
      Found in src/language/HTMLInstrumentation.js - About 1 hr to fix

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

            DOMUpdater.prototype.update = function () {
                var markCache = {},
                    newSubtree = this.build(true, markCache),
                    result = {
                        // default result if we didn't identify a changed portion
        Severity: Major
        Found in src/language/HTMLInstrumentation.js and 1 other location - About 2 days to fix
        src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js on lines 435..499

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

        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

            DOMUpdater.prototype._updateMarkedRanges = function (nodeMap, markCache) {
                // FUTURE: this is somewhat inefficient (getting all the marks involves passing linearly through
                // the document once), but it doesn't seem to be a hotspot right now.
                var updateIDs = Object.keys(nodeMap),
                    cm = this.cm,
        Severity: Major
        Found in src/language/HTMLInstrumentation.js and 1 other location - About 2 days to fix
        src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js on lines 337..369

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

        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

            function DOMUpdater(previousDOM, editor, changeList) {
                var text, startOffset = 0, startOffsetPos;
        
                this.isIncremental = false;
        
        
        Severity: Major
        Found in src/language/HTMLInstrumentation.js and 1 other location - About 1 day to fix
        src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js on lines 238..283

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

        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

            function _processBrowserSimpleDOM(browserRoot, editorRootTagID) {
                var nodeMap         = {},
                    root;
        
                function _processElement(elem) {
        Severity: Major
        Found in src/language/HTMLInstrumentation.js and 1 other location - About 1 day to fix
        src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js on lines 600..641

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

        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

            function _getSortedTagMarks(marks, markCache) {
                marks = marks.filter(function (mark) {
                    return !!mark.tagID;
                }).map(function (mark) {
                    // All marks should exist since we just got them from CodeMirror.
        Severity: Major
        Found in src/language/HTMLInstrumentation.js and 1 other location - About 1 day to fix
        src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js on lines 103..120

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

        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

            DOMUpdater.prototype._handleDeletions = function (nodeMap, oldSubtreeMap, newSubtreeMap) {
                var deletedIDs = [];
                Object.keys(oldSubtreeMap).forEach(function (key) {
                    if (!newSubtreeMap.hasOwnProperty(key)) {
                        deletedIDs.push(key);
        Severity: Major
        Found in src/language/HTMLInstrumentation.js and 1 other location - About 7 hrs to fix
        src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js on lines 402..421

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

        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

            DOMUpdater.prototype.getID = function (newTag, markCache) {
                // Get the mark at the start of the tagname (not before the beginning of the tag, because that's
                // actually inside the parent).
                var currentTagID = _getTagIDAtDocumentPos(this.editor, HTMLSimpleDOM._offsetPos(newTag.startPos, 1), markCache);
        
        
        Severity: Major
        Found in src/language/HTMLInstrumentation.js and 1 other location - About 6 hrs to fix
        src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js on lines 311..329

        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

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

            function _updateDOM(previousDOM, editor, changeList) {
                if (!allowIncremental) {
                    changeList = undefined;
                }
                var updater = new DOMUpdater(previousDOM, editor, changeList);
        Severity: Major
        Found in src/language/HTMLInstrumentation.js and 1 other location - About 6 hrs to fix
        src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js on lines 518..540

        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

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

            DOMUpdater.prototype._buildNodeMap = function (root) {
                var nodeMap = {};
        
                function walk(node) {
                    if (node.tagID) {
        Severity: Major
        Found in src/language/HTMLInstrumentation.js and 1 other location - About 4 hrs to fix
        src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js on lines 377..391

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

        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

            function _markTextFromDOM(editor, dom) {
                var cm = editor._codeMirror;
        
                // Remove existing marks
                var marks = cm.getAllMarks();
        Severity: Major
        Found in src/language/HTMLInstrumentation.js and 1 other location - About 3 hrs to fix
        src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js on lines 208..223

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

        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

            function _markTags(cm, node) {
                node.children.forEach(function (childNode) {
                    if (childNode.isElement()) {
                        _markTags(cm, childNode);
                    }
        Severity: Major
        Found in src/language/HTMLInstrumentation.js and 1 other location - About 3 hrs to fix
        src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js on lines 192..200

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

        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

            function _getBrowserDiff(editor, browserSimpleDOM) {
                var cachedValue = _cachedValues[editor.document.file.fullPath],
                    editorRoot  = cachedValue.dom,
                    browserRoot;
        
        
        Severity: Major
        Found in src/language/HTMLInstrumentation.js and 1 other location - About 2 hrs to fix
        src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js on lines 649..661

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

        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

            function _removeDocFromCache(evt, document) {
                if (_cachedValues.hasOwnProperty(document.file.fullPath)) {
                    delete _cachedValues[document.file.fullPath];
                    document.off(".htmlInstrumentation");
                }
        Severity: Major
        Found in src/language/HTMLInstrumentation.js and 1 other location - About 1 hr to fix
        src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js on lines 72..77

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

        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

            function _hasAncestorWithID(node, id) {
                var ancestor = node.parent;
                while (ancestor && ancestor.tagID !== id) {
                    ancestor = ancestor.parent;
                }
        Severity: Major
        Found in src/language/HTMLInstrumentation.js and 1 other location - About 1 hr to fix
        src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js on lines 294..300

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

        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 (!cachedValue || !cachedValue.dom || _cachedValues[editor.document.file.fullPath].invalid) {
                    // We were in an invalid state, so do a full rebuild.
                    changeList = null;
                }
        Severity: Minor
        Found in src/language/HTMLInstrumentation.js and 1 other location - About 55 mins to fix
        src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js on lines 568..571

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

        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

                    _cachedValues[editor.document.file.fullPath] = {
                        timestamp: editor.document.diskTimestamp,
                        dom: result.dom,
                        dirty: false
                    };
        Severity: Minor
        Found in src/language/HTMLInstrumentation.js and 1 other location - About 45 mins to fix
        src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js on lines 576..580

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

        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