attester/attester

View on GitHub

Showing 107 of 107 total issues

Function getReportContent has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

function getReportContent(jsonReport, fixedLevels) {
    var res = ['<?xml version="1.0" encoding="UTF-8" ?>\n'];

    function processError(error) {
        var tagName = error.failure ? "failure" : "error";
Severity: Minor
Found in lib/reports/xml-report.js - About 5 hrs 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

File test-server.js has 382 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright 2012 Amadeus s.a.s.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
Severity: Minor
Found in lib/test-server/test-server.js - About 5 hrs to fix

    Function writeReports has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

    var writeReports = function (config, results, callback) {
        var mkdirsCache = {};
        var expectedCallbacks = 1;
        var errors = null;
        var decreaseCallbacks = function (err) {
    Severity: Minor
    Found in lib/reports/write-reports.js - About 4 hrs 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

    File slave-client.js has 342 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* global SockJS */
    /*
     * Copyright 2012 Amadeus s.a.s.
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
    Severity: Minor
    Found in lib/test-server/client/slave-client.js - About 4 hrs to fix

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

      module.exports = function (attester) {
          var BaseTestType = attester.classes.BaseTestType;
          var FileSet = attester.classes.FileSet;
          var BrowserExcludesFileSet = attester.classes.BrowserExcludesFileSet;
      
      
      Severity: Major
      Found in lib/test-type/mocha/mocha-test-type.js - About 4 hrs to fix

        Function writeReports has 94 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var writeReports = function (config, results, callback) {
            var mkdirsCache = {};
            var expectedCallbacks = 1;
            var errors = null;
            var decreaseCallbacks = function (err) {
        Severity: Major
        Found in lib/reports/write-reports.js - About 3 hrs to fix

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

          module.exports = function (attesterServer, serverRoot) {
              var listsPossibleReports = function () {
                  var list = [];
                  attesterServer.campaigns.forEach(function (campaign) {
                      var result = campaign.getCoverageResult();
          Severity: Major
          Found in lib/test-server/coverage-display.js - About 3 hrs to fix

            Function iterate has a Cognitive Complexity of 25 (exceeds 5 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 3 hrs 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 exports has 86 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function (attester) {
                var BaseTestType = attester.classes.BaseTestType;
                var TestsEnumerator = require('./at-tests-enumerator.js');
            
                var url = attester.utils.url;
            Severity: Major
            Found in lib/test-type/aria-templates/at-test-type.js - About 3 hrs to fix

              Function readATNewFileContent has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

              function readATNewFileContent(res, fileContent, fileName) {
                  var foundClassDef = null;
                  var walker = new UglifyJS.TreeWalker(function (node) {
                      var isAssignment = node instanceof UglifyJS.AST_Assign && node.operator == "=";
                      if (!isAssignment) return;
              Severity: Minor
              Found in lib/test-type/aria-templates/at-file-reader.js - About 2 hrs 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

              File slave-server.js has 281 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /*
               * Copyright 2012 Amadeus s.a.s.
               * Licensed under the Apache License, Version 2.0 (the "License");
               * you may not use this file except in compliance with the License.
               * You may obtain a copy of the License at
              Severity: Minor
              Found in lib/test-server/slave-server.js - About 2 hrs to fix

                Function readATNewFileContent has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function readATNewFileContent(res, fileContent, fileName) {
                    var foundClassDef = null;
                    var walker = new UglifyJS.TreeWalker(function (node) {
                        var isAssignment = node instanceof UglifyJS.AST_Assign && node.operator == "=";
                        if (!isAssignment) return;
                Severity: Major
                Found in lib/test-type/aria-templates/at-file-reader.js - About 2 hrs to fix

                  Function getReportContent has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function getReportContent(jsonReport, fixedLevels) {
                      var res = ['<?xml version="1.0" encoding="UTF-8" ?>\n'];
                  
                      function processError(error) {
                          var tagName = error.failure ? "failure" : "error";
                  Severity: Major
                  Found in lib/reports/xml-report.js - About 2 hrs to fix

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

                            } else if (/chai(\.js)?/.test(assertion)) {
                                assertionDescription.src = this.getBaseURL() + "/assertion/chai.js";
                                this.use(staticFile.bind({
                                    page: "/assertion/chai.js",
                                    path: path.join(path.dirname(require.resolve("chai")), "chai.js")
                    Severity: Major
                    Found in lib/test-type/mocha/mocha-test-type.js and 1 other location - About 2 hrs to fix
                    lib/test-type/mocha/mocha-test-type.js on lines 99..114

                    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

                            if (/^expect([\.\-]?js)?$/.test(assertion)) {
                                assertionDescription.src = this.getBaseURL() + "/assertion/expect.js";
                                this.use(staticFile.bind({
                                    page: "/assertion/expect.js",
                                    path: path.join(path.dirname(require.resolve("expect.js")), "index.js")
                    Severity: Major
                    Found in lib/test-type/mocha/mocha-test-type.js and 1 other location - About 2 hrs to fix
                    lib/test-type/mocha/mocha-test-type.js on lines 105..114

                    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

                    Function createPhantomExitCb has a Cognitive Complexity of 17 (exceeds 5 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 2 hrs 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 taskFinished has a Cognitive Complexity of 17 (exceeds 5 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 2 hrs 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 readATClasspath has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    ATEnvironment.prototype.readATClasspath = function (classpath, callback) {
                        var classpathInfo = this._classpaths[classpath];
                        var self = this;
                        var filePath = null;
                        if (!classpathInfo) {
                    Severity: Major
                    Found in lib/test-type/aria-templates/at-environment.js - About 2 hrs to fix

                      Function MochaTestType has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          var MochaTestType = function (campaign, inputConfig) {
                              // Default values for the configuration object
                              var testConfig = {
                                  files: {
                                      rootDirectory: process.cwd(),
                      Severity: Major
                      Found in lib/test-type/mocha/mocha-test-type.js - About 2 hrs to fix

                        Function TestCampaign has 50 lines of code (exceeds 25 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 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language