LemonAppDev/konsist (com.lemonappdev:konsist)
### [`v0.16.1`](https://redirect.github.com/LemonAppDev/konsist/releases/tag/v0.16.1)
#### What's Changed
Hot fix release.
#### Complete list of changes
##### ⚠️ Breaking API Changes
- KON-621 Wrong class is selected for nested classes [https://github.com/LemonAppDev/konsist/pull/1254](https://redirect.github.com/LemonAppDev/konsist/pull/1254)
##### 🐛 API Bug Fixes
- Fix crash while parsing generated Kotlin files [https://github.com/LemonAppDev/konsist/pull/1334](https://redirect.github.com/LemonAppDev/konsist/pull/1334)
**Full Changelog**: https://github.com/LemonAppDev/konsist/compare/v0.16.0...v0.16.1
### [`v0.16.0`](https://redirect.github.com/LemonAppDev/konsist/releases/tag/v0.16.0)
#### What's Changed
This release contains new improvement and API updates. Two new features are providers for all common combinations of interface, object and class and `doesNotDependOn` method for architecture checks.
Thanks you for your feedback 🙏
##### 1. Add providers for all common combinations of interface, object and class
**Adding suport for writing tests for classes, interfaces and objects in one test.**
Konsist now provides a set of methods such as:
- `classesAndInterfacesAndObjects()`
- `classesAndInterfaces()`
- `classesAndObjects()`
- `interfacesAndObjects()`
These methods can be used in two ways:
- Case 1: After creating the initial scope.
- Case 2: When filtering chosen declarations from other declarations.
For example:
```kotlin
// Case 1
scope
.classesAndInterfacesAndObjects(includeNested = true, includeLocal = false)
.assertTrue { it.hasNameEndingWith("Suffix") }
scope
.classesAndObjects()
.assertTrue { it.hasDataModifier }
// Case 2
scope
.classes()
.classesAndInterfaces(includeNested = true, includeLocal = false)
.assertTrue { it.hasNameEndingWith("Suffix") }
scope
.classes()
.classesAndObjects()
.assertTrue { it.hasDataModifier }
```
In addition to these methods, Konsist offers various other functions that allow you to count all selected declarations, check whether they meet a specific predicate, or determine if any declarations match the selected criteria. Examples include:
- `numClassesAndInterfacesAndObjects()`
- `countClassesAndInterfacesAndObjects { it.hasNameEndingWith("Suffix") }`
- `hasClassesOrInterfacesOrObjects()`
- `hasClassOrInterfaceOrObject { it.hasNameEndingWith("Suffix") }`
The examples above demonstrate methods for classes, interfaces, and objects, but Konsist provides similar methods for all combinations of classes, interfaces, and objects (either individually, in pairs, or all together).
Additionally, Konsist includes a set of `withX/withoutX` extension functions, enabling you to write tests like:
```kotlin
scope
.classes()
.withClassOrInterfaceOrObjectNamed("SampleName")
.assertTrue { ... }
```
##### 2. `doesNotDependOn` method
Added `doesNotDependOn` method to architectural checks.
Eg. It is possible to write such tests for this architecture
![image](https://redirect.github.com/user-attachments/assets/6d0b2a38-ebb8-4d64-9144-fb443b0b3067)
```kotlin
private val scope = Konsist.scopeFromProject()
private val adapter = Layer("Adapter", "com.samplepackage.adapter..")
private val common = Layer("Common", "com.samplepackage.common..")
private val domain = Layer("Domain", "com.samplepackage.domain..")
private val port = Layer("Port", "com.samplepackage.port..")
@Test
fun `Domain layer not depend on Adapter and Port layers and Adapter layer not depend on Domain layer`() {
scope.assertArchitecture {
domain.doesNotDependOn(adapter, port)
adapter.doesNotDependOn(domain)
}
}
```
#### Complete list of changes
##### ⚠️ Breaking API Changes
- KON-624 KoParameterDeclaration should not have a fullyQualifiedName property [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) [https://github.com/LemonAppDev/konsist/pull/1234](https://redirect.github.com/LemonAppDev/konsist/pull/1234)
- KON-608 Rename KoInitializerProvider to KoIsInitializedProvider by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1281](https://redirect.github.com/LemonAppDev/konsist/pull/1281)
##### 🐛 API Bug Fixes
- KON-620 `KoTypeDeclarationProvider.declaration` throws an exception when `typeAliases` extension is called by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1089](https://redirect.github.com/LemonAppDev/konsist/pull/1089)
- KON-627 Fix bug: During `hasOperatorModifier()` filtration `KoInternalException` was shown with message: `Modifier not found: with` by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1167](https://redirect.github.com/LemonAppDev/konsist/pull/1167)
- KON-630 `KoDefaultValueProviderCore` does not handle default values that are objects by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1282](https://redirect.github.com/LemonAppDev/konsist/pull/1282)
- KON-628 Bug with fully qualified names of inner class declarations by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1241](https://redirect.github.com/LemonAppDev/konsist/pull/1241)
##### 💡 API Improvements
- KON-618 Remove Deprecated Items by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1012](https://redirect.github.com/LemonAppDev/konsist/pull/1012)
- KON-622 Add KoAnnotationProvider for type declarations by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1095](https://redirect.github.com/LemonAppDev/konsist/pull/1095)
- KON-263 Add `withText` extensions by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1118](https://redirect.github.com/LemonAppDev/konsist/pull/1118)
- KON-623 Add `doesNotDependOn` to layer verification by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1233](https://redirect.github.com/LemonAppDev/konsist/pull/1233)
- KON-605 KoImportDeclaration add represents type by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1258](https://redirect.github.com/LemonAppDev/konsist/pull/1258)
- Add file information to getKtFile IllegalArgumentException by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1296](https://redirect.github.com/LemonAppDev/konsist/pull/1296)
- KON-629 Add providers for all common combinations of interface, object and class by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1260](https://redirect.github.com/LemonAppDev/konsist/pull/1260)
##### 📕 Documentation
- Clean Up Readme by [@igorwojda](https://redirect.github.com/igorwojda) in [https://github.com/LemonAppDev/konsist/pull/982](https://redirect.github.com/LemonAppDev/konsist/pull/982)
- KON-612 Sample projects are using deprecated code by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1013](https://redirect.github.com/LemonAppDev/konsist/pull/1013)
- KON-581 Remove konsist-starter- directory prefix in smaple projects by [@jibidus](https://redirect.github.com/jibidus) in [https://github.com/LemonAppDev/konsist/pull/1031](https://redirect.github.com/LemonAppDev/konsist/pull/1031)
- Upd docs by [@igorwojda](https://redirect.github.com/igorwojda) in [https://github.com/LemonAppDev/konsist/pull/1177](https://redirect.github.com/LemonAppDev/konsist/pull/1177)
- Add Snippet by [@igorwojda](https://redirect.github.com/igorwojda) in [https://github.com/LemonAppDev/konsist/pull/1194](https://redirect.github.com/LemonAppDev/konsist/pull/1194)
##### 🏗️ Maintanance
- Fix CI jobs on macos-latest after github actions image migration by [@jibidus](https://redirect.github.com/jibidus) in [https://github.com/LemonAppDev/konsist/pull/1032](https://redirect.github.com/LemonAppDev/konsist/pull/1032)
- KON-607 Update script and release snippets to kotlin documentation repo by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1014](https://redirect.github.com/LemonAppDev/konsist/pull/1014)
- KON-266 Add Konsist test to check that none method has name containing "Some" by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1115](https://redirect.github.com/LemonAppDev/konsist/pull/1115)
- KON-625 Create script to verify that all snippets with extension `.ktdoc` have valid Kotlin code by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1122](https://redirect.github.com/LemonAppDev/konsist/pull/1122)
- KON-231 Add tests for KoParameterDeclaration using function parameters by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1238](https://redirect.github.com/LemonAppDev/konsist/pull/1238)
**Full Changelog**: https://github.com/LemonAppDev/konsist/compare/v0.15.1...v0.16.0
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - "every 4 hour after 00:00 and before 23:59 every day" in timezone Asia/Tokyo.
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR contains the following updates:
0.15.1
->0.16.1
Release Notes
LemonAppDev/konsist (com.lemonappdev:konsist)
### [`v0.16.1`](https://redirect.github.com/LemonAppDev/konsist/releases/tag/v0.16.1) #### What's Changed Hot fix release. #### Complete list of changes ##### ⚠️ Breaking API Changes - KON-621 Wrong class is selected for nested classes [https://github.com/LemonAppDev/konsist/pull/1254](https://redirect.github.com/LemonAppDev/konsist/pull/1254) ##### 🐛 API Bug Fixes - Fix crash while parsing generated Kotlin files [https://github.com/LemonAppDev/konsist/pull/1334](https://redirect.github.com/LemonAppDev/konsist/pull/1334) **Full Changelog**: https://github.com/LemonAppDev/konsist/compare/v0.16.0...v0.16.1 ### [`v0.16.0`](https://redirect.github.com/LemonAppDev/konsist/releases/tag/v0.16.0) #### What's Changed This release contains new improvement and API updates. Two new features are providers for all common combinations of interface, object and class and `doesNotDependOn` method for architecture checks. Thanks you for your feedback 🙏 ##### 1. Add providers for all common combinations of interface, object and class **Adding suport for writing tests for classes, interfaces and objects in one test.** Konsist now provides a set of methods such as: - `classesAndInterfacesAndObjects()` - `classesAndInterfaces()` - `classesAndObjects()` - `interfacesAndObjects()` These methods can be used in two ways: - Case 1: After creating the initial scope. - Case 2: When filtering chosen declarations from other declarations. For example: ```kotlin // Case 1 scope .classesAndInterfacesAndObjects(includeNested = true, includeLocal = false) .assertTrue { it.hasNameEndingWith("Suffix") } scope .classesAndObjects() .assertTrue { it.hasDataModifier } // Case 2 scope .classes() .classesAndInterfaces(includeNested = true, includeLocal = false) .assertTrue { it.hasNameEndingWith("Suffix") } scope .classes() .classesAndObjects() .assertTrue { it.hasDataModifier } ``` In addition to these methods, Konsist offers various other functions that allow you to count all selected declarations, check whether they meet a specific predicate, or determine if any declarations match the selected criteria. Examples include: - `numClassesAndInterfacesAndObjects()` - `countClassesAndInterfacesAndObjects { it.hasNameEndingWith("Suffix") }` - `hasClassesOrInterfacesOrObjects()` - `hasClassOrInterfaceOrObject { it.hasNameEndingWith("Suffix") }` The examples above demonstrate methods for classes, interfaces, and objects, but Konsist provides similar methods for all combinations of classes, interfaces, and objects (either individually, in pairs, or all together). Additionally, Konsist includes a set of `withX/withoutX` extension functions, enabling you to write tests like: ```kotlin scope .classes() .withClassOrInterfaceOrObjectNamed("SampleName") .assertTrue { ... } ``` ##### 2. `doesNotDependOn` method Added `doesNotDependOn` method to architectural checks. Eg. It is possible to write such tests for this architecture ![image](https://redirect.github.com/user-attachments/assets/6d0b2a38-ebb8-4d64-9144-fb443b0b3067) ```kotlin private val scope = Konsist.scopeFromProject() private val adapter = Layer("Adapter", "com.samplepackage.adapter..") private val common = Layer("Common", "com.samplepackage.common..") private val domain = Layer("Domain", "com.samplepackage.domain..") private val port = Layer("Port", "com.samplepackage.port..") @Test fun `Domain layer not depend on Adapter and Port layers and Adapter layer not depend on Domain layer`() { scope.assertArchitecture { domain.doesNotDependOn(adapter, port) adapter.doesNotDependOn(domain) } } ``` #### Complete list of changes ##### ⚠️ Breaking API Changes - KON-624 KoParameterDeclaration should not have a fullyQualifiedName property [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) [https://github.com/LemonAppDev/konsist/pull/1234](https://redirect.github.com/LemonAppDev/konsist/pull/1234) - KON-608 Rename KoInitializerProvider to KoIsInitializedProvider by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1281](https://redirect.github.com/LemonAppDev/konsist/pull/1281) ##### 🐛 API Bug Fixes - KON-620 `KoTypeDeclarationProvider.declaration` throws an exception when `typeAliases` extension is called by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1089](https://redirect.github.com/LemonAppDev/konsist/pull/1089) - KON-627 Fix bug: During `hasOperatorModifier()` filtration `KoInternalException` was shown with message: `Modifier not found: with` by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1167](https://redirect.github.com/LemonAppDev/konsist/pull/1167) - KON-630 `KoDefaultValueProviderCore` does not handle default values that are objects by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1282](https://redirect.github.com/LemonAppDev/konsist/pull/1282) - KON-628 Bug with fully qualified names of inner class declarations by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1241](https://redirect.github.com/LemonAppDev/konsist/pull/1241) ##### 💡 API Improvements - KON-618 Remove Deprecated Items by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1012](https://redirect.github.com/LemonAppDev/konsist/pull/1012) - KON-622 Add KoAnnotationProvider for type declarations by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1095](https://redirect.github.com/LemonAppDev/konsist/pull/1095) - KON-263 Add `withText` extensions by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1118](https://redirect.github.com/LemonAppDev/konsist/pull/1118) - KON-623 Add `doesNotDependOn` to layer verification by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1233](https://redirect.github.com/LemonAppDev/konsist/pull/1233) - KON-605 KoImportDeclaration add represents type by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1258](https://redirect.github.com/LemonAppDev/konsist/pull/1258) - Add file information to getKtFile IllegalArgumentException by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1296](https://redirect.github.com/LemonAppDev/konsist/pull/1296) - KON-629 Add providers for all common combinations of interface, object and class by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1260](https://redirect.github.com/LemonAppDev/konsist/pull/1260) ##### 📕 Documentation - Clean Up Readme by [@igorwojda](https://redirect.github.com/igorwojda) in [https://github.com/LemonAppDev/konsist/pull/982](https://redirect.github.com/LemonAppDev/konsist/pull/982) - KON-612 Sample projects are using deprecated code by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1013](https://redirect.github.com/LemonAppDev/konsist/pull/1013) - KON-581 Remove konsist-starter- directory prefix in smaple projects by [@jibidus](https://redirect.github.com/jibidus) in [https://github.com/LemonAppDev/konsist/pull/1031](https://redirect.github.com/LemonAppDev/konsist/pull/1031) - Upd docs by [@igorwojda](https://redirect.github.com/igorwojda) in [https://github.com/LemonAppDev/konsist/pull/1177](https://redirect.github.com/LemonAppDev/konsist/pull/1177) - Add Snippet by [@igorwojda](https://redirect.github.com/igorwojda) in [https://github.com/LemonAppDev/konsist/pull/1194](https://redirect.github.com/LemonAppDev/konsist/pull/1194) ##### 🏗️ Maintanance - Fix CI jobs on macos-latest after github actions image migration by [@jibidus](https://redirect.github.com/jibidus) in [https://github.com/LemonAppDev/konsist/pull/1032](https://redirect.github.com/LemonAppDev/konsist/pull/1032) - KON-607 Update script and release snippets to kotlin documentation repo by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1014](https://redirect.github.com/LemonAppDev/konsist/pull/1014) - KON-266 Add Konsist test to check that none method has name containing "Some" by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1115](https://redirect.github.com/LemonAppDev/konsist/pull/1115) - KON-625 Create script to verify that all snippets with extension `.ktdoc` have valid Kotlin code by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1122](https://redirect.github.com/LemonAppDev/konsist/pull/1122) - KON-231 Add tests for KoParameterDeclaration using function parameters by [@nataliapeterwas](https://redirect.github.com/nataliapeterwas) in [https://github.com/LemonAppDev/konsist/pull/1238](https://redirect.github.com/LemonAppDev/konsist/pull/1238) **Full Changelog**: https://github.com/LemonAppDev/konsist/compare/v0.15.1...v0.16.0Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - "every 4 hour after 00:00 and before 23:59 every day" in timezone Asia/Tokyo.
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.