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

Test maven plugin #1792

Closed
6 tasks done
nulls opened this issue Nov 13, 2023 · 2 comments · Fixed by #1823
Closed
6 tasks done

Test maven plugin #1792

nulls opened this issue Nov 13, 2023 · 2 comments · Fixed by #1823
Assignees
Milestone

Comments

@nulls
Copy link
Member

nulls commented Nov 13, 2023

Create a simple project on maven and configure maven plugin for diktat with version 2.0.0-rc.8

Todo:

  • Add example with multimodules
  • Test a single module
  • Test multi module
  • Test githubActions via -Ddiktat.githubActions=true
  • Test two reporters: plain configured via configuration and githubActions configured via environment variable (blocked by Support multiple reporters in Maven #1818)
    Test scenario:
  1. Configure reporters:
<configuration>
    <diktatConfigFile>diktat-analysis.yml</diktatConfigFile>
    <inputs>
        <input>${project.basedir}/src/main/kotlin</input>
    </inputs>
    <reporters>
        <plain/>
        <json>
                <output>${project.built.directory}/some-folder/some-file.json</output>
        </json>
        <checkstyle/>
    </reporters>
</configuration>
  1. Run diktat check and validate that diktat generates 3 reports: plain to stdout, json to some specific file and checkstyle (xml) to default location target/reports/diktat/diktat.xml
  2. Run diktat check with environment variable githubActions and validate that diktat generates 4 reports: plain to stdout, json to some specific file, checkstyle (xml) to default location target/reports/diktat/diktat.xml and sarif report to default location target/reports/diktat/diktat.sarif
  3. Add configuration for gitHubActions to reporters:
    <reporters>
        <gitHubActions/>
        <plain/>
        <json>
                <output>${project.built.directory}/some-folder/some-file.json</output>
        </json>
        <checkstyle/>
    </reporters>

And validate that diktat generates 4 reports with and without environment variable githubActions

Found issues:

@nulls nulls added this to the 2.0.0 milestone Nov 13, 2023
@orchestr7
Copy link
Member

We already should have a simple maven project in our repo in examples

@nulls nulls assigned DrAlexD and unassigned diphtongue Nov 21, 2023
@nulls
Copy link
Member Author

nulls commented Nov 27, 2023

How to build snapshot version of plugin:
gradlew.bat :diktat-api:publishToMavenLocal :diktat-common:publishToMavenLocal :diktat-rules:publishToMavenLocal :diktat-ktlint-engine:publishToMavenLocal :diktat-runner:publishToMavenLocal :diktat-maven-plugin:publishToMavenLocal

This command builds and uploads a snapshot version to maven local repository.
Version is printed in logs:

Reckoned version: 2.0.0-rc.8.113+6211a81

DrAlexD added a commit that referenced this issue Nov 27, 2023
### What's done:
- updated `diktat-analysis.yml` files for all examples.
- added multi-module maven example.
- tested single-module and multi-module maven examples.
- tested githubActions via `-Ddiktat.githubActions=true`.
- tested reporters.

Closes #1792
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 a pull request may close this issue.

4 participants