attester/attester

View on GitHub

Showing 107 of 107 total issues

Function sendTestUpdate has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var sendTestUpdate = function (scope, name, info) {
        if (!checkTaskExecutionId(scope, name)) {
            return false;
        }
        if (!info) {
Severity: Minor
Found in lib/test-server/client/slave-client.js - About 1 hr to fix

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

    ConsoleReport.prototype.addResult = function (event) {
        var eventName = event.event;
        var eventHandler = eventTypes[eventName];
        if (eventHandler) {
            eventHandler.call(this, event);
    Severity: Major
    Found in lib/reports/console-report.js and 1 other location - About 1 hr to fix
    lib/reports/json-report.js on lines 288..294

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

    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

    JsonReport.prototype.addResult = function (event) {
        var eventName = event.event;
        var eventHandler = eventTypes[eventName];
        if (eventHandler) {
            eventHandler.call(this, event);
    Severity: Major
    Found in lib/reports/json-report.js and 1 other location - About 1 hr to fix
    lib/reports/console-report.js on lines 100..106

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

    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 processFile has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var processFile = function processFile(out, fileName, fileInfos) {
        fileName = fileName.replace(/\\/g, '/'); // use only forward slashes
        out.push('SF:' + fileName);
        var statements = fileInfos.code.src;
        var execCount;
    Severity: Minor
    Found in lib/reports/lcov-report.js - About 1 hr to fix

      Function buildTask has 33 lines of code (exceeds 25 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 1 hr to fix

        Function exports has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function (ipv4Only) {
            var categories = {
                IPv4: [],
                internalIPv4: [],
                IPv6: [],
        Severity: Minor
        Found in lib/util/detectHostname.js - About 1 hr to fix

          Function taskFinished has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              taskFinished: function (event) {
                  var taskId = event.taskId;
          
                  var task = this.campaign.jsonReport.tasks[taskId];
                  var taskName = task.name;
          Severity: Minor
          Found in lib/reports/console-report.js - About 1 hr to fix

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

            function tag(name, defaults, description, scope, attributesGenerator) {
                var config = defaults || {};
                var data = scope || {};
                merge(config, description);
            
            
            Severity: Minor
            Found in lib/util/page-generator.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

            var buildTasksForTest = function (testType, test) {
                var subTests = test.subTests;
                var testResults = test.results;
                if (!subTests && !test.url && !testResults) {
                    // something is wrong with this test!!
            Severity: Minor
            Found in lib/test-type/all-tests.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function resolvePath has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Resources.prototype.resolvePath = function (path, callback) {
                var rootsArray = this._rootsArray;
                var checkFileExistence = function (pathInContext, currentIndex) {
                    var entry = rootsArray[currentIndex];
                    var absolutePath = pathUtils.join(entry.root, pathInContext);
            Severity: Minor
            Found in lib/middlewares/resources.js - About 1 hr to fix

              Function optimizeNumberOfParallelInstances has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var optimizeNumberOfParallelInstances = function (cfg, logger) {
                  if (cfg.maxInstances === 0) { // explicitly asking for no PhantomJS
                      logger.logInfo("No PhantomJS instances launched.");
                      return 0;
                  }
              Severity: Minor
              Found in lib/util/optimize-parallel.js - About 1 hr to fix

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

                exports.create = function (callback) {
                    testServer = new TestServer({
                        predictableUrls: config["predictable-urls"],
                        shutdownOnCampaignEnd: config["shutdown-on-campaign-end"],
                        frozen: config["server-only"],
                Severity: Minor
                Found in lib/attester/server.js - About 1 hr to fix

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

                  var routeCoverage = function (req, res, next) {
                      var testServer = this;
                      var match = /\/([0-9]+)\/([0-9]+)/.exec(req.path);
                      var campaignId;
                      var taskId;
                  Severity: Minor
                  Found in lib/test-server/test-server.js - About 1 hr to fix

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

                    TestEnumerator.prototype._addResult = function (testInfo, res) {
                        var classpath = testInfo.name;
                        var testSuite = res.testSuite;
                        var error = res.error;
                        if (error) {
                    Severity: Minor
                    Found in lib/test-type/aria-templates/at-tests-enumerator.js - About 1 hr to fix

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

                      module.exports = function (req, res, next) {
                          var model = this.data;
                          var page = this.page;
                          if (page.charAt(0) !== "/") {
                              page = "/" + page;
                      Severity: Minor
                      Found in lib/middlewares/template.js - About 1 hr to fix

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

                            var walker = new UglifyJS.TreeWalker(function (node) {
                                var isAssignment = node instanceof UglifyJS.AST_Assign && node.operator == "=";
                                if (!isAssignment) return;
                                var moduleExports = node.left;
                                var isDotExports = moduleExports instanceof UglifyJS.AST_Dot && moduleExports.property == "exports";
                        Severity: Minor
                        Found in lib/test-type/aria-templates/at-file-reader.js - About 1 hr to fix

                          Function processFile has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                          var processFile = function processFile(out, fileName, fileInfos) {
                              fileName = fileName.replace(/\\/g, '/'); // use only forward slashes
                              out.push('SF:' + fileName);
                              var statements = fileInfos.code.src;
                              var execCount;
                          Severity: Minor
                          Found in lib/reports/lcov-report.js - About 1 hr to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function init has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                          AllTests.prototype.init = function (callback) {
                              var expectedCallbacks = 1;
                              var testTypes = this.testTypes;
                              var decrementExpectedCallbacks = function () {
                                  expectedCallbacks--;
                          Severity: Minor
                          Found in lib/test-type/all-tests.js - About 1 hr to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function require has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                          exports.require = function (name, config) {
                              // Do it here so that it's available for the plugin even before it gets called
                              var pluginConfig = exports.config(name, config);
                          
                              var pending = function () {
                          Severity: Minor
                          Found in lib/attester/plugins.js - About 1 hr to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function readRequire has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function readRequire(expression) {
                              if (expression instanceof UglifyJS.AST_Call && expression.args.length == 1) {
                                  var requireVar = expression.expression;
                                  if (requireVar instanceof UglifyJS.AST_SymbolRef && requireVar.name == "require" && requireVar.thedef.undeclared) {
                                      var param = expression.args[0];
                          Severity: Minor
                          Found in lib/test-type/aria-templates/at-file-reader.js - About 1 hr to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Severity
                          Category
                          Status
                          Source
                          Language