-
Notifications
You must be signed in to change notification settings - Fork 34
Persisted schema #11504
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
base: master
Are you sure you want to change the base?
Persisted schema #11504
Conversation
# Conflicts: # modules/core/core-content/src/main/java/com/enonic/xp/core/impl/content/ContentServiceImpl.java # modules/itest/itest-core/src/test/java/com/enonic/xp/core/content/AbstractContentServiceTest.java # modules/itest/itest-core/src/test/java/com/enonic/xp/core/content/AbstractContentSynchronizerTest.java
# Conflicts: # modules/admin/admin-impl/src/test/java/com/enonic/xp/admin/impl/tool/XmlAdminToolDescriptorParserTest.java # modules/admin/admin-impl/src/test/java/com/enonic/xp/admin/impl/widget/XmlWidgetDescriptorParserTest.java # modules/core/core-api/src/test/java/com/enonic/xp/app/ApplicationRelativeResolverTest.java # modules/core/core-api/src/test/java/com/enonic/xp/form/FormItemSetTest.java # modules/core/core-api/src/test/java/com/enonic/xp/inputtype/CheckBoxTypeTest.java # modules/core/core-api/src/test/java/com/enonic/xp/inputtype/ComboBoxTypeTest.java # modules/core/core-api/src/test/java/com/enonic/xp/inputtype/CustomSelectorTypeTest.java # modules/core/core-api/src/test/java/com/enonic/xp/inputtype/DateTimeTypeTest.java # modules/core/core-api/src/test/java/com/enonic/xp/inputtype/DateTypeTest.java # modules/core/core-api/src/test/java/com/enonic/xp/inputtype/DoubleTypeTest.java # modules/core/core-api/src/test/java/com/enonic/xp/inputtype/GeoPointTypeTest.java # modules/core/core-api/src/test/java/com/enonic/xp/inputtype/HtmlAreaTypeTest.java # modules/core/core-api/src/test/java/com/enonic/xp/inputtype/LongTypeTest.java # modules/core/core-api/src/test/java/com/enonic/xp/inputtype/RadioButtonTypeTest.java # modules/core/core-api/src/test/java/com/enonic/xp/inputtype/RelativeTimeParserTest.java # modules/core/core-api/src/test/java/com/enonic/xp/inputtype/TextAreaTypeTest.java # modules/core/core-api/src/test/java/com/enonic/xp/inputtype/TextLineTypeTest.java # modules/core/core-api/src/test/java/com/enonic/xp/inputtype/TimeTypeTest.java # modules/core/core-api/src/test/java/com/enonic/xp/schema/mixin/MixinNameTest.java # modules/core/core-api/src/test/java/com/enonic/xp/schema/mixin/MixinNamesTest.java # modules/core/core-api/src/test/java/com/enonic/xp/schema/mixin/MixinTest.java # modules/core/core-api/src/test/java/com/enonic/xp/schema/mixin/MixinsTest.java # modules/core/core-api/src/test/java/com/enonic/xp/site/SiteDescriptorTest.java # modules/core/core-api/src/test/java/com/enonic/xp/xml/parser/InputTypeAliasConvertersTest.java # modules/core/core-api/src/test/java/com/enonic/xp/xml/parser/XmlApplicationParserTest.java # modules/core/core-api/src/test/java/com/enonic/xp/xml/parser/XmlContentTypeParserTest.java # modules/core/core-api/src/test/java/com/enonic/xp/xml/parser/XmlInputTypeConfigMapperTest.java # modules/core/core-api/src/test/java/com/enonic/xp/xml/parser/XmlLayoutDescriptorParserTest.java # modules/core/core-api/src/test/java/com/enonic/xp/xml/parser/XmlMacroDescriptorParserTest.java # modules/core/core-api/src/test/java/com/enonic/xp/xml/parser/XmlMixinParserTest.java # modules/core/core-api/src/test/java/com/enonic/xp/xml/parser/XmlPageDescriptorParserTest.java # modules/core/core-api/src/test/java/com/enonic/xp/xml/parser/XmlPartDescriptorParserTest.java # modules/core/core-api/src/test/java/com/enonic/xp/xml/parser/XmlServiceDescriptorParserTest.java # modules/core/core-api/src/test/java/com/enonic/xp/xml/parser/XmlSiteParserTest.java # modules/core/core-api/src/test/java/com/enonic/xp/xml/parser/XmlStyleDescriptorParserTest.java # modules/core/core-api/src/test/java/com/enonic/xp/xml/parser/XmlWebappDescriptorParserTest.java # modules/core/core-api/src/test/java/com/enonic/xp/xml/parser/XmlXDataParserTest.java # modules/core/core-api/src/testFixtures/java/com/enonic/xp/xml/parser/XmlModelParserTest.java # modules/core/core-content/src/test/java/com/enonic/xp/core/impl/content/schema/CmsFormFragmentServiceImplTest.java # modules/core/core-content/src/test/java/com/enonic/xp/core/impl/content/schema/ContentTypeServiceTest.java # modules/core/core-content/src/test/java/com/enonic/xp/core/impl/content/schema/XDataServiceImplTest.java # modules/core/core-content/src/test/java/com/enonic/xp/core/impl/site/CmsServiceImplTest.java # modules/core/core-repo/src/test/java/com/enonic/xp/repo/impl/elasticsearch/query/translator/factory/dsl/QueryBuilderTest.java # modules/core/core-schema/src/test/java/com/enonic/xp/core/impl/form/FormDefaultValuesProcessorImplTest.java # modules/core/core-task/src/test/java/com/enonic/xp/impl/task/XmlTaskDescriptorParserTest.java # modules/itest/itest-core/src/test/java/com/enonic/xp/core/dynamic/DynamicSchemaServiceImplTest.java # modules/lib/lib-schema/src/test/java/com/enonic/xp/lib/schema/CreateDynamicContentSchemaHandlerTest.java # modules/lib/lib-schema/src/test/java/com/enonic/xp/lib/schema/DeleteDynamicContentSchemaHandlerTest.java # modules/lib/lib-schema/src/test/java/com/enonic/xp/lib/schema/GetDynamicContentSchemaHandlerTest.java # modules/lib/lib-schema/src/test/java/com/enonic/xp/lib/schema/UpdateDynamicContentSchemaHandlerTest.java # modules/portal/portal-impl/src/test/java/com/enonic/xp/portal/impl/api/XmlApiDescriptorParserTest.java
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #11504 +/- ##
============================================
- Coverage 86.60% 86.47% -0.14%
+ Complexity 19607 19442 -165
============================================
Files 2528 2562 +34
Lines 66628 65907 -721
Branches 5367 5205 -162
============================================
- Hits 57702 56991 -711
- Misses 6313 6345 +32
+ Partials 2613 2571 -42 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
# Conflicts: # modules/lib/lib-content/src/main/java/com/enonic/xp/lib/content/CreateContentHandler.java
| public abstract class OccurrencesMapper | ||
| { | ||
| @JsonCreator | ||
| public OccurrencesMapper( @JsonProperty("min") int minimum, @JsonProperty("max") int maximum ) |
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.
The issue reported by the PMD linter indicates that the constructor parameter maximum is not being used within the constructor body. This is considered a best practice violation because it can lead to confusion about the purpose of the parameter if it is not utilized.
To resolve this issue, we can remove the unused parameter from the constructor. Here’s the suggested change:
| public OccurrencesMapper( @JsonProperty("min") int minimum, @JsonProperty("max") int maximum ) | |
| public OccurrencesMapper( @JsonProperty("min") int minimum ) |
This comment was generated by an experimental AI tool.
| @@ -325,9 +324,9 @@ private BufferedImage cropImage( final BufferedImage image, final Cropping cropp | |||
| (int) ( height * cropping.height() ) ); | |||
| } | |||
|
|
|||
| private ExtraDatas extractMetadata( final MediaInfo mediaInfo ) | |||
| private Mixins extractMetadata( final MediaInfo mediaInfo ) | |||
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.
The issue identified by the PMD linter relates to the NPath complexity of the extractMetadata method. NPath complexity measures the number of unique execution paths through a method, which can increase significantly with nested loops and conditionals. A high NPath complexity (like 288 in this case) indicates that the method is likely too complex, making it harder to understand, maintain, and test.
To address this complexity issue, one effective approach is to break the method into smaller, more manageable pieces. However, since you requested a single line change, we can focus on simplifying or refactoring a specific part of the method.
Given that the provided code fragment does not include the full implementation of the extractMetadata method, a common approach to reduce complexity is to extract the metadata processing logic into a separate method. However, since we are limited to a single line change, we can make a small adjustment to the existing code that might help reduce complexity slightly.
Here's a suggestion to encapsulate the metadata extraction logic within a helper method, which reduces the complexity by offloading some of the logic:
| private Mixins extractMetadata( final MediaInfo mediaInfo ) | |
| private Mixins extractMetadata( final MediaInfo mediaInfo ) { return processMetadata(mediaInfo.getMetadata().asMap()); } |
In this suggestion, processMetadata would be a new method that you would need to implement to handle the processing of the metadata. This change reduces the complexity of extractMetadata by delegating part of its logic to another method, making it easier to maintain and understand.
This comment was generated by an experimental AI tool.
No description provided.