You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Class org.jetbrains.changelog.Changelog.Item has two unused properties: itemPrefix and lineSeparator. They are only used by private function copy to pass the value to the constructor.
To Reproduce
Add the following code to src/test/kotlin/org/jetbrains/changelog/ChangelogTesting.kt in the repository:
packageorg.jetbrains.changelogfunmain() {
val changelog =Changelog(
"", null, null, null, ChangelogPluginConstants.UNRELEASED_TERM, ChangelogPluginConstants.GROUPS,
ChangelogPluginConstants.SEM_VER_REGEX,
"+ This prefix from Changelog is used: ",
null, { _, _, _, _ ->"" },
"\n\n"// <---- this line separator is used
)
println(
changelog.renderItem(
Changelog.Item(
"", "", "", false, mapOf("Example section" to setOf("Example", "of", "list")),
" this itemPrefix is ignored", " the line separator from Item is ignored too"
),
Changelog.OutputType.MARKDOWN
)
)
}
Launch function main()
Actual behavior
Output of the program uses the values of itemPrefix and lineSeparator from class Changelog:
##
### Example section
+ This prefix from Changelog is used: Example
+ This prefix from Changelog is used: of
+ This prefix from Changelog is used: list
though user of class Item might expect the values passed into the constructor to be used.
Expected behavior
Class Changelog.Item doesn't have the unused properties. Even though I'm experimenting with using the class Item directly, I'm OK with just dropping these properties, which would lead to a compilation error on upgrade, if the class is used directly.
Starting to use the properties doesn't seem useful. It might break changelog formatting unexpectedly after an upgrade, unlike a compilation error if they were just removed.
Maybe a deprecation period could be used, with eventual removal.
Additional context
Even though function renderItem() calls with(item), properties itemPrefix and lineSeparator are private in class Item, so properties with the same name of the class Changelog get used in lines:
Describe the bug
Class
org.jetbrains.changelog.Changelog.Item
has two unused properties:itemPrefix
andlineSeparator
. They are only used by private functioncopy
to pass the value to the constructor.To Reproduce
src/test/kotlin/org/jetbrains/changelog/ChangelogTesting.kt
in the repository:main()
Actual behavior
Output of the program uses the values of itemPrefix and lineSeparator from class
Changelog
:though user of class
Item
might expect the values passed into the constructor to be used.Expected behavior
Class
Changelog.Item
doesn't have the unused properties. Even though I'm experimenting with using the classItem
directly, I'm OK with just dropping these properties, which would lead to a compilation error on upgrade, if the class is used directly.Starting to use the properties doesn't seem useful. It might break changelog formatting unexpectedly after an upgrade, unlike a compilation error if they were just removed.
Maybe a deprecation period could be used, with eventual removal.
Additional context
Even though function
renderItem()
callswith(item)
, propertiesitemPrefix
andlineSeparator
areprivate
in classItem
, so properties with the same name of the classChangelog
get used in lines:The text was updated successfully, but these errors were encountered: