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

[Oztechan/CCC#1457] Update dependency com.lemonappdev:konsist to v0.17.2 #4090

Merged
merged 1 commit into from
Dec 7, 2024

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Nov 26, 2024

This PR contains the following updates:

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

Release Notes

LemonAppDev/konsist (com.lemonappdev:konsist)

v0.17.2

Complete List Of Changes

🐛 API Bug Fixes

v0.17.1

This release is focused on bug fixes and minor improvements.

Konsist 0.17.0 has accidentally changed layer dependency behaviour from "may depend on" to "has to depend on".

We have reverted this change and added a strict parameter to dependsOn method:

  • strict = false (default) - may depend on layer
  • strict = true - have to depend on layer
// Optional dependency - Feature layer may depend on Domain layer
featureLayer.dependsOn(domainLayer) // strict = false by default

// Required dependency - Feature layer must depend on Domain layer
featureLayer.dependsOn(domainLayer, strict = true)

Complete List Of Changes

🐛 API Bug Fixes
💡 API Improvements
🏗️ Maintenance

v0.17.0

First of all we have an exciting news - Konsist is the winner of the Kotlin Foundation Grants Program 2024 🎉.

We have been hearing you feedback, so this update bring many important improvements requested by the community.

This release bring bugs fixes and many API improvements as well as some groundwork for upcoming 1.0.0-Beta1 release.
Overall Kosnist API is quite stable now , so we don’t expect any more major API changes.

Big thanks goes to @​chrisbanes for the contributions.

Key changes

Improvement for Parent References (⚠️Breaking Change)

We enhanced parent references in the API to now support both examining the parent type declaration (enabling Konsist checks for annotations, modifiers, and other declaration properties) and analyzing actual parent usage details (such as inspecting generic type arguments) through separate access methods.

This is best demonstrated with the example:

Konsist
    .classes
    .withName("StringContainer")
    .assertTrue {
        it.parent.sourceDeclaration.hasModifier(KoModifier.PUBLIC) // previously it.parent.hasModifier
    }

This change allows to verify parent generic type arguments (parent use site).

Konsist
    .classes
    .withName("StringContainer")
    .assertTrue {
        it.typeArguments.flattern().contains { it.name == "String" }
    }
Added Support for Generic Type Arguments

This release bring top requested feature - support for generic types. Generic type parameters and type arguments can be now verified with Konsist.

Check Verifying Generics documentation page.

Source Declaration (⚠️Breaking Change)

API around source declarations has been unified. From property declaration, function declaration, function return type, parent
declaration, etc. it's possible to can access sourceDeclaration (declaration site) to get the actual type and verify it.

In this example we are checking if type of current property is a class declaration with internal modifier:

// Snippet
internal class Engine

val current: Engine? = null // testing this in below test

// Konsist test
Konsist
   .scopeFromProject()
   .properties
   .assertTrue {
      it.type?.sourceDeclaration?.asClassDeclaration()?.hasInnerModifier // true
   }

Note that explicit casting (asXDeclaration) has to be used to access specific properties of the declaration.

Due to updated API, some methods have been deprecated. For example, asClassDeclaration has been "moved to sourceDeclaration`:

Konsist
   .scopeFromProject()
   .functions()
   .returnTypes
   .assertTrue {
      it.asClassDeclaration() // Deprecated
         ?.hasPrivateModifier
   }
Konsist
   .scopeFromProject()
   .functions()
   .returnTypes
   .assertTrue {
      it.sourceDeclaration()
      ?.asClassDeclaration()
      ?.hasPrivateModifier
}
Improved Kotlin Backwards Compatibility

Konsist has been updated to ensure backward compatibility with Kotlin 1.8. This enhancement enables developers to integrate Konsist
into projects that haven't yet upgraded to the latest Kotlin version. By supporting Kotlin 1.8, Konsist can now be utilized in a wider
range of codebases, including those maintaining older Kotlin versions for various reasons. From now on Konsist should be compatible with
at least 3 most recent releases of Kotlin (does not take path releases into consideration). We will also slow down with updating minor
version of Kotlin to boost compatibility even more.

Language Reference Link

The Konsist Language reference was added.

API Improvements

Added isExtension:

// Snippet
fun String.sampleFunction() {}

// Konsist test
    Konsist
        .scopeFromProject()
        .functions()
        .assertTrue {
            it.isExtension shouldBeEqualTo true // true
        }

... and more.

Updated Architecture Assertions
  • Reimplemented assertArchitecture to fix few bugs.
  • Error handling has been improved to cover more edge cases for invalid architecture check configurations.
  • We have added new methods and improved validation and messaging around errors:
'Domain' layer does not depends on 'Presentation' layer failed. Files that depend on 'Presentation' layer:
	└──file /Users/igorwojda/domain/MyUseCase.kt
		├── import presentation.MyView.kt
		└── import presentation.MyUiState.kt

A new include() method was added to include layers in architecture verification, without defining a dependency.

private val domain = Layer("Domain",  "com.domain..")
private val presentation = Layer("Presentation", "com..presentation..")

Konsist
    .scopeFromProject()
    scope.assertArchitecture {
        presentation.include() // Include layer without defining a dependency
        domain.doesOnNothing()
    }
}
What's Next

We will now focus on adding baseline and processing community feedback.

Complete List Of Changes

⚠️ Breaking API Changes
🐛 API Bug Fixes
💡 API Improvements
💡 Improvements
📕 Documentation
🏗️ Maintenance

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.

@renovate renovate bot requested a review from mustafaozhan as a code owner November 26, 2024 04:27
@renovate renovate bot added the dependencies Pull requests that update a dependency file label Nov 26, 2024
@renovate renovate bot requested a review from a team as a code owner November 26, 2024 04:27
Copy link

codacy-production bot commented Nov 26, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (6be3d1d) 3254 1734 53.29%
Head commit (7207a67) 3254 (+0) 1734 (+0) 53.29% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4090) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Copy link

codecov bot commented Nov 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.41%. Comparing base (6be3d1d) to head (7207a67).
Report is 4 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4090   +/-   ##
========================================
  Coverage    56.41%   56.41%           
========================================
  Files          167      167           
  Lines         3021     3021           
  Branches       437      437           
========================================
  Hits          1704     1704           
  Misses        1292     1292           
  Partials        25       25           

Impacted file tree graph

@renovate renovate bot force-pushed the renovate/konsist branch from ff41c18 to a20c8c2 Compare November 30, 2024 21:40
@renovate renovate bot changed the title [Oztechan/CCC#1457] Update dependency com.lemonappdev:konsist to v0.17.0 [Oztechan/CCC#1457] Update dependency com.lemonappdev:konsist to v0.17.1 Dec 2, 2024
@renovate renovate bot force-pushed the renovate/konsist branch from a20c8c2 to 3857d81 Compare December 2, 2024 18:01
@renovate renovate bot force-pushed the renovate/konsist branch from 3857d81 to 7207a67 Compare December 5, 2024 02:37
@renovate renovate bot changed the title [Oztechan/CCC#1457] Update dependency com.lemonappdev:konsist to v0.17.1 [Oztechan/CCC#1457] Update dependency com.lemonappdev:konsist to v0.17.2 Dec 5, 2024
Copy link

sonarqubecloud bot commented Dec 5, 2024

@mustafaozhan mustafaozhan merged commit 4fdd2e2 into develop Dec 7, 2024
16 checks passed
@mustafaozhan mustafaozhan deleted the renovate/konsist branch December 7, 2024 22:08
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.

1 participant