radare/radare2-webui

View on GitHub
www/m/js/core/SettingsManager.js

Summary

Maintainability
A
25 mins
Test Coverage

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

    getItem(key) {
        if (!this.keyExists(key)) throw new Error(`ConfKey ${key} doesn't exist!`);
        
        var local = localStorage.getItem(key);
        if (local !== null) {
Severity: Minor
Found in www/m/js/core/SettingsManager.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

Missing JSDoc comment.
Open

    get keys() { return this.itemKeys };
Severity: Minor
Found in www/m/js/core/SettingsManager.js by eslint

require JSDoc comments (require-jsdoc)

JSDoc is a JavaScript API documentation generator. It uses specially-formatted comments inside of code to generate API documentation automatically. For example, this is what a JSDoc comment looks like for a function:

/**
 * Adds two numbers together.
 * @param {int} num1 The first number.
 * @param {int} num2 The second number.
 * @returns {int} The sum of the two numbers.
 */
function sum(num1, num2) {
    return num1 + num2;
}

Some style guides require JSDoc comments for all functions as a way of explaining function behavior.

Rule Details

This rule requires JSDoc comments for specified nodes. Supported nodes:

  • "FunctionDeclaration"
  • "ClassDeclaration"
  • "MethodDefinition"
  • "ArrowFunctionExpression"

Options

This rule has a single object option:

  • "require" requires JSDoc comments for the specified nodes

Default option settings are:

{
    "require-jsdoc": ["error", {
        "require": {
            "FunctionDeclaration": true,
            "MethodDefinition": false,
            "ClassDeclaration": false,
            "ArrowFunctionExpression": false
        }
    }]
}

require

Examples of incorrect code for this rule with the { "require": { "FunctionDeclaration": true, "MethodDefinition": true, "ClassDeclaration": true, "ArrowFunctionExpression": true } } option:

/*eslint "require-jsdoc": ["error", {
    "require": {
        "FunctionDeclaration": true,
        "MethodDefinition": true,
        "ClassDeclaration": true
    }
}]*/

function foo() {
    return 10;
}

var foo = () => {
    return 10;
}

class Test{
    getDate(){}
}

Examples of correct code for this rule with the { "require": { "FunctionDeclaration": true, "MethodDefinition": true, "ClassDeclaration": true, "ArrowFunctionExpression": true } } option:

/*eslint "require-jsdoc": ["error", {
    "require": {
        "FunctionDeclaration": true,
        "MethodDefinition": true,
        "ClassDeclaration": true
    }
}]*/

/**
 * It returns 10
 */
function foo() {
    return 10;
}

/**
 * It returns test + 10
 * @params {int} test - some number
 * @returns {int} sum of test and 10
 */
var foo = (test) => {
    return test + 10;
}

/**
 * It returns 10
 */
var foo = () => {
    return 10;
}

/**
 * It returns 10
 */
var foo = function() {
    return 10;
}

var array = [1,2,3];
array.filter(function(item) {
    return item > 2;
});

/**
 * It returns 10
 */
class Test{
    /**
    * returns the date
    */
    getDate(){}
}

setTimeout(() => {}, 10); // since it's an anonymous arrow function

When Not To Use It

If you do not require JSDoc for your functions, then you can leave this rule off.

Related Rules

Missing JSDoc comment.
Open

export class SettingsManager {
Severity: Minor
Found in www/m/js/core/SettingsManager.js by eslint

require JSDoc comments (require-jsdoc)

JSDoc is a JavaScript API documentation generator. It uses specially-formatted comments inside of code to generate API documentation automatically. For example, this is what a JSDoc comment looks like for a function:

/**
 * Adds two numbers together.
 * @param {int} num1 The first number.
 * @param {int} num2 The second number.
 * @returns {int} The sum of the two numbers.
 */
function sum(num1, num2) {
    return num1 + num2;
}

Some style guides require JSDoc comments for all functions as a way of explaining function behavior.

Rule Details

This rule requires JSDoc comments for specified nodes. Supported nodes:

  • "FunctionDeclaration"
  • "ClassDeclaration"
  • "MethodDefinition"
  • "ArrowFunctionExpression"

Options

This rule has a single object option:

  • "require" requires JSDoc comments for the specified nodes

Default option settings are:

{
    "require-jsdoc": ["error", {
        "require": {
            "FunctionDeclaration": true,
            "MethodDefinition": false,
            "ClassDeclaration": false,
            "ArrowFunctionExpression": false
        }
    }]
}

require

Examples of incorrect code for this rule with the { "require": { "FunctionDeclaration": true, "MethodDefinition": true, "ClassDeclaration": true, "ArrowFunctionExpression": true } } option:

/*eslint "require-jsdoc": ["error", {
    "require": {
        "FunctionDeclaration": true,
        "MethodDefinition": true,
        "ClassDeclaration": true
    }
}]*/

function foo() {
    return 10;
}

var foo = () => {
    return 10;
}

class Test{
    getDate(){}
}

Examples of correct code for this rule with the { "require": { "FunctionDeclaration": true, "MethodDefinition": true, "ClassDeclaration": true, "ArrowFunctionExpression": true } } option:

/*eslint "require-jsdoc": ["error", {
    "require": {
        "FunctionDeclaration": true,
        "MethodDefinition": true,
        "ClassDeclaration": true
    }
}]*/

/**
 * It returns 10
 */
function foo() {
    return 10;
}

/**
 * It returns test + 10
 * @params {int} test - some number
 * @returns {int} sum of test and 10
 */
var foo = (test) => {
    return test + 10;
}

/**
 * It returns 10
 */
var foo = () => {
    return 10;
}

/**
 * It returns 10
 */
var foo = function() {
    return 10;
}

var array = [1,2,3];
array.filter(function(item) {
    return item > 2;
});

/**
 * It returns 10
 */
class Test{
    /**
    * returns the date
    */
    getDate(){}
}

setTimeout(() => {}, 10); // since it's an anonymous arrow function

When Not To Use It

If you do not require JSDoc for your functions, then you can leave this rule off.

Related Rules

Missing JSDoc comment.
Open

    loadAll(force = false) {
Severity: Minor
Found in www/m/js/core/SettingsManager.js by eslint

require JSDoc comments (require-jsdoc)

JSDoc is a JavaScript API documentation generator. It uses specially-formatted comments inside of code to generate API documentation automatically. For example, this is what a JSDoc comment looks like for a function:

/**
 * Adds two numbers together.
 * @param {int} num1 The first number.
 * @param {int} num2 The second number.
 * @returns {int} The sum of the two numbers.
 */
function sum(num1, num2) {
    return num1 + num2;
}

Some style guides require JSDoc comments for all functions as a way of explaining function behavior.

Rule Details

This rule requires JSDoc comments for specified nodes. Supported nodes:

  • "FunctionDeclaration"
  • "ClassDeclaration"
  • "MethodDefinition"
  • "ArrowFunctionExpression"

Options

This rule has a single object option:

  • "require" requires JSDoc comments for the specified nodes

Default option settings are:

{
    "require-jsdoc": ["error", {
        "require": {
            "FunctionDeclaration": true,
            "MethodDefinition": false,
            "ClassDeclaration": false,
            "ArrowFunctionExpression": false
        }
    }]
}

require

Examples of incorrect code for this rule with the { "require": { "FunctionDeclaration": true, "MethodDefinition": true, "ClassDeclaration": true, "ArrowFunctionExpression": true } } option:

/*eslint "require-jsdoc": ["error", {
    "require": {
        "FunctionDeclaration": true,
        "MethodDefinition": true,
        "ClassDeclaration": true
    }
}]*/

function foo() {
    return 10;
}

var foo = () => {
    return 10;
}

class Test{
    getDate(){}
}

Examples of correct code for this rule with the { "require": { "FunctionDeclaration": true, "MethodDefinition": true, "ClassDeclaration": true, "ArrowFunctionExpression": true } } option:

/*eslint "require-jsdoc": ["error", {
    "require": {
        "FunctionDeclaration": true,
        "MethodDefinition": true,
        "ClassDeclaration": true
    }
}]*/

/**
 * It returns 10
 */
function foo() {
    return 10;
}

/**
 * It returns test + 10
 * @params {int} test - some number
 * @returns {int} sum of test and 10
 */
var foo = (test) => {
    return test + 10;
}

/**
 * It returns 10
 */
var foo = () => {
    return 10;
}

/**
 * It returns 10
 */
var foo = function() {
    return 10;
}

var array = [1,2,3];
array.filter(function(item) {
    return item > 2;
});

/**
 * It returns 10
 */
class Test{
    /**
    * returns the date
    */
    getDate(){}
}

setTimeout(() => {}, 10); // since it's an anonymous arrow function

When Not To Use It

If you do not require JSDoc for your functions, then you can leave this rule off.

Related Rules

Missing JSDoc comment.
Open

    getItem(key) {
Severity: Minor
Found in www/m/js/core/SettingsManager.js by eslint

require JSDoc comments (require-jsdoc)

JSDoc is a JavaScript API documentation generator. It uses specially-formatted comments inside of code to generate API documentation automatically. For example, this is what a JSDoc comment looks like for a function:

/**
 * Adds two numbers together.
 * @param {int} num1 The first number.
 * @param {int} num2 The second number.
 * @returns {int} The sum of the two numbers.
 */
function sum(num1, num2) {
    return num1 + num2;
}

Some style guides require JSDoc comments for all functions as a way of explaining function behavior.

Rule Details

This rule requires JSDoc comments for specified nodes. Supported nodes:

  • "FunctionDeclaration"
  • "ClassDeclaration"
  • "MethodDefinition"
  • "ArrowFunctionExpression"

Options

This rule has a single object option:

  • "require" requires JSDoc comments for the specified nodes

Default option settings are:

{
    "require-jsdoc": ["error", {
        "require": {
            "FunctionDeclaration": true,
            "MethodDefinition": false,
            "ClassDeclaration": false,
            "ArrowFunctionExpression": false
        }
    }]
}

require

Examples of incorrect code for this rule with the { "require": { "FunctionDeclaration": true, "MethodDefinition": true, "ClassDeclaration": true, "ArrowFunctionExpression": true } } option:

/*eslint "require-jsdoc": ["error", {
    "require": {
        "FunctionDeclaration": true,
        "MethodDefinition": true,
        "ClassDeclaration": true
    }
}]*/

function foo() {
    return 10;
}

var foo = () => {
    return 10;
}

class Test{
    getDate(){}
}

Examples of correct code for this rule with the { "require": { "FunctionDeclaration": true, "MethodDefinition": true, "ClassDeclaration": true, "ArrowFunctionExpression": true } } option:

/*eslint "require-jsdoc": ["error", {
    "require": {
        "FunctionDeclaration": true,
        "MethodDefinition": true,
        "ClassDeclaration": true
    }
}]*/

/**
 * It returns 10
 */
function foo() {
    return 10;
}

/**
 * It returns test + 10
 * @params {int} test - some number
 * @returns {int} sum of test and 10
 */
var foo = (test) => {
    return test + 10;
}

/**
 * It returns 10
 */
var foo = () => {
    return 10;
}

/**
 * It returns 10
 */
var foo = function() {
    return 10;
}

var array = [1,2,3];
array.filter(function(item) {
    return item > 2;
});

/**
 * It returns 10
 */
class Test{
    /**
    * returns the date
    */
    getDate(){}
}

setTimeout(() => {}, 10); // since it's an anonymous arrow function

When Not To Use It

If you do not require JSDoc for your functions, then you can leave this rule off.

Related Rules

Missing JSDoc comment.
Open

    getItemDefaultValue(key) {
Severity: Minor
Found in www/m/js/core/SettingsManager.js by eslint

require JSDoc comments (require-jsdoc)

JSDoc is a JavaScript API documentation generator. It uses specially-formatted comments inside of code to generate API documentation automatically. For example, this is what a JSDoc comment looks like for a function:

/**
 * Adds two numbers together.
 * @param {int} num1 The first number.
 * @param {int} num2 The second number.
 * @returns {int} The sum of the two numbers.
 */
function sum(num1, num2) {
    return num1 + num2;
}

Some style guides require JSDoc comments for all functions as a way of explaining function behavior.

Rule Details

This rule requires JSDoc comments for specified nodes. Supported nodes:

  • "FunctionDeclaration"
  • "ClassDeclaration"
  • "MethodDefinition"
  • "ArrowFunctionExpression"

Options

This rule has a single object option:

  • "require" requires JSDoc comments for the specified nodes

Default option settings are:

{
    "require-jsdoc": ["error", {
        "require": {
            "FunctionDeclaration": true,
            "MethodDefinition": false,
            "ClassDeclaration": false,
            "ArrowFunctionExpression": false
        }
    }]
}

require

Examples of incorrect code for this rule with the { "require": { "FunctionDeclaration": true, "MethodDefinition": true, "ClassDeclaration": true, "ArrowFunctionExpression": true } } option:

/*eslint "require-jsdoc": ["error", {
    "require": {
        "FunctionDeclaration": true,
        "MethodDefinition": true,
        "ClassDeclaration": true
    }
}]*/

function foo() {
    return 10;
}

var foo = () => {
    return 10;
}

class Test{
    getDate(){}
}

Examples of correct code for this rule with the { "require": { "FunctionDeclaration": true, "MethodDefinition": true, "ClassDeclaration": true, "ArrowFunctionExpression": true } } option:

/*eslint "require-jsdoc": ["error", {
    "require": {
        "FunctionDeclaration": true,
        "MethodDefinition": true,
        "ClassDeclaration": true
    }
}]*/

/**
 * It returns 10
 */
function foo() {
    return 10;
}

/**
 * It returns test + 10
 * @params {int} test - some number
 * @returns {int} sum of test and 10
 */
var foo = (test) => {
    return test + 10;
}

/**
 * It returns 10
 */
var foo = () => {
    return 10;
}

/**
 * It returns 10
 */
var foo = function() {
    return 10;
}

var array = [1,2,3];
array.filter(function(item) {
    return item > 2;
});

/**
 * It returns 10
 */
class Test{
    /**
    * returns the date
    */
    getDate(){}
}

setTimeout(() => {}, 10); // since it's an anonymous arrow function

When Not To Use It

If you do not require JSDoc for your functions, then you can leave this rule off.

Related Rules

Missing JSDoc comment.
Open

    resetAll() {
Severity: Minor
Found in www/m/js/core/SettingsManager.js by eslint

require JSDoc comments (require-jsdoc)

JSDoc is a JavaScript API documentation generator. It uses specially-formatted comments inside of code to generate API documentation automatically. For example, this is what a JSDoc comment looks like for a function:

/**
 * Adds two numbers together.
 * @param {int} num1 The first number.
 * @param {int} num2 The second number.
 * @returns {int} The sum of the two numbers.
 */
function sum(num1, num2) {
    return num1 + num2;
}

Some style guides require JSDoc comments for all functions as a way of explaining function behavior.

Rule Details

This rule requires JSDoc comments for specified nodes. Supported nodes:

  • "FunctionDeclaration"
  • "ClassDeclaration"
  • "MethodDefinition"
  • "ArrowFunctionExpression"

Options

This rule has a single object option:

  • "require" requires JSDoc comments for the specified nodes

Default option settings are:

{
    "require-jsdoc": ["error", {
        "require": {
            "FunctionDeclaration": true,
            "MethodDefinition": false,
            "ClassDeclaration": false,
            "ArrowFunctionExpression": false
        }
    }]
}

require

Examples of incorrect code for this rule with the { "require": { "FunctionDeclaration": true, "MethodDefinition": true, "ClassDeclaration": true, "ArrowFunctionExpression": true } } option:

/*eslint "require-jsdoc": ["error", {
    "require": {
        "FunctionDeclaration": true,
        "MethodDefinition": true,
        "ClassDeclaration": true
    }
}]*/

function foo() {
    return 10;
}

var foo = () => {
    return 10;
}

class Test{
    getDate(){}
}

Examples of correct code for this rule with the { "require": { "FunctionDeclaration": true, "MethodDefinition": true, "ClassDeclaration": true, "ArrowFunctionExpression": true } } option:

/*eslint "require-jsdoc": ["error", {
    "require": {
        "FunctionDeclaration": true,
        "MethodDefinition": true,
        "ClassDeclaration": true
    }
}]*/

/**
 * It returns 10
 */
function foo() {
    return 10;
}

/**
 * It returns test + 10
 * @params {int} test - some number
 * @returns {int} sum of test and 10
 */
var foo = (test) => {
    return test + 10;
}

/**
 * It returns 10
 */
var foo = () => {
    return 10;
}

/**
 * It returns 10
 */
var foo = function() {
    return 10;
}

var array = [1,2,3];
array.filter(function(item) {
    return item > 2;
});

/**
 * It returns 10
 */
class Test{
    /**
    * returns the date
    */
    getDate(){}
}

setTimeout(() => {}, 10); // since it's an anonymous arrow function

When Not To Use It

If you do not require JSDoc for your functions, then you can leave this rule off.

Related Rules

Missing JSDoc comment.
Open

    constructor(keys, baseConf) {
Severity: Minor
Found in www/m/js/core/SettingsManager.js by eslint

require JSDoc comments (require-jsdoc)

JSDoc is a JavaScript API documentation generator. It uses specially-formatted comments inside of code to generate API documentation automatically. For example, this is what a JSDoc comment looks like for a function:

/**
 * Adds two numbers together.
 * @param {int} num1 The first number.
 * @param {int} num2 The second number.
 * @returns {int} The sum of the two numbers.
 */
function sum(num1, num2) {
    return num1 + num2;
}

Some style guides require JSDoc comments for all functions as a way of explaining function behavior.

Rule Details

This rule requires JSDoc comments for specified nodes. Supported nodes:

  • "FunctionDeclaration"
  • "ClassDeclaration"
  • "MethodDefinition"
  • "ArrowFunctionExpression"

Options

This rule has a single object option:

  • "require" requires JSDoc comments for the specified nodes

Default option settings are:

{
    "require-jsdoc": ["error", {
        "require": {
            "FunctionDeclaration": true,
            "MethodDefinition": false,
            "ClassDeclaration": false,
            "ArrowFunctionExpression": false
        }
    }]
}

require

Examples of incorrect code for this rule with the { "require": { "FunctionDeclaration": true, "MethodDefinition": true, "ClassDeclaration": true, "ArrowFunctionExpression": true } } option:

/*eslint "require-jsdoc": ["error", {
    "require": {
        "FunctionDeclaration": true,
        "MethodDefinition": true,
        "ClassDeclaration": true
    }
}]*/

function foo() {
    return 10;
}

var foo = () => {
    return 10;
}

class Test{
    getDate(){}
}

Examples of correct code for this rule with the { "require": { "FunctionDeclaration": true, "MethodDefinition": true, "ClassDeclaration": true, "ArrowFunctionExpression": true } } option:

/*eslint "require-jsdoc": ["error", {
    "require": {
        "FunctionDeclaration": true,
        "MethodDefinition": true,
        "ClassDeclaration": true
    }
}]*/

/**
 * It returns 10
 */
function foo() {
    return 10;
}

/**
 * It returns test + 10
 * @params {int} test - some number
 * @returns {int} sum of test and 10
 */
var foo = (test) => {
    return test + 10;
}

/**
 * It returns 10
 */
var foo = () => {
    return 10;
}

/**
 * It returns 10
 */
var foo = function() {
    return 10;
}

var array = [1,2,3];
array.filter(function(item) {
    return item > 2;
});

/**
 * It returns 10
 */
class Test{
    /**
    * returns the date
    */
    getDate(){}
}

setTimeout(() => {}, 10); // since it's an anonymous arrow function

When Not To Use It

If you do not require JSDoc for your functions, then you can leave this rule off.

Related Rules

Missing JSDoc comment.
Open

    setItem(key, value) {
Severity: Minor
Found in www/m/js/core/SettingsManager.js by eslint

require JSDoc comments (require-jsdoc)

JSDoc is a JavaScript API documentation generator. It uses specially-formatted comments inside of code to generate API documentation automatically. For example, this is what a JSDoc comment looks like for a function:

/**
 * Adds two numbers together.
 * @param {int} num1 The first number.
 * @param {int} num2 The second number.
 * @returns {int} The sum of the two numbers.
 */
function sum(num1, num2) {
    return num1 + num2;
}

Some style guides require JSDoc comments for all functions as a way of explaining function behavior.

Rule Details

This rule requires JSDoc comments for specified nodes. Supported nodes:

  • "FunctionDeclaration"
  • "ClassDeclaration"
  • "MethodDefinition"
  • "ArrowFunctionExpression"

Options

This rule has a single object option:

  • "require" requires JSDoc comments for the specified nodes

Default option settings are:

{
    "require-jsdoc": ["error", {
        "require": {
            "FunctionDeclaration": true,
            "MethodDefinition": false,
            "ClassDeclaration": false,
            "ArrowFunctionExpression": false
        }
    }]
}

require

Examples of incorrect code for this rule with the { "require": { "FunctionDeclaration": true, "MethodDefinition": true, "ClassDeclaration": true, "ArrowFunctionExpression": true } } option:

/*eslint "require-jsdoc": ["error", {
    "require": {
        "FunctionDeclaration": true,
        "MethodDefinition": true,
        "ClassDeclaration": true
    }
}]*/

function foo() {
    return 10;
}

var foo = () => {
    return 10;
}

class Test{
    getDate(){}
}

Examples of correct code for this rule with the { "require": { "FunctionDeclaration": true, "MethodDefinition": true, "ClassDeclaration": true, "ArrowFunctionExpression": true } } option:

/*eslint "require-jsdoc": ["error", {
    "require": {
        "FunctionDeclaration": true,
        "MethodDefinition": true,
        "ClassDeclaration": true
    }
}]*/

/**
 * It returns 10
 */
function foo() {
    return 10;
}

/**
 * It returns test + 10
 * @params {int} test - some number
 * @returns {int} sum of test and 10
 */
var foo = (test) => {
    return test + 10;
}

/**
 * It returns 10
 */
var foo = () => {
    return 10;
}

/**
 * It returns 10
 */
var foo = function() {
    return 10;
}

var array = [1,2,3];
array.filter(function(item) {
    return item > 2;
});

/**
 * It returns 10
 */
class Test{
    /**
    * returns the date
    */
    getDate(){}
}

setTimeout(() => {}, 10); // since it's an anonymous arrow function

When Not To Use It

If you do not require JSDoc for your functions, then you can leave this rule off.

Related Rules

There are no issues that match your filters.

Category
Status