Skip to content
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

Update dependency com.lemonappdev:konsist to v0.16.1 #172

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Oct 8, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
com.lemonappdev:konsist (source) 0.15.1 -> 0.16.1 age adoption passing confidence

Release Notes

LemonAppDev/konsist (com.lemonappdev:konsist)

v0.16.1

What's Changed

Hot fix release.

Complete list of changes

⚠️ Breaking API Changes
🐛 API Bug Fixes

Full Changelog: LemonAppDev/konsist@v0.16.0...v0.16.1

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:

// 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:

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

    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
🐛 API Bug Fixes
💡 API Improvements
📕 Documentation
🏗️ Maintanance

Full Changelog: LemonAppDev/konsist@v0.15.1...v0.16.0


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 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 was generated by Mend Renovate. View the repository job log.

@swapnil-musale swapnil-musale merged commit aa3f482 into development Oct 8, 2024
2 checks passed
@swapnil-musale swapnil-musale deleted the renovate/konsist branch October 8, 2024 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant