From 3ffc96b304ef41d02c02660185694e585e738f98 Mon Sep 17 00:00:00 2001 From: Adela Homolova Date: Mon, 9 Sep 2019 15:22:22 +0200 Subject: [PATCH 1/3] fix: add new practicesWitchContext for every component in for loop. --- src/scanner/Scanner.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/scanner/Scanner.ts b/src/scanner/Scanner.ts index 3e5821453..4449d9bb2 100644 --- a/src/scanner/Scanner.ts +++ b/src/scanner/Scanner.ts @@ -25,6 +25,7 @@ import { ScannerUtils } from './ScannerUtils'; import { ArgumentsProvider } from '../inversify.config'; import { IPracticeWithMetadata } from '../practices/DxPracticeDecorator'; import filterAsync from 'node-filter-async'; +import util from 'util'; @injectable() export class Scanner { @@ -135,7 +136,9 @@ export class Scanner { private async detectPractices(componentsWithContext: ProjectComponentAndLangContext[]): Promise { const practicesWithContext: PracticeWithContext[] = []; + for (const componentWithCtx of componentsWithContext) { + const practicesWithContextFroComponent: PracticeWithContext[] = []; const componentContext = componentWithCtx.languageContext.getProjectComponentContext(componentWithCtx.component); const practiceContext = componentContext.getPracticeContext(); @@ -145,7 +148,8 @@ export class Scanner { const orderedApplicablePractices = ScannerUtils.sortPractices(applicablePractices); for (const practice of orderedApplicablePractices) { - const isFulfilled = ScannerUtils.isFulfilled(practice, practicesWithContext); + const isFulfilled = ScannerUtils.isFulfilled(practice, practicesWithContextFroComponent); + if (!isFulfilled) continue; const evaluation = await practice.evaluate(practiceContext); From 7d546fdd04bfd1140ec4245650b518c428acbfaa Mon Sep 17 00:00:00 2001 From: Prokop Simek Date: Thu, 12 Sep 2019 16:27:35 +0200 Subject: [PATCH 2/3] Update src/scanner/Scanner.ts --- src/scanner/Scanner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scanner/Scanner.ts b/src/scanner/Scanner.ts index 4449d9bb2..5ab772f30 100644 --- a/src/scanner/Scanner.ts +++ b/src/scanner/Scanner.ts @@ -138,7 +138,7 @@ export class Scanner { const practicesWithContext: PracticeWithContext[] = []; for (const componentWithCtx of componentsWithContext) { - const practicesWithContextFroComponent: PracticeWithContext[] = []; + const practicesWithContextFromComponent: PracticeWithContext[] = []; const componentContext = componentWithCtx.languageContext.getProjectComponentContext(componentWithCtx.component); const practiceContext = componentContext.getPracticeContext(); From 5caa76f22a9660c5313c2c164eaadaf12a442ea9 Mon Sep 17 00:00:00 2001 From: Prokop Simek Date: Thu, 12 Sep 2019 16:27:42 +0200 Subject: [PATCH 3/3] Update src/scanner/Scanner.ts --- src/scanner/Scanner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scanner/Scanner.ts b/src/scanner/Scanner.ts index 5ab772f30..2fcaaf02c 100644 --- a/src/scanner/Scanner.ts +++ b/src/scanner/Scanner.ts @@ -148,7 +148,7 @@ export class Scanner { const orderedApplicablePractices = ScannerUtils.sortPractices(applicablePractices); for (const practice of orderedApplicablePractices) { - const isFulfilled = ScannerUtils.isFulfilled(practice, practicesWithContextFroComponent); + const isFulfilled = ScannerUtils.isFulfilled(practice, practicesWithContextFromComponent); if (!isFulfilled) continue;