jbenden/node-pmset

View on GitHub

Showing 20 of 20 total issues

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

    it("noDisplaySleep should return an integer value greater than 0.", function (done) {
        id = pmset.noDisplaySleep("Testing Node.js");
        ok(id > 0);
        var found = false;
        exec('pmset -g assertions', function (error, stdout, stderr) {
Severity: Major
Found in pmset_test.js and 5 other locations - About 4 hrs to fix
pmset_test.js on lines 24..37
pmset_test.js on lines 38..51
pmset_test.js on lines 52..65
pmset_test.js on lines 66..79
pmset_test.js on lines 80..93

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

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 6 locations. Consider refactoring.
Open

    it("noSystemSleep should return an integer value greater than 0.", function (done) {
        id = pmset.noSystemSleep("Testing Node.js");
        ok(id > 0);
        var found = false;
        exec('pmset -g assertions', function (error, stdout, stderr) {
Severity: Major
Found in pmset_test.js and 5 other locations - About 4 hrs to fix
pmset_test.js on lines 10..23
pmset_test.js on lines 24..37
pmset_test.js on lines 52..65
pmset_test.js on lines 66..79
pmset_test.js on lines 80..93

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

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 6 locations. Consider refactoring.
Open

    it("noUserIdleDisplaySleep should return an integer value greater than 0.", function (done) {
        id = pmset.noUserIdleDisplaySleep("Testing Node.js");
        ok(id > 0);
        var found = false;
        exec('pmset -g assertions', function (error, stdout, stderr) {
Severity: Major
Found in pmset_test.js and 5 other locations - About 4 hrs to fix
pmset_test.js on lines 10..23
pmset_test.js on lines 24..37
pmset_test.js on lines 38..51
pmset_test.js on lines 52..65
pmset_test.js on lines 80..93

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

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 6 locations. Consider refactoring.
Open

    it("noUserIdleSystemSleep should return an integer value greater than 0.", function (done) {
        id = pmset.noUserIdleSystemSleep("Testing Node.js");
        ok(id > 0);
        var found = false;
        exec('pmset -g assertions', function (error, stdout, stderr) {
Severity: Major
Found in pmset_test.js and 5 other locations - About 4 hrs to fix
pmset_test.js on lines 10..23
pmset_test.js on lines 24..37
pmset_test.js on lines 38..51
pmset_test.js on lines 66..79
pmset_test.js on lines 80..93

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

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 6 locations. Consider refactoring.
Open

    it("noDiskIdle should return an integer value greater than 0.", function (done) {
        id = pmset.noDiskIdle("Testing Node.js");
        ok(id > 0);
        var found = false;
        exec('pmset -g assertions', function (error, stdout, stderr) {
Severity: Major
Found in pmset_test.js and 5 other locations - About 4 hrs to fix
pmset_test.js on lines 10..23
pmset_test.js on lines 24..37
pmset_test.js on lines 38..51
pmset_test.js on lines 52..65
pmset_test.js on lines 66..79

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

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 6 locations. Consider refactoring.
Open

    it("noIdleSleep should return an integer value greater than 0.", function (done) {
        id = pmset.noIdleSleep("Testing Node.js");
        ok(id > 0);
        var found = false;
        exec('pmset -g assertions', function (error, stdout, stderr) {
Severity: Major
Found in pmset_test.js and 5 other locations - About 4 hrs to fix
pmset_test.js on lines 10..23
pmset_test.js on lines 38..51
pmset_test.js on lines 52..65
pmset_test.js on lines 66..79
pmset_test.js on lines 80..93

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

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

File pmset_test.js has 252 lines of code (exceeds 250 allowed). Consider refactoring.
Open

process.env.NODE_ENV = "test";
var pmset = require('./pmset');
var exec = require('child_process').exec;

function ok(expr, msg) {
Severity: Minor
Found in pmset_test.js - About 2 hrs to fix

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

        it("fails with a number passed to noUserIdleDisplaySleep.", function(done) {
            var isOk = 0;
            try{
                pmset.noUserIdleDisplaySleep(123);
            } catch (ex) {
    Severity: Major
    Found in pmset_test.js and 5 other locations - About 1 hr to fix
    pmset_test.js on lines 104..113
    pmset_test.js on lines 124..133
    pmset_test.js on lines 144..153
    pmset_test.js on lines 184..193
    pmset_test.js on lines 224..233

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

    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 6 locations. Consider refactoring.
    Open

        it("fails with a number passed to noSystemSleep.", function(done) {
            var isOk = 0;
            try{
                pmset.noSystemSleep(123);
            } catch (ex) {
    Severity: Major
    Found in pmset_test.js and 5 other locations - About 1 hr to fix
    pmset_test.js on lines 124..133
    pmset_test.js on lines 144..153
    pmset_test.js on lines 184..193
    pmset_test.js on lines 204..213
    pmset_test.js on lines 224..233

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

    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 6 locations. Consider refactoring.
    Open

        it("fails with a number passed to noIdleSleep.", function(done) {
            var isOk = 0;
            try{
                pmset.noIdleSleep(123);
            } catch (ex) {
    Severity: Major
    Found in pmset_test.js and 5 other locations - About 1 hr to fix
    pmset_test.js on lines 104..113
    pmset_test.js on lines 144..153
    pmset_test.js on lines 184..193
    pmset_test.js on lines 204..213
    pmset_test.js on lines 224..233

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

    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 6 locations. Consider refactoring.
    Open

        it("fails with a number passed to noUserIdleSystemSleep.", function(done) {
            var isOk = 0;
            try{
                pmset.noUserIdleSystemSleep(123);
            } catch (ex) {
    Severity: Major
    Found in pmset_test.js and 5 other locations - About 1 hr to fix
    pmset_test.js on lines 104..113
    pmset_test.js on lines 124..133
    pmset_test.js on lines 144..153
    pmset_test.js on lines 204..213
    pmset_test.js on lines 224..233

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

    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 6 locations. Consider refactoring.
    Open

        it("fails with a number passed to noDisplaySleep.", function(done) {
            var isOk = 0;
            try{
                pmset.noDisplaySleep(123);
            } catch (ex) {
    Severity: Major
    Found in pmset_test.js and 5 other locations - About 1 hr to fix
    pmset_test.js on lines 104..113
    pmset_test.js on lines 124..133
    pmset_test.js on lines 184..193
    pmset_test.js on lines 204..213
    pmset_test.js on lines 224..233

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

    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 6 locations. Consider refactoring.
    Open

        it("fails with a number passed to noDiskIdle.", function(done) {
            var isOk = 0;
            try{
                pmset.noDiskIdle(123);
            } catch (ex) {
    Severity: Major
    Found in pmset_test.js and 5 other locations - About 1 hr to fix
    pmset_test.js on lines 104..113
    pmset_test.js on lines 124..133
    pmset_test.js on lines 144..153
    pmset_test.js on lines 184..193
    pmset_test.js on lines 204..213

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

    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 7 locations. Consider refactoring.
    Open

        it("fails with nothing passed to noUserIdleDisplaySleep.", function(done) {
            var isOk = 0;
            try{
                pmset.noUserIdleDisplaySleep();
            } catch (ex) {
    Severity: Major
    Found in pmset_test.js and 6 other locations - About 1 hr to fix
    pmset_test.js on lines 94..103
    pmset_test.js on lines 114..123
    pmset_test.js on lines 134..143
    pmset_test.js on lines 174..183
    pmset_test.js on lines 214..223
    pmset_test.js on lines 244..253

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

    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 7 locations. Consider refactoring.
    Open

        it("fails with nothing passed to noIdleSleep.", function(done) {
            var isOk = 0;
            try{
                pmset.noIdleSleep();
            } catch (ex) {
    Severity: Major
    Found in pmset_test.js and 6 other locations - About 1 hr to fix
    pmset_test.js on lines 94..103
    pmset_test.js on lines 134..143
    pmset_test.js on lines 174..183
    pmset_test.js on lines 194..203
    pmset_test.js on lines 214..223
    pmset_test.js on lines 244..253

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

    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 7 locations. Consider refactoring.
    Open

        it("fails with nothing passed to noSystemSleep.", function(done) {
            var isOk = 0;
            try{
                pmset.noSystemSleep();
            } catch (ex) {
    Severity: Major
    Found in pmset_test.js and 6 other locations - About 1 hr to fix
    pmset_test.js on lines 114..123
    pmset_test.js on lines 134..143
    pmset_test.js on lines 174..183
    pmset_test.js on lines 194..203
    pmset_test.js on lines 214..223
    pmset_test.js on lines 244..253

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

    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 7 locations. Consider refactoring.
    Open

        it("fails with nothing passed to noDisplaySleep.", function(done) {
            var isOk = 0;
            try{
                pmset.noDisplaySleep();
            } catch (ex) {
    Severity: Major
    Found in pmset_test.js and 6 other locations - About 1 hr to fix
    pmset_test.js on lines 94..103
    pmset_test.js on lines 114..123
    pmset_test.js on lines 174..183
    pmset_test.js on lines 194..203
    pmset_test.js on lines 214..223
    pmset_test.js on lines 244..253

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

    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 7 locations. Consider refactoring.
    Open

        it("fails with no release value.", function (done) {
            var isOk = 0;
            try {
                pmset.release();
            } catch (ex) {
    Severity: Major
    Found in pmset_test.js and 6 other locations - About 1 hr to fix
    pmset_test.js on lines 94..103
    pmset_test.js on lines 114..123
    pmset_test.js on lines 134..143
    pmset_test.js on lines 174..183
    pmset_test.js on lines 194..203
    pmset_test.js on lines 214..223

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

    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 7 locations. Consider refactoring.
    Open

        it("fails with nothing passed to noUserIdleSystemSleep.", function(done) {
            var isOk = 0;
            try{
                pmset.noUserIdleSystemSleep();
            } catch (ex) {
    Severity: Major
    Found in pmset_test.js and 6 other locations - About 1 hr to fix
    pmset_test.js on lines 94..103
    pmset_test.js on lines 114..123
    pmset_test.js on lines 134..143
    pmset_test.js on lines 194..203
    pmset_test.js on lines 214..223
    pmset_test.js on lines 244..253

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

    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 7 locations. Consider refactoring.
    Open

        it("fails with nothing passed to noDiskIdle.", function(done) {
            var isOk = 0;
            try{
                pmset.noDiskIdle();
            } catch (ex) {
    Severity: Major
    Found in pmset_test.js and 6 other locations - About 1 hr to fix
    pmset_test.js on lines 94..103
    pmset_test.js on lines 114..123
    pmset_test.js on lines 134..143
    pmset_test.js on lines 174..183
    pmset_test.js on lines 194..203
    pmset_test.js on lines 244..253

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

    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

    Severity
    Category
    Status
    Source
    Language