kristerkari/placekeeper

View on GitHub

Showing 90 of 90 total issues

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

export const createInputElementWithoutType = function(hasPlaceholder) {
  let element = "<input id=\"elem\" maxlength=\"12\""
  if (hasPlaceholder) {
    element += " placeholder=\"Test\""
  }
Severity: Major
Found in test/utils/helpers.js and 2 other locations - About 1 hr to fix
test/utils/helpers.js on lines 196..204
test/utils/helpers.js on lines 205..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 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 3 locations. Consider refactoring.
Open

export const createTextareaElementWithValue = function(hasPlaceholder) {
  let element = "<textarea id=\"elem\""
  if (hasPlaceholder) {
    element += " placeholder=\"Test\""
  }
Severity: Major
Found in test/utils/helpers.js and 2 other locations - About 1 hr to fix
test/utils/helpers.js on lines 126..134
test/utils/helpers.js on lines 196..204

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 _initKeyboardEvent_type has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var _initKeyboardEvent_type = (function() {

    try {
      var e = document.createEvent("KeyboardEvent");
      e.initKeyboardEvent(
Severity: Minor
Found in test/utils/trigger-event.js - About 1 hr to fix

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

            beforeEach((done) => {
              helpers.retryFocus(element, () => {
                setTimeout(() => {
                  element = document.getElementById("elem")
                  done()
    Severity: Major
    Found in test/unit/change-placeholder.spec.js and 1 other location - About 1 hr to fix
    test/unit/change-type.spec.js on lines 208..215

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

    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

                beforeEach((done) => {
                  helpers.retryFocus(element, () => {
                    setTimeout(() => {
                      element = document.getElementById("elem")
                      done()
    Severity: Major
    Found in test/unit/change-type.spec.js and 1 other location - About 1 hr to fix
    test/unit/change-placeholder.spec.js on lines 63..70

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

    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 exports has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(config) {
      "use strict";
    
      var customLaunchers = {
        // iOSSafari: {
    Severity: Minor
    Found in test/config/karma.sauce.conf.js - About 1 hr to fix

      Function exports has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function(config) {
        "use strict";
      
        config.set(extend(shared, {
          preprocessors: {
      Severity: Minor
      Found in test/config/karma.conf.js - About 1 hr to fix

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

                  beforeEach((done) => {
                    element.setAttribute("data-placeholder-type", "text")
                    setTimeout(() => {
                      element = document.getElementById("elem")
                      done()
        Severity: Major
        Found in test/unit/change-type.spec.js and 1 other location - About 1 hr to fix
        test/unit/change-placeholder.spec.js on lines 41..47

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

        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

              beforeEach((done) => {
                element.setAttribute("placeholder", "Changed")
                setTimeout(() => {
                  element = document.getElementById("elem")
                  done()
        Severity: Major
        Found in test/unit/change-placeholder.spec.js and 1 other location - About 1 hr to fix
        test/unit/change-type.spec.js on lines 155..161

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

        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

                  beforeEach((done) => {
                    element.type = "password"
                    setTimeout(() => {
                      element = document.getElementById("elem")
                      done()
        Severity: Major
        Found in test/unit/change-type.spec.js and 1 other location - About 1 hr to fix
        test/unit/disable-polyfill.spec.js on lines 41..47

        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

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

              beforeEach((done) => {
                element.value = "Changed"
                setTimeout(() => {
                  element = document.getElementById("elem")
                  done()
        Severity: Major
        Found in test/unit/disable-polyfill.spec.js and 1 other location - About 1 hr to fix
        test/unit/change-type.spec.js on lines 190..196

        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

                beforeEach((done) => {
                  helpers.spyOnCanChangeToTypeAndReturn(true)
                  element = helpers.createInputElement(true, "password")
                  placekeeper.setupPlaceholders()
                  setTimeout(done, helpers.loopDurationForTests)
        Severity: Major
        Found in test/unit/public.spec.js and 1 other location - About 1 hr to fix
        test/unit/password.spec.js on lines 14..19

        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

              beforeEach((done) => {
                helpers.spyOnCanChangeToTypeAndReturn(true)
                element = helpers.createInputElement(true, "password")
                placekeeper.setupPlaceholders()
                setTimeout(done, helpers.loopDurationForTests)
        Severity: Major
        Found in test/unit/password.spec.js and 1 other location - About 1 hr to fix
        test/unit/public.spec.js on lines 110..115

        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

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

                  it("should have called utils.preventDefault method", () => {
                    expect(utils.preventDefault).toHaveBeenCalled()
                    expect(utils.preventDefault.calls.count()).toEqual(1)
                  })
        Severity: Major
        Found in test/unit/hide-on-input.spec.js and 1 other location - About 1 hr to fix
        test/unit/watch.spec.js on lines 51..54

        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 have called polyfill's showPlaceholder method once", () => {
              expect(polyfill.showPlaceholder).toHaveBeenCalled()
              expect(polyfill.showPlaceholder.calls.count()).toEqual(1)
            })
        Severity: Major
        Found in test/unit/watch.spec.js and 1 other location - About 1 hr to fix
        test/unit/hide-on-input.spec.js on lines 309..312

        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

        Function buildAdapter has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function buildAdapter(adapter) {
            return gulp.src([
              "src/adapters/module." + adapter + ".js"
            ])
            .pipe(rollup({
        Severity: Minor
        Found in gulpfile.babel.js - About 1 hr to fix

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

                beforeEach(() => {
                  focusHandler = events.handlers.focus
                  blurHandler = events.handlers.blur
                  spyOn(utils, "removeEventListener")
                  placekeeper.disable()
          Severity: Major
          Found in test/unit/reload.spec.js and 1 other location - About 1 hr to fix
          test/unit/public.spec.js on lines 129..134

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

          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

                    beforeEach(() => {
                      focusHandler = events.handlers.focus
                      blurHandler = events.handlers.blur
                      spyOn(utils, "removeEventListener")
                      placekeeper.disable()
          Severity: Major
          Found in test/unit/public.spec.js and 1 other location - About 1 hr to fix
          test/unit/reload.spec.js on lines 148..153

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

          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

              beforeEach(() => {
                spyOn(utils, "getElementsByTagName")
                support.isInputSupported.and.returnValue(true)
                support.isTextareaSupported.and.returnValue(false)
              })
          Severity: Major
          Found in test/unit/elements.spec.js and 3 other locations - About 1 hr to fix
          test/unit/elements.spec.js on lines 39..43
          test/unit/elements.spec.js on lines 64..68
          test/unit/elements.spec.js on lines 90..94

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

          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

              beforeEach(() => {
                spyOn(utils, "getElementsByTagName")
                support.isInputSupported.and.returnValue(false)
                support.isTextareaSupported.and.returnValue(false)
              })
          Severity: Major
          Found in test/unit/elements.spec.js and 3 other locations - About 1 hr to fix
          test/unit/elements.spec.js on lines 13..17
          test/unit/elements.spec.js on lines 39..43
          test/unit/elements.spec.js on lines 64..68

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

          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

          Severity
          Category
          Status
          Source
          Language