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.15.1 #2529

Closed
wants to merge 1 commit into from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Mar 11, 2024

Mend Renovate

This PR contains the following updates:

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

Warning

Some dependencies could not be looked up. Check the Dependency Dashboard for more information.


Release Notes

LemonAppDev/konsist (com.lemonappdev:konsist)

v0.15.1

What's Changed

Restore layer validation

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

v0.15.0

What's Changed

1. Use Kotlin compiler kotlin-compiler-embeddable dependency

This release updates Kotlin compiler dependency to kotlin-compiler-embeddable reducing dependency conflicts and simplifying dependency management.

2. All all APIs accepting varargs now accept Kotlin collections (List and Set, etc.):
//  Existing API
Konsist
	.scopeFromFiles(path1, path2, path3)
    ...

//  Improved API (old API stil works)
val paths = setOf(path1, path2, path3) // listOf()
Konsist
	.scopeFromFiles(paths)
	...

⚠️ In next release bunch of deprecated methods will be removed, so make sure to bring you tests up to date.

💡 Improvements

Full Changelog: LemonAppDev/konsist@v0.14.0...v0.15.0

v0.14.0

What's Changed

⚠️ We are changing the deprecation strategy. Initially we wanted to deprecated API in 1.0.0, but this will be a big change, so instead we decided to follow more granular deprecation strategy to facilitate future upgrades. API with deprecation target for 1.0.0 has beed updated to 0.16.0 (#​902). From now on deprecated methods will be available for 2 minor versions (until 1.0.0 release). After 1.0.0 release Konsist will follow semantic versioning scheme meaning breaking changes will be introduced only when major version of the Konsist changes. Deprecated methods (with initial removal targeted for 1.0.0) will be removed in next release (deprecation target has bee updated). Please update your by removing Deprecated Konsist API to facilitate future migration.

Thanks you for your feedback 🙏

New Contributors

1. Added declaration references

Konsist understands the code's structure better. This new feature, highly requested by the community, provides link between declarations, giving you more control over code quality checks. Konsist now works with declarations directly, allowing you to precisely verify type properties, inheritance relationships, and more e.g.

All parent interfaces have actual modifier:

Konsist
    .scopeFromProject()
    .classes()
    .parentInterfaces()
    .assertTrue {
        it.hasActualModifier() // Can access other properties of the interface 
    }

All function parameters are interfaces:

Konsist
    .scopeFromPackage("com.app.worker..")
    .functions()
    .parameters
    .types
    .assertTrue {
        it.isInterface // Can 
    }

All classes have test classes with Test annotation and a name containing its name:

Konsist
   .scopeFromProject()
   .classes()
   .assertTrue {
       it.testClasses().all { testClass -> 
           testClass.hasAnnotationOf<Test>() && testClass.hasNameContaining(it.name)
       }
   }

All interfaces have children (child classes and child interfaces) resided in ..somepackage.. package:

Konsist
    .scopeFromProject()
    .interfaces()
    .assertTrue {
        it.hasAllChildren(indirectChildren = true) { child -> 
            child.resideInPackage("..somepackage..") 
        }
    }

See Declaration References docs.

2. Retrieve indirect parents

The indirectParents parameter has been added to parent retrieval methods (parents(), hasParentClass(), hasAllParentInterfacesOf etc.). This parameter specifies whether or not to include parents such as parent of the parent. By default, indirectParents is false e.g.

// Class hierarchy
ClassAClassBClassC

For above inheritance hierarchy is possible to retrieve direct parents of ClassC (ClassB) as well as all parents present in the codebase (ClassB and ClassC).

Konsist
	.scopeFromProject()
	.classes()
	.first { it.name == "ClassC" }
	.parents() // returns direct parents listOf(ClassB)

Konsist
	.scopeFromProject()
	.classes()
	.first { it.name == "SampleClass" }
	.parents(indirectParents = true) // returns listOf(ClassB, ClassA)
3. Improved assertArchitecture methods

Following other assert methods, we added the testName and additionalMessage arguments to the assertArchitecture methods.
You can now manually set the test name that will be displayed in the test failure message and used to suppress tests. This is useful for Kotest and dynamic tests.

scope
	.assertArchitecture(
		testName = "sample name",
		additionalMessage = "sample message"
	) {
		// some dependencies
	}
4. Added support for variables

Now Konsist will allow to access and verify variables located inside functions, init blocks, getters, setters and enum constants.

Konsist
	.scopeFromProject()
	.functions()
	.assertTrue { 
		it.hasVariable { variable -> 
			variable.name == "sampleVariable" 
			} 
		} 
5. Ability to check tacit type

Now Konsist can check whether the properties or variables have a tacit type. Tacit type means that the declaration has an explicitly or implicitly specified type.

val sut: Foo = someCollection.first() // hasTacitTypeOf(SampleClass::class) == true
val sut  = Foo("some text") // hasTacitTypeOf(SampleClass::class) == true
val sut = someCollection.first() // hasTacitTypeOf(SampleClass::class) == false

One scenario where tacit type is useful is verification of sut (system under test / class under test) existence:

        Konsist
            .scopeFromTest()
            .classes()
            .assertTrue {
                // Get type name from test class e.g. FooTest -> Foo
                val type = it.name.removeSuffix("Test")
                
                val sut = it
                    .properties()
                    .firstOrNull { property -> property.name == "sut" }

                    sut != null && sut.hasTacitType(type)
            }
6. Ability to check sourceType and bareSourceType

Now Konsist provides sourceType and bareSourceType properties for better type analysis:

val car: MyClass // sourceType == "MyClass".
val car: MyClass<String> // sourceType == "MyClass<String>"

val car: MyClass // bareSourceType == "MyClass".
val car: MyClass? // bareSourceType == "MyClass".
val car: MyClass<String> // bareSourceType == "MyClass"
val car: MyClass<String?>? // bareSourceType == "MyClass"
val car: com.app.MyClass // bareSourceType == "MyClass"

One scenario where bareSourceType is useful is naming verification of property with List type:

Konsist
    .scopeFromProject()
    .properties()
    .types
    .withBareSourceTypeOf(List::class)
    .assertTrue {
        it.hasNameEndingWith("s") || it.hasNameEndingWith("es")
    }     
7. Ability to check whether a property is read-only

Now Konsist provides isReadOnly property that checks whether a property is specified with a val modifier:

val foo = Foo("some text") // isReadOnly == true
var foo = Foo("some text") // isReadOnly == false

Complete list of changes

⚠️ Breaking API Changes
🐛 Bug Fixes
💡 Improvements
📕 Documentation
🏗️ CI
📦 Dependency Upgrade

Full Changelog: LemonAppDev/konsist@v0.13.0...v0.14.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 has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot requested a review from a team as a code owner March 11, 2024 16:25
@renovate renovate bot requested review from bmarty and removed request for a team March 11, 2024 16:25
@renovate renovate bot added the dependencies Pull requests that update a dependency file label Mar 11, 2024
@ganfra ganfra self-assigned this Mar 13, 2024
@renovate renovate bot force-pushed the renovate/com.lemonappdev-konsist-0.x branch from d6d37be to 3e61716 Compare April 1, 2024 12:55
@renovate renovate bot changed the title Update dependency com.lemonappdev:konsist to v0.14.0 Update dependency com.lemonappdev:konsist to v0.15.0 Apr 1, 2024
Copy link
Contributor

github-actions bot commented Apr 1, 2024

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/AFQvYP

@renovate renovate bot force-pushed the renovate/com.lemonappdev-konsist-0.x branch from 3e61716 to 5ca823a Compare April 2, 2024 14:06
@renovate renovate bot changed the title Update dependency com.lemonappdev:konsist to v0.15.0 Update dependency com.lemonappdev:konsist to v0.15.1 Apr 2, 2024
@renovate renovate bot force-pushed the renovate/com.lemonappdev-konsist-0.x branch from 5ca823a to 4448c1c Compare April 21, 2024 07:28
@ElementBot
Copy link
Collaborator

ElementBot commented Apr 21, 2024

Warnings
⚠️

Please add a changelog. See instructions here

Messages
📖 Sign-off not required, allow-list

Generated by 🚫 dangerJS against d40af68

@renovate renovate bot force-pushed the renovate/com.lemonappdev-konsist-0.x branch from 4448c1c to d40af68 Compare May 20, 2024 10:46
@bmarty bmarty closed this May 29, 2024
Copy link
Contributor Author

renovate bot commented May 29, 2024

Renovate Ignore Notification

Because you closed this PR without merging, Renovate will ignore this update (0.15.1). You will get a PR once a newer version is released. To ignore this dependency forever, add it to the ignoreDeps array of your Renovate config.

If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR.

@renovate renovate bot deleted the renovate/com.lemonappdev-konsist-0.x branch May 29, 2024 16:05
@bmarty bmarty mentioned this pull request May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants