1
0
mirror of https://github.com/1C-Company/v8-code-style.git synced 2024-11-24 16:53:51 +02:00

Merge pull request #1396 from 1C-Company/bugfix/1207-accessibility-at-client-with-pragma

Ложное срабатывание проверки в модулях расширений: 456 #1207
This commit is contained in:
Dmitriy Marmyshev 2023-12-23 00:07:23 -08:00 committed by GitHub
commit d0ab1746ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 4 deletions

View File

@ -31,6 +31,7 @@
### Исправленные ошибки
- Ложное срабатывание проверки module-accessibility-at-client в модулях расширений #1207
## 0.6.0

View File

@ -164,7 +164,7 @@ public class AccessibilityAtClientInObjectModuleCheck
private boolean allowManagerEventAtClient(EObject object, Module module, ICheckParameters parameters)
{
if (object instanceof Method && module.getModuleType() == ModuleType.MANAGER_MODULE
&& ((Method)object).isEvent())
&& (((Method)object).isEvent() || !((Method)object).getPragmas().isEmpty()))
{
String parameterMethodNames = parameters.getString(PARAMETER_ALLOW_MANAGER_EVENTS_AT_CLIENT);
if (StringUtils.isEmpty(parameterMethodNames))
@ -175,8 +175,11 @@ public class AccessibilityAtClientInObjectModuleCheck
Method method = (Method)object;
Set<String> methodNames = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
methodNames.addAll(List.of(parameterMethodNames.split(",\\s*"))); //$NON-NLS-1$
return methodNames.contains(method.getName());
return methodNames.contains(method.getName()) || !method.getPragmas().isEmpty() && method.getPragmas()
.stream()
.map(p -> p.getValue().replace("\"", "")) //$NON-NLS-1$ //$NON-NLS-2$
.filter(StringUtils::isNotBlank)
.anyMatch(methodNames::contains);
}
return false;
}

View File

@ -81,7 +81,7 @@ public class AccessibilityAtClientInObjectModuleCheckTest
Marker marker = markers.get(0);
assertEquals("2", marker.getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
marker = markers.get(1);
assertEquals("22", marker.getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
assertEquals("27", marker.getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
}
private List<Marker> getObjectModuleMarkers()

View File

@ -19,6 +19,11 @@ Procedure PresentationFieldsGetProcessing(Fields, StandardProcessing)
// Complaint
EndProcedure
&After("PresentationFieldsGetProcessing")
Procedure Compiant2(Fields, StandardProcessing)
// Complaint
EndProcedure
Procedure Noncompiant2() Export
// empty
EndProcedure