kristerkari/placekeeper

View on GitHub

Showing 12 of 90 total issues

File password.spec.js has 371 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as helpers from "../utils/helpers.js"
import * as placekeeper from "../../src/main.js"
import * as polyfill from "../../src/polyfill.js"

describe("password inputs", () => {
Severity: Minor
Found in test/unit/password.spec.js - About 4 hrs to fix

    Function checkForPlaceholder has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    function checkForPlaceholder(element) {
    
      if (!element) {
        return
      }
    Severity: Minor
    Found in src/main.js - About 4 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function triggerKeyboardEvent has 94 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function triggerKeyboardEvent(target, type, keyCode) {
        var evt;
    
        // Don't do events on text and comment nodes
        if (target.nodeType === 3 || target.nodeType === 8) {
    Severity: Major
    Found in test/utils/trigger-event.js - About 3 hrs to fix

      File hide-on-input.spec.js has 285 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import * as helpers from "../utils/helpers.js"
      import * as placekeeper from "../../src/main.js"
      import * as polyfill from "../../src/polyfill.js"
      import * as utils from "../../src/utils.js"
      import * as events from "../../src/events.js"
      Severity: Minor
      Found in test/unit/hide-on-input.spec.js - About 2 hrs to fix

        File public.spec.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import * as helpers from "../utils/helpers.js"
        import * as placekeeper from "../../src/main.js"
        import * as utils from "../../src/utils.js"
        import * as events from "../../src/events.js"
        import * as support from "../../src/support.js"
        Severity: Minor
        Found in test/unit/public.spec.js - About 2 hrs to fix

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

          function checkForPlaceholder(element) {
          
            if (!element) {
              return
            }
          Severity: Minor
          Found in src/main.js - About 1 hr to fix

            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

              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

                  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

                    Function setup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function setup() {
                      if (!support.hasNativePlaceholderSupport()) {
                    
                        $.fn.val = function(val) {
                          const originalValue = originalValFn.apply(this, arguments)
                    Severity: Minor
                    Found in src/adapters/adapter.jquery.js - About 55 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function showPlaceholder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function showPlaceholder(element) {
                      const val = data.getValueAttr(element)
                    
                      if (element.value !== "" || val == null) {
                        return
                    Severity: Minor
                    Found in src/polyfill.js - About 25 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Severity
                    Category
                    Status
                    Source
                    Language