attester/attester

View on GitHub

Showing 107 of 107 total issues

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

        testObject.$on({
            testLoad: onTestLoad,
            start: onTestStart,
            end: onTestEnd,
            stateChange: onTestStateChange,
Severity: Minor
Found in lib/test-type/aria-templates/client/run.js and 1 other location - About 35 mins to fix
lib/test-type/aria-templates/client/run.js on lines 93..101

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

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

        testObject.$removeListeners({
            testLoad: onTestLoad,
            start: onTestStart,
            end: onTestEnd,
            stateChange: onTestStateChange,
Severity: Minor
Found in lib/test-type/aria-templates/client/run.js and 1 other location - About 35 mins to fix
lib/test-type/aria-templates/client/run.js on lines 80..88

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

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

Function parseCommandLine has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

var parseCommandLine = function () {
    var args = system.args;
    for (var i = 0, l = args.length; i < l; i++) {
        if (args[i] == "--auto-exit") {
            autoExit = true;
Severity: Minor
Found in lib/browsers/phantomjs-control-script.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

Function onLog has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

ConsoleLogger.prototype.onLog = function (evt) {
    var color = LEVEL_COLORS[evt.level - 1];
    var message = evt.message;
    if (color) {
        if (Array.isArray(color)) {
Severity: Minor
Found in lib/logging/console-logger.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

Function staticSender has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

Resources.prototype.staticSender = function () {
    return function (req, res, next) {
        var resolvedPath = req.resolvedPath;
        if (resolvedPath) {
            var error = function error(err) {
Severity: Minor
Found in lib/middlewares/resources.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

Function detectBrowser has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

exports.detectBrowser = function (data) {
    var parser = new UAParser(data.userAgent);
    var browser = parser.getBrowser();
    var browserName = browser.name || "Unknown browser";
    var browserVersion = browser.version;
Severity: Minor
Found in lib/util/browser-detection.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

Function onLauncherConnect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function onLauncherConnect(slaveURL, info) {
    var launcherConfig = attester.config["launcher-config"];
    if (launcherConfig) {
        if (!Array.isArray(launcherConfig)) {
            launcherConfig = [launcherConfig];
Severity: Minor
Found in lib/launchers/attester-launcher.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

Function buildTask has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

var buildTask = function (testType, test, browser) {
    var taskId = this.tasks.length;
    var task = {
        taskId: taskId,
        testType: testType,
Severity: Minor
Found in lib/test-type/all-tests.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

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

    app.use('/__attester__', template.bind({
        data: this,
        page: "/status.html",
        path: path.join(__dirname, "client", "status.html")
    }));
Severity: Minor
Found in lib/test-server/test-server.js and 1 other location - About 35 mins to fix
lib/test-server/test-server.js on lines 247..251

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

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

    app.use('/__attester__', template.bind({
        data: this,
        page: "/slave.html",
        path: path.join(__dirname, "client", "slave.html")
    }));
Severity: Minor
Found in lib/test-server/test-server.js and 1 other location - About 35 mins to fix
lib/test-server/test-server.js on lines 242..246

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

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

            for (var i = connections.length - 1; i >= 0; i--) {
                connections[i].end();
            }
Severity: Minor
Found in lib/test-server/http-server.js and 1 other location - About 30 mins to fix
lib/util/child-processes.js on lines 23..25

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

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

Avoid too many return statements within this function.
Open

        if (!isDotClassDefinition) return;
Severity: Major
Found in lib/test-type/aria-templates/at-file-reader.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            if (!isObjectLitteral) return;
    Severity: Major
    Found in lib/test-type/aria-templates/at-file-reader.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return;
      Severity: Major
      Found in lib/test-type/aria-templates/at-file-reader.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                if (!(ariaRef && /^aria(templates)?\/Aria(\.js)?$/.test(ariaRef))) return;
        Severity: Major
        Found in lib/test-type/aria-templates/at-file-reader.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return true;
          Severity: Major
          Found in lib/test-type/aria-templates/at-file-reader.js - About 30 mins to fix

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

                    for (var i = processes.length - 1; i >= 0; i--) {
                        processes[i].kill();
                    }
            Severity: Minor
            Found in lib/util/child-processes.js and 1 other location - About 30 mins to fix
            lib/test-server/http-server.js on lines 39..41

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

            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

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

            exports.set = function (path, config) {
                config = config || path;
                if (typeof path === "string") {
                    if (!internalConfig[path]) {
                        internalConfig[path] = {};
            Severity: Minor
            Found in lib/attester/config.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

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

            Slave.prototype.onSocketData_pauseChanged = function (message) {
                var paused = message.paused;
                paused = !!paused; // makes sure it is a boolean
                if (this.paused !== paused) {
                    this.paused = paused;
            Severity: Minor
            Found in lib/test-server/slave-server.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

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

                error: function (event) {
                    var name = event.name || "";
                    var method = event.method || "";
                    if (name) {
                        if (method) {
            Severity: Minor
            Found in lib/reports/console-report.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

            Severity
            Category
            Status
            Source
            Language