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

Implemented Kover Maven Plugin #654

Merged
merged 7 commits into from
Jul 18, 2024
Merged

Implemented Kover Maven Plugin #654

merged 7 commits into from
Jul 18, 2024

Conversation

shanshin
Copy link
Collaborator

Resolves #51

Copy link
Member

@ALikhachev ALikhachev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, LGTM. I will take a one more round of more close look later.

Do you have plans to extend test coverage? Not all possible configuration keys are covered, for example HtmReportMojo.title.

Am I right that the parameters you've exposed as parameters are the ones that are conventionally have global single value and most often are changed?

Comment on lines 97 to 101
extensions.configure<Kover_docs_conventions_gradle.KoverDocsExtension> {
docsDirectory.set("maven-plugin")
description.set("Kover Maven Plugin")
callDokkaHtml.set(false)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not like this? 🤔

Suggested change
extensions.configure<Kover_docs_conventions_gradle.KoverDocsExtension> {
docsDirectory.set("maven-plugin")
description.set("Kover Maven Plugin")
callDokkaHtml.set(false)
}
koverDocs {
docsDirectory.set("maven-plugin")
description.set("Kover Maven Plugin")
callDokkaHtml.set(false)
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, once upon a time, accessors were not generated for this and I copy the same everywhere

Comment on lines +39 to +41
* Binary reports that built in advance, before the start of the project build.
*
* It's convenient to use when tests are performed on CI on different nodes.
Copy link
Member

@ALikhachev ALikhachev Jul 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear by looking only at this doc, how it will be used and why I should provide it. Shall I review the KDocs now or for now you've put them mostly for yourself and going to improve in the future?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is worth at least a cursory read KDoc.
Additional files are provided only when necessary. That is, you need to merge the coverage with tests that are run on different machines.
Since the XML or HTML report cannot be merged, only ic files can be used for merging.

lateinit var binaryReportFile: File

override fun doExecute() {
val propertyName = agentPropertyName ?: Constants.AGENT_ARG_PARAMETER
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Elvis does not have effect on lateinit vars. Access to uninitialized var will throw a kotlin.UninitializedPropertyAccessException.
I see you handle this differently in your code, e.g. IcReportMojo.icFile is not checked at all
or AbstractCoverageTaskMojo.aggregate is not a lateinit var at all

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, it's a dead code

Comment on lines +85 to +87
tasks.collectRepository.get().repositories.forEach { repository ->
repository.copyRecursively(dir)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a hack that may stop working in the future. It's also incompatible with configuration cache

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think in another PR it is necessary to redo the work with local repositories

@shanshin
Copy link
Collaborator Author

Am I right that the parameters you've exposed as parameters are the ones that are conventionally have global single value and most often are changed?

Right, this was the basic idea, the single values that are most often same for all goals.

@shanshin
Copy link
Collaborator Author

shanshin commented Jul 16, 2024

Do you have plans to extend test coverage? Not all possible configuration keys are covered, for example HtmReportMojo.title.

Added extra tests. There are no HTML charset tests yet, but it looks like there is a small problem there.

@shanshin shanshin requested a review from ALikhachev July 16, 2024 19:16
kover-maven-plugin/docs/index.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
kover-maven-plugin/docs/index.md Outdated Show resolved Hide resolved

## Current limitations
- instrumentation of only tests in `test` goal is supported, `it-tests` tests are not supported yet
- if several Kover JVM agents are specified when running the tests, then only the first one will work
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if several Kover JVM agents are specified

Is it even possible to configure such thing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, now if you use site lifecycle, then initialization happens twice

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an example or detailed explanation is in order so users won't accidentally create such a configuration.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example is in site directory :)

In case of site lifecycle, it will not be possible to avoid such a configuration.

kover-maven-plugin/docs/index.md Outdated Show resolved Hide resolved
kover-maven-plugin/docs/index.md Show resolved Hide resolved
kover-maven-plugin/docs/index.md Outdated Show resolved Hide resolved
kover-maven-plugin/docs/index.md Show resolved Hide resolved
shanshin and others added 3 commits July 17, 2024 20:16
Co-authored-by: Leonid Startsev <sandwwraith@users.noreply.github.com>
Co-authored-by: Leonid Startsev <sandwwraith@users.noreply.github.com>
@shanshin shanshin requested a review from sandwwraith July 17, 2024 18:34
kover-maven-plugin/docs/index.md Outdated Show resolved Hide resolved
Co-authored-by: Leonid Startsev <sandwwraith@users.noreply.github.com>
@shanshin shanshin merged commit 1739cc5 into main Jul 18, 2024
@shanshin shanshin deleted the maven-plugin branch July 18, 2024 15:40
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.

Implement Kover Maven plugin
3 participants