dipu-bd/jquery.bangla

View on GitHub

Showing 19 of 21 total issues

Function _processKeypress has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  _processKeypress (e) {
    this._checkEscape(e)

    if (e.ctrlKey && [KEY_CODE.DOT, KEY_CODE.SPACE].indexOf(e.keyCode) >= 0) {
      return this.toggleEnable()
Severity: Minor
Found in src/lib/bangla.js - About 3 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 _processKeypress has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _processKeypress (e) {
    this._checkEscape(e)

    if (e.ctrlKey && [KEY_CODE.DOT, KEY_CODE.SPACE].indexOf(e.keyCode) >= 0) {
      return this.toggleEnable()
Severity: Major
Found in src/lib/bangla.js - About 2 hrs to fix

    Function insertAtCursor has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    export function insertAtCursor ($elem, text) {
      if (!$elem) return
      text = text || ''
    
      // focus on input
    Severity: Minor
    Found in src/lib/utils.js - About 1 hr 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 insertAtCursor has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function insertAtCursor ($elem, text) {
      if (!$elem) return
      text = text || ''
    
      // focus on input
    Severity: Minor
    Found in src/lib/utils.js - About 1 hr to fix

      Function bangla has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      $.fn.bangla = function (key, val) {
        const selector = this.each(function () {
          if (!this[BANGLA]) {
            this[BANGLA] = new Bangla(this, key)
          }
      Severity: Minor
      Found in src/index.js - About 1 hr to fix

        Function bangla has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        $.fn.bangla = function (key, val) {
          const selector = this.each(function () {
            if (!this[BANGLA]) {
              this[BANGLA] = new Bangla(this, key)
            }
        Severity: Minor
        Found in src/index.js - About 45 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 _isWordKey has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          _isWordKey (e) {
            if (e.altKey || e.ctrlKey) return false
            if (e.keyCode === KEY_CODE.DOT) return true
            if (e.keyCode >= KEY_CODE.A && e.keyCode <= KEY_CODE.Z) return true
            if (e.keyCode >= KEY_CODE.ZERO && e.keyCode <= KEY_CODE.NINE) return !e.shiftKey
        Severity: Minor
        Found in src/lib/bangla.js - About 35 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

        Avoid too many return statements within this function.
        Open

                return false
        Severity: Major
        Found in src/lib/bangla.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  if (!word) return true
          Severity: Major
          Found in src/lib/bangla.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return false
            Severity: Major
            Found in src/lib/bangla.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return false
              Severity: Major
              Found in src/lib/bangla.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return true
                Severity: Major
                Found in src/lib/bangla.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return true
                  Severity: Major
                  Found in src/lib/bangla.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            if (this.view.active >= 0) return false
                    Severity: Major
                    Found in src/lib/bangla.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return false
                      Severity: Major
                      Found in src/lib/bangla.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                if (!word) return true
                        Severity: Major
                        Found in src/lib/bangla.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              if (e.keyCode >= KEY_CODE.NUMPAD_ZERO && e.keyCode <= KEY_CODE.NUMPAD_NINE) return true
                          Severity: Major
                          Found in src/lib/bangla.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return true
                            Severity: Major
                            Found in src/lib/bangla.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      if (!word) return true
                              Severity: Major
                              Found in src/lib/bangla.js - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language