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

Add more integration tests to check Diktat compatibility with KtLint #1569

Open
0x6675636b796f75676974687562 opened this issue Nov 16, 2022 · 3 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@0x6675636b796f75676974687562
Copy link
Member

0x6675636b796f75676974687562 commented Nov 16, 2022

Update: we already have Gradle plug-in tests available under diktat-gradle-plugin/src/functionalTest/,

so the primary focus of this task is the Spotless plug-in (see below).

Diktat Gradle plug-in

Probably DiktatJavaExecTaskTest, feel free to suggest a different test class name.

  1. Check that the plug-in is indeed executed and reports errors (i. e. ./gradlew diktatCheck) against invalid input should produce errors from diktat-ruleset namespace.
    • plain reporter
    • sarif reporter
  2. Check that KtLint-standard rules are indeed excluded, i. e. none of the errors from the standard or experimental namespaces are triggered by the invalid input (be sure to also disable the corresponding Diktat rules via diktat-analysis.yml). This test should fail if changes from Add experimental, test, and custom to the list of ignored rule set ids #1568 are temporarily rolled back.

Spotless Gradle plug-in

  1. Check that diffplug/spotless, when run as a Gradle plug-in with the snapshot Diktat version, produces expected errors and has no regressions like NoSuchMethodError: void KtLint$ExperimentalParams.<init>() when running spotlessCheck or spotlessApply #1559.
    • plain reporter
    • sarif reporter

Basically, we need a test which would, one way or another, launch a forked JVM against a test project, something we do in DiktatSmokeTest.

At the same time, I'd vote against using save-cli for this purpose and instead look for smth similar to khmarbaise/maven-it-extension for JUnit 5, for two reasons:

  • save-cli takes a long time to download over a slow network,
  • a forked JVM is much easier to debug in case of test failures.

@petertrr, @nulls, WDYT?

@0x6675636b796f75676974687562 0x6675636b796f75676974687562 added the bug Something isn't working label Nov 16, 2022
@nulls
Copy link
Member

nulls commented Nov 16, 2022

we need also test spotless maven plugin

@petertrr
Copy link
Member

Sounds reasonable; our functionalTest for Gradle plugin can be enhanced to run different scenarios as well as projects with spotless plugin using Gradle testkit.

@nulls
Copy link
Member

nulls commented Apr 7, 2023

Depends on saveourtool/save-cli#521

@nulls nulls modified the milestones: 2.0.0, 2.1.0 Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants