You've already forked v8-code-style
mirror of
https://github.com/1C-Company/v8-code-style.git
synced 2025-12-02 01:11:47 +02:00
Merge branch 'master' into edt-2023-3
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
|
||||
### Исправленные ошибки
|
||||
|
||||
- Ложное срабатывание проверки module-accessibility-at-client в модулях расширений #1207
|
||||
|
||||
|
||||
## 0.6.0
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.CATALOG_
|
||||
import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.DOCUMENT;
|
||||
import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.DOCUMENT_ATTRIBUTE;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
@@ -57,19 +58,17 @@ public class MdObjectAttributeCommentCheck
|
||||
|
||||
private static final String CHECK_ID = "md-object-attribute-comment-incorrect-type"; //$NON-NLS-1$
|
||||
|
||||
public static final String PARAM_CHECK_DOCUMENTS = "checkDocuments"; //$NON-NLS-1$
|
||||
public static final String PARAM_CHECK_CATALOGS = "checkCatalogs"; //$NON-NLS-1$
|
||||
public static final String PARAM_ATTRIBUTES_LIST = "attributesList"; //$NON-NLS-1$
|
||||
private static final String PARAM_CHECK_DOCUMENTS = "checkDocuments"; //$NON-NLS-1$
|
||||
private static final String PARAM_CHECK_CATALOGS = "checkCatalogs"; //$NON-NLS-1$
|
||||
private static final String PARAM_ATTRIBUTES_LIST = "attributesList"; //$NON-NLS-1$
|
||||
|
||||
public static final String DEFAULT_CHECK_DOCUMENTS = Boolean.toString(true);
|
||||
public static final String DEFAULT_CHECK_CATALOGS = Boolean.toString(false);
|
||||
private static final String DEFAULT_CHECK_DOCUMENTS = Boolean.toString(true);
|
||||
private static final String DEFAULT_CHECK_CATALOGS = Boolean.toString(false);
|
||||
|
||||
private static final Set<String> COMMENT_ATTRIBUTES_LIST = Set.of("Комментарий", //$NON-NLS-1$
|
||||
"Comment"); //$NON-NLS-1$
|
||||
private static final String DELIMITER = ","; //$NON-NLS-1$
|
||||
public static final String DEFAULT_ATTRIBUTES_LIST = String.join(DELIMITER, COMMENT_ATTRIBUTES_LIST);
|
||||
|
||||
private static final String DEFAULT_CHECK_MESSAGE = Messages.MdObjectAttributeCommentCheck_Default_check_message;
|
||||
private static final String DEFAULT_ATTRIBUTES_LIST = String.join(DELIMITER, COMMENT_ATTRIBUTES_LIST);
|
||||
|
||||
public MdObjectAttributeCommentCheck()
|
||||
{
|
||||
@@ -127,15 +126,14 @@ public class MdObjectAttributeCommentCheck
|
||||
return;
|
||||
}
|
||||
|
||||
if (!monitor.isCanceled() && checkDocuments && isDocumentAttribute(object))
|
||||
boolean isDocument = checkDocuments && isDocumentAttribute(object);
|
||||
boolean isCatalog = checkCatalogs && isCatalogAttribute(object);
|
||||
|
||||
if (!monitor.isCanceled() && (isDocument || isCatalog))
|
||||
{
|
||||
checkAttribute(attribute, resultAceptor);
|
||||
}
|
||||
|
||||
if (!monitor.isCanceled() && checkCatalogs && isCatalogAttribute(object))
|
||||
{
|
||||
checkAttribute(attribute, resultAceptor);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAttribute(BasicFeature attribute, ResultAcceptor resultAceptor)
|
||||
@@ -149,7 +147,9 @@ public class MdObjectAttributeCommentCheck
|
||||
TypeDescription typeDesc = attribute.getType();
|
||||
if (McoreUtil.isCompoundType(typeDesc))
|
||||
{
|
||||
resultAceptor.addIssue(DEFAULT_CHECK_MESSAGE, BASIC_FEATURE__TYPE);
|
||||
String msg = MessageFormat.format(Messages.MdObjectAttributeCommentCheck_message,
|
||||
Messages.MdObjectAttributeCommentCheck_Is_compound_type);
|
||||
resultAceptor.addIssue(msg, BASIC_FEATURE__TYPE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -170,13 +170,17 @@ public class MdObjectAttributeCommentCheck
|
||||
StringQualifiers qualifiers = typeDesc.getStringQualifiers();
|
||||
if (qualifiers == null)
|
||||
{
|
||||
resultAceptor.addIssue(DEFAULT_CHECK_MESSAGE, BASIC_FEATURE__TYPE);
|
||||
String msg = MessageFormat.format(Messages.MdObjectAttributeCommentCheck_message,
|
||||
Messages.MdObjectAttributeCommentCheck_Not_a_String);
|
||||
resultAceptor.addIssue(msg, BASIC_FEATURE__TYPE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (qualifiers.getLength() != 0)
|
||||
{
|
||||
resultAceptor.addIssue(DEFAULT_CHECK_MESSAGE, BASIC_FEATURE__TYPE);
|
||||
String msg = MessageFormat.format(Messages.MdObjectAttributeCommentCheck_message,
|
||||
Messages.MdObjectAttributeCommentCheck_String_is_not_unlimited);
|
||||
resultAceptor.addIssue(msg, BASIC_FEATURE__TYPE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -185,7 +189,9 @@ public class MdObjectAttributeCommentCheck
|
||||
{
|
||||
if (!attribute.isMultiLine())
|
||||
{
|
||||
resultAceptor.addIssue(DEFAULT_CHECK_MESSAGE, BASIC_FEATURE__MULTI_LINE);
|
||||
String msg = MessageFormat.format(Messages.MdObjectAttributeCommentCheck_message,
|
||||
Messages.MdObjectAttributeCommentCheck_Multiline_edit_is_not_enabled);
|
||||
resultAceptor.addIssue(msg, BASIC_FEATURE__MULTI_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,12 @@ final class Messages
|
||||
public static String MdObjectAttributeCommentCheck_Attribute_list;
|
||||
public static String MdObjectAttributeCommentCheck_Check_catalogs_param;
|
||||
public static String MdObjectAttributeCommentCheck_Check_documents_param;
|
||||
public static String MdObjectAttributeCommentCheck_Default_check_message;
|
||||
public static String MdObjectAttributeCommentCheck_Is_compound_type;
|
||||
public static String MdObjectAttributeCommentCheck_Multiline_edit_is_not_enabled;
|
||||
public static String MdObjectAttributeCommentCheck_Not_a_String;
|
||||
public static String MdObjectAttributeCommentCheck_String_is_not_unlimited;
|
||||
public static String MdObjectAttributeCommentCheck_description;
|
||||
public static String MdObjectAttributeCommentCheck_message;
|
||||
public static String MdObjectAttributeCommentCheck_title;
|
||||
public static String MdObjectAttributeCommentNotExist_description;
|
||||
public static String MdObjectAttributeCommentNotExist_Md_Object_attribute_Comment_does_not_exist;
|
||||
|
||||
@@ -31,17 +31,25 @@ MdListObjectPresentationCheck_decription = Neither Object presentation nor List
|
||||
|
||||
MdListObjectPresentationCheck_title = Neither Object presentation nor List presentation is not filled
|
||||
|
||||
MdObjectAttributeCommentCheck_Attribute_list=Attributes list
|
||||
MdObjectAttributeCommentCheck_Attribute_list = Attributes list
|
||||
|
||||
MdObjectAttributeCommentCheck_Check_catalogs_param=Check Catalogs
|
||||
MdObjectAttributeCommentCheck_Check_catalogs_param = Check Catalogs
|
||||
|
||||
MdObjectAttributeCommentCheck_Check_documents_param=Check Documents
|
||||
MdObjectAttributeCommentCheck_Check_documents_param = Check Documents
|
||||
|
||||
MdObjectAttributeCommentCheck_Default_check_message=The attribute "Comment" has an invalid type
|
||||
MdObjectAttributeCommentCheck_Is_compound_type = attribute type is compound
|
||||
|
||||
MdObjectAttributeCommentCheck_description=The attribute "Comment" has an invalid type
|
||||
MdObjectAttributeCommentCheck_Multiline_edit_is_not_enabled = multiline edit is not enabled
|
||||
|
||||
MdObjectAttributeCommentCheck_title=The attribute "Comment" has an invalid type
|
||||
MdObjectAttributeCommentCheck_Not_a_String = type is not a String
|
||||
|
||||
MdObjectAttributeCommentCheck_String_is_not_unlimited = String must be of unlimited length
|
||||
|
||||
MdObjectAttributeCommentCheck_description = The attribute "Comment" has an invalid type
|
||||
|
||||
MdObjectAttributeCommentCheck_message = The attribute "Comment" has an invalid type: {0}
|
||||
|
||||
MdObjectAttributeCommentCheck_title = The attribute "Comment" has an invalid type
|
||||
|
||||
MdObjectAttributeCommentNotExist_Md_Object_attribute_Comment_does_not_exist = Md Object attribute "Comment" does not exist
|
||||
|
||||
|
||||
@@ -38,10 +38,18 @@ MdObjectAttributeCommentCheck_Check_catalogs_param = Проверять спра
|
||||
|
||||
MdObjectAttributeCommentCheck_Check_documents_param = Проверять документы
|
||||
|
||||
MdObjectAttributeCommentCheck_Default_check_message = Реквизит "Комментарий" имеет недопустимый тип
|
||||
MdObjectAttributeCommentCheck_Is_compound_type = реквизит имеет составной тип данных
|
||||
|
||||
MdObjectAttributeCommentCheck_Multiline_edit_is_not_enabled = не включен многострочный режим
|
||||
|
||||
MdObjectAttributeCommentCheck_Not_a_String = тип не Строка
|
||||
|
||||
MdObjectAttributeCommentCheck_String_is_not_unlimited = Строка должна быть неограниченной длины
|
||||
|
||||
MdObjectAttributeCommentCheck_description = Реквизит "Комментарий" имеет недопустимый тип
|
||||
|
||||
MdObjectAttributeCommentCheck_message = Реквизит "Комментарий" имеет недопустимый тип: {0}
|
||||
|
||||
MdObjectAttributeCommentCheck_title = Реквизит "Комментарий" имеет недопустимый тип
|
||||
|
||||
MdObjectAttributeCommentNotExist_Md_Object_attribute_Comment_does_not_exist = Объект метаданных не имеет реквизит "Комментарий"
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -19,6 +19,11 @@ Procedure PresentationFieldsGetProcessing(Fields, StandardProcessing)
|
||||
// Complaint
|
||||
EndProcedure
|
||||
|
||||
&After("PresentationFieldsGetProcessing")
|
||||
Procedure Compiant2(Fields, StandardProcessing)
|
||||
// Complaint
|
||||
EndProcedure
|
||||
|
||||
Procedure Noncompiant2() Export
|
||||
// empty
|
||||
EndProcedure
|
||||
|
||||
Reference in New Issue
Block a user