adobe/brackets

View on GitHub
src/extensions/default/QuickView/unittests.js

Summary

Maintainability
F
4 days
Test Coverage

File unittests.js has 423 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/extensions/default/QuickView/unittests.js - About 6 hrs to fix

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

                it("Should not show image preview for extensionless URLs (with protocol) without pref set", function () {
                    // Flip the pref off and restore when done
                    var original = prefs.get("extensionlessImagePreview");
                    prefs.set("extensionlessImagePreview", false);
    
    
    Severity: Major
    Found in src/extensions/default/QuickView/unittests.js and 1 other location - About 2 hrs to fix
    src/extensions/default/QuickView/unittests.js on lines 488..498

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

    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

                it("Should show image preview for extensionless URLs (with protocol) with pref set", function () {
                    // Flip the pref on and restore when done
                    var original = prefs.get("extensionlessImagePreview");
                    prefs.set("extensionlessImagePreview", true);
    
    
    Severity: Major
    Found in src/extensions/default/QuickView/unittests.js and 1 other location - About 2 hrs to fix
    src/extensions/default/QuickView/unittests.js on lines 500..510

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

    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

                it("Should show radial gradient preview for those with colon or space before", function () {
                    runs(function () {
                        var expectedGradient = "radial-gradient(red, white 50%, blue 100%)";
                        checkGradientAtPos(expectedGradient, 176, 25);   // space colon space
                        checkGradientAtPos(expectedGradient, 177, 25);   // colon space
    Severity: Major
    Found in src/extensions/default/QuickView/unittests.js and 1 other location - About 2 hrs to fix
    src/extensions/default/QuickView/unittests.js on lines 252..260

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

    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

                it("Should show linear gradient preview for those with colon or space before", function () {
                    runs(function () {
                        var expectedGradient = "linear-gradient(to bottom, black 0%, white 100%)";
                        checkGradientAtPos(expectedGradient, 169, 25);   // space colon space
                        checkGradientAtPos(expectedGradient, 170, 25);   // colon space
    Severity: Major
    Found in src/extensions/default/QuickView/unittests.js and 1 other location - About 2 hrs to fix
    src/extensions/default/QuickView/unittests.js on lines 262..270

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

    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

                    runs(function () {
                        checkColorAtPos("blueviolet",    47, 15);
                        checkColorAtPos("darkgoldenrod", 49, 16);
                        checkColorAtPos("darkgray",      50, 16);
                        checkColorAtPos("firebrick",     51, 15);
    Severity: Major
    Found in src/extensions/default/QuickView/unittests.js and 1 other location - About 2 hrs to fix
    src/extensions/default/QuickView/unittests.js on lines 477..486

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

    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

                it("Should show image preview for URLs with known image extensions", function () {
                    checkImageDataAtPos("http://example.com/image.gif", 194, 20);
                    checkImageDataAtPos("http://example.com/image.png", 195, 20);
                    checkImageDataAtPos("http://example.com/image.jpe", 196, 20);
                    checkImageDataAtPos("http://example.com/image.jpeg", 197, 20);
    Severity: Major
    Found in src/extensions/default/QuickView/unittests.js and 1 other location - About 2 hrs to fix
    src/extensions/default/QuickView/unittests.js on lines 180..189

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

    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

                it("should NOT show preview of colors with invalid names", function () {
                    runs(function () {
                        expectNoPreviewAtPos(72, 15);    // cursor on redsox
                        expectNoPreviewAtPos(73, 16);    // cursor on pinky
                        expectNoPreviewAtPos(74, 16);    // cursor on blue in hyphenated word blue-cheese
    Severity: Major
    Found in src/extensions/default/QuickView/unittests.js and 1 other location - About 1 hr to fix
    src/extensions/default/QuickView/unittests.js on lines 206..213

    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

                    it("should NOT show preview of color-named functions and object/array keys", function () {
                        runs(function () {
                            expectNoPreviewAtPos(2, 12);    // cursor on green()
                            expectNoPreviewAtPos(4, 22);    // cursor on Math.tan
                            expectNoPreviewAtPos(5, 14);    // cursor on tan()
    Severity: Major
    Found in src/extensions/default/QuickView/unittests.js and 1 other location - About 1 hr to fix
    src/extensions/default/QuickView/unittests.js on lines 192..199

    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

                it("should show preview of valid hsl/hsla colors", function () {
                    runs(function () {
                        checkColorAtPos("hsl(0, 100%, 50%)",       31, 22);
                        checkColorAtPos("hsla(0, 100%, 50%, 0.5)", 32, 23);
                        checkColorAtPos("hsla(0, 100%, 50%, .5)",  33, 23);
    Severity: Major
    Found in src/extensions/default/QuickView/unittests.js and 1 other location - About 1 hr to fix
    src/extensions/default/QuickView/unittests.js on lines 440..447

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

    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

                it("Should show image preview for file path inside url()", function () {
                    runs(function () {
                        checkImagePathAtPos("img/grabber_color-well.png", 140, 26);
                        checkImagePathAtPos("img/Color.png",              141, 26);
                        checkImagePathAtPos("img/throbber.gif",           142, 26);
    Severity: Major
    Found in src/extensions/default/QuickView/unittests.js and 1 other location - About 1 hr to fix
    src/extensions/default/QuickView/unittests.js on lines 162..169

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

    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

                it("should NOT show preview of unsupported hsl/hsla colors", function () {
                    runs(function () {
                        expectNoPreviewAtPos(38, 25);    // cursor on hsla(90, 100%, 50%, 2)
                        expectNoPreviewAtPos(39, 24);    // cursor on hsla(0, 200%, 50%, 0.5)
                        expectNoPreviewAtPos(40, 25);    // cursor on hsla(0.0, 100%, 50%, .5)
    Severity: Major
    Found in src/extensions/default/QuickView/unittests.js and 1 other location - About 1 hr to fix
    src/extensions/default/QuickView/unittests.js on lines 154..160

    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

                it("should NOT show preview of unsupported rgb/rgba colors", function () {
                    runs(function () {
                        expectNoPreviewAtPos(25, 14);    // cursor on rgb(300, 0, 0)
                        expectNoPreviewAtPos(26, 15);    // cursor on rgb(0, 95.5, 0)
                        expectNoPreviewAtPos(27, 15);    // cursor on rgba(-0, 0, 0, 0.5)
    Severity: Major
    Found in src/extensions/default/QuickView/unittests.js and 1 other location - About 1 hr to fix
    src/extensions/default/QuickView/unittests.js on lines 171..177

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

        var SpecRunnerUtils    = brackets.getModule("spec/SpecRunnerUtils"),
            FileUtils          = brackets.getModule("file/FileUtils"),
            PreferencesManager = brackets.getModule("preferences/PreferencesManager"),
            prefs              = PreferencesManager.getExtensionPrefs("quickview");
    Severity: Major
    Found in src/extensions/default/QuickView/unittests.js and 3 other locations - About 55 mins to fix
    src/extensions/default/AutoUpdate/UpdateStatus.js on lines 27..31
    src/extensions/default/DebugCommands/ErrorNotification.js on lines 27..30
    src/extensions/default/RecentProjects/unittests.js on lines 29..32

    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

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

                it("Should show repeating linear gradient preview", function () {
                    runs(function () {
                        checkGradientAtPos("repeating-linear-gradient(red, blue 50%, red 100%)", 122, 50);
                        checkGradientAtPos("repeating-linear-gradient(red 0%, white 0%, blue 0%)", 123, 50);
                        checkGradientAtPos("repeating-linear-gradient(red 0%, white 50%, blue 100%)", 124, 50);
    Severity: Minor
    Found in src/extensions/default/QuickView/unittests.js and 1 other location - About 50 mins to fix
    src/extensions/default/QuickView/unittests.js on lines 455..461

    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

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

                it("Should show image preview for file path inside single or double quotes", function () {
                    runs(function () {
                        checkImagePathAtPos("img/med_hero.jpg",  147, 26);
                        checkImagePathAtPos("img/Gradient.png",  148, 26);
                        checkImagePathAtPos("img/specials.jpeg", 149, 26);
    Severity: Minor
    Found in src/extensions/default/QuickView/unittests.js and 1 other location - About 50 mins to fix
    src/extensions/default/QuickView/unittests.js on lines 307..313

    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

    There are no issues that match your filters.

    Category
    Status