attester/attester

View on GitHub

Showing 107 of 107 total issues

Function readATClasspath has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

ATEnvironment.prototype.readATClasspath = function (classpath, callback) {
    var classpathInfo = this._classpaths[classpath];
    var self = this;
    var filePath = null;
    if (!classpathInfo) {
Severity: Minor
Found in lib/test-type/aria-templates/at-environment.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 AriaTemplatesTests has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var AriaTemplatesTests = function (campaign, inputConfig) {
        // Default values for the config:
        var testConfig = {
            rootFolderPath: '/',
            bootstrap: null,
Severity: Minor
Found in lib/test-type/aria-templates/at-test-type.js - About 1 hr to fix

    Function TestServer has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var TestServer = function (config, logger) {
        this.logger = new Logger("TestServer", logger);
        this.config = config;
        var app = connect();
        app.use(compression());
    Severity: Minor
    Found in lib/test-server/test-server.js - About 1 hr to fix

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

      SlaveController.prototype.onSlaveIdle = function (slaveInfo) {
          if (this.socket) {
              this.socket.write(JSON.stringify({
                  type: "slaveIdle",
                  slaveId: slaveInfo.slaveId
      Severity: Major
      Found in lib/test-server/slave-controller.js and 1 other location - About 1 hr to fix
      lib/test-server/slave-controller.js on lines 141..148

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

      SlaveController.prototype.onSlaveBusy = function (slaveInfo) {
          if (this.socket) {
              this.socket.write(JSON.stringify({
                  type: "slaveBusy",
                  slaveId: slaveInfo.slaveId
      Severity: Major
      Found in lib/test-server/slave-controller.js and 1 other location - About 1 hr to fix
      lib/test-server/slave-controller.js on lines 132..139

      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

      Function iterate has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      FileSet.prototype.iterate = function (entryCallback, endCallback) {
          var self = this;
          var root = this._root || "";
          var waitingCallbacks = 0;
          var decreaseCallbacks = function () {
      Severity: Minor
      Found in lib/util/files/fileset.js - About 1 hr to fix

        Function cleanTaskEnd has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function cleanTaskEnd() {
                try {
                    mainTestObject.$dispose();
                    mainTestObject = null;
                } catch (e) {
        Severity: Minor
        Found in lib/test-type/aria-templates/client/run.js - About 1 hr to fix

          Function merge has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          var merge = function (destination, source, exclude) {
              if (!source) {
                  return;
              }
              if (!exclude) {
          Severity: Minor
          Found in lib/util/merge.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 addToFlatReport has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          function addToFlatReport(task) {
              var subTests = task.subTests;
              /*if (task.errors) {
                      // don't loose those errors
                  }*/
          Severity: Minor
          Found in lib/reports/json-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 buildTasksForTest has 39 lines of code (exceeds 25 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

            Function createPhantomExitCb has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                createPhantomExitCb: function (cfg, state, n) {
                    // Node 0.8 and 0.10 differently handle spawning errors ('exit' vs 'error'), but errors that happened after
                    // launching the command are both handled in 'exit' callback
                    return function (code, signal) {
                        // See http://tldp.org/LDP/abs/html/exitcodes.html and http://stackoverflow.com/a/1535733/
            Severity: Minor
            Found in lib/launchers/phantom-launcher.js - About 1 hr to fix

              Function reportsList has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      reportsList: function (callback) {
                          var possibleReports = listsPossibleReports();
                          var now = new Date();
                          var waitingCb = 1;
                          var callCallback = function () {
              Severity: Minor
              Found in lib/test-server/coverage-display.js - About 1 hr to fix

                Function assignTask has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Slave.prototype.assignTask = function (campaign, task) {
                    var taskExecutionId = this.taskExecutionId = ++taskExecutionCount;
                    this.currentTask = task;
                    this.currentCampaign = campaign;
                    this.currentTaskRestartPlanned = false;
                Severity: Minor
                Found in lib/test-server/slave-server.js - About 1 hr to fix

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

                  module.exports = function (grunt) {
                      grunt.initConfig({
                          jshint: {
                              lib: ['package.json', 'gruntfile.js', 'lib/**/*.js', '!lib/**/html5shiv.js'],
                              options: grunt.file.readJSON('.jshintrc'),
                  Severity: Minor
                  Found in Gruntfile.js - About 1 hr to fix

                    Function TestCampaign has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                    var TestCampaign = function (config, parentLogger) {
                        this.results = config.liveResults ? [] : null;
                        this.startTime = new Date();
                        this.campaignNumber = config.campaignNumber;
                        this.id = createCampaignId(this.startTime);
                    Severity: Minor
                    Found in lib/test-campaign/test-campaign.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 instrument has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    Coverage.prototype.instrument = function (absoluteFileName, displayFileName, callback) {
                        var self = this;
                        var cacheEntry = this._cache[displayFileName];
                        if (cacheEntry) {
                            if (cacheEntry.callbacks) {
                    Severity: Minor
                    Found in lib/test-campaign/coverage.js - About 1 hr to fix

                      Function readATOldFileContent has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function readATOldFileContent(res, fileContent, fileName) {
                          var classDef = null;
                          var classDefinitionCalls = 0;
                          var sandbox = {
                              aria: {
                      Severity: Minor
                      Found in lib/test-type/aria-templates/at-file-reader.js - About 1 hr to fix

                        Function readATFile has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        ATEnvironment.prototype.readATFile = function (file, callback) {
                            file = path.normalize(file);
                            var fileInfo = this._files[file];
                            if (!fileInfo) {
                                var waitingCallbacks = [callback];
                        Severity: Minor
                        Found in lib/test-type/aria-templates/at-environment.js - About 1 hr to fix

                          Function init has 35 lines of code (exceeds 25 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

                            Function onInitialized has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            page.onInitialized = function (arg1) {
                                page.evaluate(function () {
                                    window.attesterConfig = {
                                        onDisconnect: function () {
                                            window.callPhantom({
                            Severity: Minor
                            Found in lib/browsers/phantomjs-control-script.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language