Skip to content

Commit f89b4f7

Browse files
authored
Merge pull request #173 from kodustech/fix/directory-kody-rules
Fixing get kody rules
2 parents 2161e9e + f5e8203 commit f89b4f7

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/ee/codeBase/codeBaseConfig.service.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,7 @@ export default class CodeBaseConfigService implements ICodeBaseConfigService {
10331033
kodyRulesForDirectory,
10341034
reviewModeConfig,
10351035
kodyFineTuningConfig,
1036+
kodyRulesEntity,
10361037
] = await Promise.all([
10371038
this.parametersService.findByKey(
10381039
ParametersKey.LANGUAGE_CONFIG,
@@ -1046,10 +1047,21 @@ export default class CodeBaseConfigService implements ICodeBaseConfigService {
10461047
),
10471048
this.getReviewModeConfigParameter(organizationAndTeamData),
10481049
this.getKodyFineTuningConfigParameter(organizationAndTeamData),
1050+
this.kodyRulesService.findByOrganizationId(
1051+
organizationAndTeamData.organizationId,
1052+
),
10491053
]);
10501054

1051-
// As rules já vêm filtradas para o diretório específico
1052-
const kodyRules = kodyRulesForDirectory;
1055+
const repositoryKodyRules =
1056+
this.kodyRulesValidationService.filterKodyRules(
1057+
kodyRulesEntity?.toObject()?.rules,
1058+
repository.id,
1059+
).filter((rule) => rule?.directoryId !== directoryConfig.id);
1060+
1061+
const kodyRules = [
1062+
...repositoryKodyRules,
1063+
...kodyRulesForDirectory,
1064+
];
10531065

10541066
const config: CodeReviewConfig = {
10551067
ignorePaths: directoryConfig.ignorePaths || [],

0 commit comments

Comments
 (0)