MarshallOfSound/Google-Play-Music-Desktop-Player-UNOFFICIAL-

View on GitHub
src/renderer/rendererEmitter.js

Summary

Maintainability
D
1 day
Test Coverage

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

  constructor() {
    let ready = true;
    this.__defineGetter__('ready', () => ready);
    this.__defineSetter__('ready', (newValue) => {
      ready = newValue;
Severity: Minor
Found in src/renderer/rendererEmitter.js - About 1 hr to fix

    '__defineSetter__' is restricted from being used. Please use Object.defineProperty instead.
    Open

        this.__defineSetter__('ready', (newValue) => {
    Severity: Minor
    Found in src/renderer/rendererEmitter.js by eslint

    disallow certain object properties (no-restricted-properties)

    Certain properties on objects may be disallowed in a codebase. This is useful for deprecating an API or restricting usage of a module's methods. For example, you may want to disallow using describe.only when using Mocha or telling people to use Object.assign instead of _.extend.

    Rule Details

    This rule looks for accessing a given property key on a given object name, either when reading the property's value or invoking it as a function. You may specify an optional message to indicate an alternative API or a reason for the restriction.

    Options

    This rule takes a list of objects, where the object name and property names are specified:

    {
        "rules": {
            "no-restricted-properties": [2, {
                "object": "disallowedObjectName",
                "property": "disallowedPropertyName"
            }]
        }
    }

    Multiple object/property values can be disallowed, and you can specify an optional message:

    {
        "rules": {
            "no-restricted-properties": [2, {
                "object": "disallowedObjectName",
                "property": "disallowedPropertyName"
            }, {
                "object": "disallowedObjectName",
                "property": "anotherDisallowedPropertyName",
                "message": "Please use allowedObjectName.allowedPropertyName."
            }]
        }
    }

    If the object name is omitted, the property is disallowed for all objects:

    {
        "rules": {
            "no-restricted-properties": [2, {
                "property": "__defineGetter__",
                "message": "Please use Object.defineProperty instead."
            }]
        }
    }

    If the property name is omitted, accessing any property of the given object is disallowed:

    {
        "rules": {
            "no-restricted-properties": [2, {
                "object": "require",
                "message": "Please call require() directly."
            }]
        }
    }

    Examples of incorrect code for this rule:

    /* eslint no-restricted-properties: [2, {
        "object": "disallowedObjectName",
        "property": "disallowedPropertyName"
    }] */
    
    var example = disallowedObjectName.disallowedPropertyName; /*error Disallowed object property: disallowedObjectName.disallowedPropertyName.*/
    
    disallowedObjectName.disallowedPropertyName(); /*error Disallowed object property: disallowedObjectName.disallowedPropertyName.*/
    /* eslint no-restricted-properties: [2, {
        "property": "__defineGetter__"
    }] */
    
    foo.__defineGetter__(bar, baz);
    /* eslint no-restricted-properties: [2, {
        "object": "require"
    }] */
    
    require.resolve('foo');

    Examples of correct code for this rule:

    /* eslint no-restricted-properties: [2, {
        "object": "disallowedObjectName",
        "property": "disallowedPropertyName"
    }] */
    
    var example = disallowedObjectName.somePropertyName;
    
    allowedObjectName.disallowedPropertyName();
    /* eslint no-restricted-properties: [2, {
        "object": "require"
    }] */
    
    require('foo');

    When Not To Use It

    If you don't have any object/property combinations to restrict, you should not use this rule.

    Related Rules

    Unary operator '++' used.
    Open

                waitForPageLoad++;
    Severity: Minor
    Found in src/renderer/rendererEmitter.js by eslint

    disallow the unary operators ++ and -- (no-plusplus)

    Because the unary ++ and -- operators are subject to automatic semicolon insertion, differences in whitespace can change semantics of source code.

    var i = 10;
    var j = 20;
    
    i ++
    j
    // i = 11, j = 20
    var i = 10;
    var j = 20;
    
    i
    ++
    j
    // i = 10, j = 21

    Rule Details

    This rule disallows the unary operators ++ and --.

    Examples of incorrect code for this rule:

    /*eslint no-plusplus: "error"*/
    
    var foo = 0;
    foo++;
    
    var bar = 42;
    bar--;
    
    for (i = 0; i < l; i++) {
        return;
    }

    Examples of correct code for this rule:

    /*eslint no-plusplus: "error"*/
    
    var foo = 0;
    foo += 1;
    
    var bar = 42;
    bar -= 1;
    
    for (i = 0; i < l; i += 1) {
        return;
    }

    Options

    This rule has an object option.

    • "allowForLoopAfterthoughts": true allows unary operators ++ and -- in the afterthought (final expression) of a for loop.

    allowForLoopAfterthoughts

    Examples of correct code for this rule with the { "allowForLoopAfterthoughts": true } option:

    /*eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }]*/
    
    for (i = 0; i < l; i++) {
        return;
    }
    
    for (i = 0; i < l; i--) {
        return;
    }

    Source: http://eslint.org/docs/rules/

    Expected 'this' to be used by class method '_call'.
    Open

      _call(fn, internalEvent, ...internalDetails) {
    Severity: Minor
    Found in src/renderer/rendererEmitter.js by eslint

    Enforce that class methods utilize this (class-methods-use-this)

    If a class method does not use this, it can safely be made a static function.

    It's possible to have a class method which doesn't use this, such as:

    class A {
        constructor() {
            this.a = "hi";
        }
    
        print() {
            console.log(this.a);
        }
    
        sayHi() {
            console.log("hi");
        }
    }
    
    let a = new A();
    a.sayHi(); // => "hi"

    In the example above, the sayHi method doesn't use this, so we can make it a static method:

    class A {
        constructor() {
            this.a = "hi";
        }
    
        print() {
            console.log(this.a);
        }
    
        static sayHi() {
            console.log("hi");
        }
    }
    
    A.sayHi(); // => "hi"

    Also note in the above examples that the code calling the function on an instance of the class (let a = new A(); a.sayHi();) changes to calling it on the class itself (A.sayHi();).

    Rule Details

    This rule is aimed to flag class methods that do not use this.

    Examples of incorrect code for this rule:

    /*eslint class-methods-use-this: "error"*/
    /*eslint-env es6*/
    
    class A {
        foo() {
            console.log("Hello World");     /*error Expected 'this' to be used by class method 'foo'.*/
        }
    }

    Examples of correct code for this rule:

    /*eslint class-methods-use-this: "error"*/
    /*eslint-env es6*/
    class A {
        foo() {
            this.bar = "Hello World"; // OK, this is used
        }
    }
    
    class A {
        constructor() {
            // OK. constructor is exempt
        }
    }
    
    class A {
        static foo() {
            // OK. static methods aren't expected to use this.
        }
    }

    Options

    Exceptions

    "class-methods-use-this": [<enabled>, { "exceptMethods": [&lt;...exceptions&gt;] }]</enabled>

    The exceptMethods option allows you to pass an array of method names for which you would like to ignore warnings.

    Examples of incorrect code for this rule when used without exceptMethods:

    /*eslint class-methods-use-this: "error"*/
    
    class A {
        foo() {
        }
    }

    Examples of correct code for this rule when used with exceptMethods:

    /*eslint class-methods-use-this: ["error", { "exceptMethods": ["foo"] }] */
    
    class A {
        foo() {
        }
    }

    Source: http://eslint.org/docs/rules/

    '__defineGetter__' is restricted from being used. Please use Object.defineProperty instead.
    Open

        this.__defineGetter__('ready', () => ready);
    Severity: Minor
    Found in src/renderer/rendererEmitter.js by eslint

    disallow certain object properties (no-restricted-properties)

    Certain properties on objects may be disallowed in a codebase. This is useful for deprecating an API or restricting usage of a module's methods. For example, you may want to disallow using describe.only when using Mocha or telling people to use Object.assign instead of _.extend.

    Rule Details

    This rule looks for accessing a given property key on a given object name, either when reading the property's value or invoking it as a function. You may specify an optional message to indicate an alternative API or a reason for the restriction.

    Options

    This rule takes a list of objects, where the object name and property names are specified:

    {
        "rules": {
            "no-restricted-properties": [2, {
                "object": "disallowedObjectName",
                "property": "disallowedPropertyName"
            }]
        }
    }

    Multiple object/property values can be disallowed, and you can specify an optional message:

    {
        "rules": {
            "no-restricted-properties": [2, {
                "object": "disallowedObjectName",
                "property": "disallowedPropertyName"
            }, {
                "object": "disallowedObjectName",
                "property": "anotherDisallowedPropertyName",
                "message": "Please use allowedObjectName.allowedPropertyName."
            }]
        }
    }

    If the object name is omitted, the property is disallowed for all objects:

    {
        "rules": {
            "no-restricted-properties": [2, {
                "property": "__defineGetter__",
                "message": "Please use Object.defineProperty instead."
            }]
        }
    }

    If the property name is omitted, accessing any property of the given object is disallowed:

    {
        "rules": {
            "no-restricted-properties": [2, {
                "object": "require",
                "message": "Please call require() directly."
            }]
        }
    }

    Examples of incorrect code for this rule:

    /* eslint no-restricted-properties: [2, {
        "object": "disallowedObjectName",
        "property": "disallowedPropertyName"
    }] */
    
    var example = disallowedObjectName.disallowedPropertyName; /*error Disallowed object property: disallowedObjectName.disallowedPropertyName.*/
    
    disallowedObjectName.disallowedPropertyName(); /*error Disallowed object property: disallowedObjectName.disallowedPropertyName.*/
    /* eslint no-restricted-properties: [2, {
        "property": "__defineGetter__"
    }] */
    
    foo.__defineGetter__(bar, baz);
    /* eslint no-restricted-properties: [2, {
        "object": "require"
    }] */
    
    require.resolve('foo');

    Examples of correct code for this rule:

    /* eslint no-restricted-properties: [2, {
        "object": "disallowedObjectName",
        "property": "disallowedPropertyName"
    }] */
    
    var example = disallowedObjectName.somePropertyName;
    
    allowedObjectName.disallowedPropertyName();
    /* eslint no-restricted-properties: [2, {
        "object": "require"
    }] */
    
    require('foo');

    When Not To Use It

    If you don't have any object/property combinations to restrict, you should not use this rule.

    Related Rules

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

      fireAtMain(event, ...details) {
        if (this.ready) {
          ipcRenderer.send('passback:main', {
            event,
            details,
    Severity: Major
    Found in src/renderer/rendererEmitter.js and 1 other location - About 2 hrs to fix
    src/renderer/rendererEmitter.js on lines 91..100

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

    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

      fireAtGoogle(event, ...details) {
        if (this.ready) {
          ipcRenderer.send('passback', {
            event,
            details,
    Severity: Major
    Found in src/renderer/rendererEmitter.js and 1 other location - About 2 hrs to fix
    src/renderer/rendererEmitter.js on lines 80..89

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

    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

      fireSync(event, ...details) {
        if (this.ready) {
          ipcRenderer.sendSync(event, ...details);
        } else {
          this.q.push(this.fireSync.bind(this, event, ...details));
    Severity: Major
    Found in src/renderer/rendererEmitter.js and 1 other location - About 1 hr to fix
    src/renderer/rendererEmitter.js on lines 52..58

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

    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

        ipcRenderer.once(event, (internalEvent, ...internalDetails) => {
          if (this.ready) {
            this._call(fn, internalEvent, ...internalDetails);
          } else {
            this.q.push(this._call.bind(this, fn, internalEvent, ...internalDetails));
    Severity: Major
    Found in src/renderer/rendererEmitter.js and 1 other location - About 1 hr to fix
    src/renderer/rendererEmitter.js on lines 103..109

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

    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

        const internalMethod = (internalEvent, ...internalDetails) => {
          if (this.ready) {
            this._call(fn, internalEvent, ...internalDetails);
          } else {
            this.q.push(this._call.bind(this, fn, internalEvent, ...internalDetails));
    Severity: Major
    Found in src/renderer/rendererEmitter.js and 1 other location - About 1 hr to fix
    src/renderer/rendererEmitter.js on lines 116..122

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

    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

      fire(event, ...details) {
        if (this.ready) {
          ipcRenderer.send(event, ...details);
        } else {
          this.q.push(this.fire.bind(this, event, ...details));
    Severity: Major
    Found in src/renderer/rendererEmitter.js and 1 other location - About 1 hr to fix
    src/renderer/rendererEmitter.js on lines 60..66

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

    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

    There are no issues that match your filters.

    Category
    Status