Showing 15 of 54 total issues
Function loadTestFixtureInstance
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
private loadTestFixtureInstance(
testFixtureConstructor: new () => object,
defaultFixtureDescription: string,
filePath: string
): ITestFixture | null {
Function execute
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public static async execute(fileName: string, fixtureName: string, testName: string, range: Range, execArgv?: string[]) {
if (styles[testName]) {
styles[testName].dispose();
}
- 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 execute
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static async execute(fileName: string, fixtureName: string, testName: string, range: Range, execArgv?: string[]) {
if (styles[testName]) {
styles[testName].dispose();
}
Function runTest
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async runTest(fileName: string, fixtureName: string, testName?: string, execArgv?: string[]) {
const eventData = {
fileName,
fixtureName,
Function subscription
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
const subscription = RunTestCommand.testRunner.subscribe(event => {
if (
event.payload.fileName !== fileName
|| event.payload.fixtureName !== fixtureName
Function results
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const results = await new Promise<ITestCompleteEvent[] | null>((resolve, reject) => {
let results = [] as ITestCompleteEvent[];
runProcess.on("message", message => {
if (message.type === "testComplete") {
Function constructor
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public constructor(testSet: TestSet) {
if (testSet.testFixtures.length === 0) {
return;
}
Function findNearestFile
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export async function findNearestFile(fileName: string, directory?: string) {
if (!fileName) {
throw new TypeError("fileName is required.");
}
- 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 errorMatches
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private errorMatches(
error: Error,
errorType: new (...args: Array<any>) => Error,
errorMessage: string
) {
- 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 checkObjectsAreDeepEqual
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private checkObjectsAreDeepEqual(objectA: any, objectB: any): boolean {
// if one object is an array and the other is not then they are not equal
if (Array.isArray(objectA) !== Array.isArray(objectB)) {
return false;
}
- 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 loadTestSets
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async loadTestSets() {
const configs = await vscode.workspace.findFiles("**/.alsatianrc.json");
if (configs.length === 0) {
Function constructor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public constructor(public readonly type: new (...args: Array<any>) => ExpectedType) {
if (type === null || type === undefined) {
throw new TypeError("type must not be null or undefined");
}
- 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 match
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private match(
countIsNotCorrect: (count: number) => boolean,
callCount: number,
callCountName: string,
callCountType: SpyCallCountType,
- 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
Avoid too many return
statements within this function. Open
return "failure";
Function GetTestCases
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function GetTestCases(
caseArguments:
| (() => IterableIterator<any> | Array<Array<any>>)
| IterableIterator<any>
| Array<Array<any>>
- 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"