Showing 12 of 22 total issues
Function suiteTestSuite
has 148 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
describe('http-test/suite', function suiteTestSuite() {
it('inherits from `Base`', function inheritsFromBaseTest() {
(new Suite()).should.be.an.instanceOf(Base);
});
Function validate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function validate(item) {
var index;
var current;
var thresholds;
var result = {
- Read upRead up
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 baseTestSuite
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
describe('http-test/base', function baseTestSuite() {
describe('#constructor', function constructorTestSuite() {
it('applies `options.req` with the property `req`', function appliesTheReqOptionsTest() {
var base = new Base({ req: { baseUrl: 'http://www.google.com' } });
base.req.baseUrl.should.equal('http://www.google.com');
Function functionalTestSuite
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
describe('functional testing', function functionalTestSuite() {
var baseUrl = 'http://www.http-test.com';
var mock;
beforeEach(function runBeforeEach() {
Function run
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Suite.prototype.run = function run() {
var suite = this;
var offAny = [];
function broadcast(test) {
Function testTestSuite
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
describe('http-test/test', function testTestSuite() {
it('inherits from `Base`', function inheritsFromBaseTest() {
(new Test()).should.be.an.instanceOf(Base);
});
Function validate
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function validate(item) {
var index;
var current;
var thresholds;
var result = {
Function validateTestSuite
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
describe('http-test/util/validate', function validateTestSuite() {
it('marks the test as "invalid" if a error is provided', function provideErrTest() {
var result = validate({ err: new Error() });
result.status.should.equal('invalid');
Function thresholdTestSuite
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
describe('#threshold', function thresholdTestSuite() {
it('requires at least one argument (ms)', function atLeastOneArgumentTest() {
(function shouldThrow() {
var test = new Base();
test.threshold();
Function run
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Test.prototype.run = function run() {
var test = this;
var current = {
spec: merge({}, test.spec || {}, test.suite.spec || {}),
Function addTestSuite
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
describe('#add', function addTestSuite() {
it('accepts a string', function stringTest() {
var suite = new Suite();
suite.add('http://www.google.com');
Function hasListener
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
Suite.prototype.hasListener = function hasListener(name, callback) {
var affected = this._ee._events[name];
var index;
if (!affected) {
- Read upRead up
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"