CrazySquirrel/UserID

View on GitHub

Showing 11 of 13 total issues

File UserID.ts has 411 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";
/**
 * Import interfaces
 */
import IWindow from "../interfaces/IWindow";
Severity: Minor
Found in lib/UserID.ts - About 5 hrs to fix

Function each has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  public static each(obj, iterator, context) {
    if (obj === null) {
      return;
    }
    if (Array.prototype.forEach && obj.forEach === Array.prototype.forEach) {
Severity: Minor
Found in lib/UserID.ts - About 2 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 getIEPlugins has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public getIEPlugins(): any[] {
    try {
      let arrResult = [];
      /**
       * If ActiveXObject supported
Severity: Major
Found in lib/UserID.ts - About 2 hrs to fix

Function getRegularPlugins has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public getRegularPlugins() {
    try {
      /**
       * Plugins list
       * @type {Array}
Severity: Minor
Found in lib/UserID.ts - About 1 hr to fix

Function getIPFromRTC has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public getIPFromRTC(callback) {
    try {
      window.RTCPeerConnection = (
          window.RTCPeerConnection ||
          window.mozRTCPeerConnection ||
Severity: Minor
Found in lib/UserID.ts - About 1 hr to fix

Function getIPFromServer has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  public getIPFromServer(callback) {
    try {
      if (
          this.Settings &&
          this.Settings.IPUrl
Severity: Minor
Found in lib/UserID.ts - 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 getIP has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public getIP(callback) {
    try {
      if (
          this.Settings &&
          this.Settings.IPUrl
Severity: Minor
Found in lib/UserID.ts - About 1 hr to fix

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

  public getIPFromServer(callback) {
    try {
      if (
          this.Settings &&
          this.Settings.IPUrl
Severity: Minor
Found in lib/UserID.ts - About 1 hr to fix

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

  constructor(settings: any = {}) {
    /**
     * Clear previous version of FingerPrint
     */
    UserID.clearPrevious();
Severity: Minor
Found in lib/UserID.ts - About 1 hr to fix

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

  public getIPFromRTC(callback) {
    try {
      window.RTCPeerConnection = (
          window.RTCPeerConnection ||
          window.mozRTCPeerConnection ||
Severity: Minor
Found in lib/UserID.ts - 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 clearPrevious has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  public static clearPrevious() {
    /**
     * Check if localStorage is supported
     */
    if (typeof localStorage !== "undefined") {
Severity: Minor
Found in lib/UserID.ts - 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

Severity
Category
Status
Source
Language