-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WiP. исправил FP в RefOveruse при использовании в запросе таблиц, которые являются ТЧ #1859
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,12 +124,22 @@ private void checkColumnNode(SDBLParser.ColumnContext ctx, Set<String> tableName | |
String penultimateIdentifierName = penultimateChild.getText(); | ||
|
||
if (REF_PATTERN.matcher(penultimateIdentifierName).matches() | ||
&& !penultimateIdentifierParentIsTabularSection(ctx) | ||
|| (REF_PATTERN.matcher(lastIdentifierName).matches() | ||
&& !tableNames.contains(penultimateIdentifierName))) { | ||
diagnosticStorage.addDiagnostic(ctx); | ||
} | ||
} | ||
|
||
private boolean penultimateIdentifierParentIsTabularSection(SDBLParser.ColumnContext ctx) { | ||
var penultimateChildTable = ctx.getChild(0); | ||
var penultimateChildTableName = penultimateChildTable.getText(); | ||
|
||
return this.dataSourceCollection.stream() | ||
.filter(dataSource -> dataSource.getChild(0).getChildCount() > 2) | ||
.anyMatch(dataSource -> dataSource.getChild(1).getChild(1).getText().matches(penultimateChildTableName)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ovcharenko-di возможно, стоит рассмотреть возможность предварительной подготовки доп.коллекции из dataSourceCollection чтобы для каждого имя реквизита не выполнять повторный и ненужный поиск например, отдельный список нужных детей |
||
} | ||
|
||
private static String getTableNameOrAlias(ParseTree dataSource) { | ||
return Optional.of(dataSource) | ||
.flatMap(dataSrc -> extractTextFromChild(dataSrc, SDBLParser.RULE_alias)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this лишний