{"id":37028523,"url":"https://github.com/cloudflightio/archunit-cleancode-verifier","last_synced_at":"2026-01-14T03:24:31.911Z","repository":{"id":45829868,"uuid":"514544808","full_name":"cloudflightio/archunit-cleancode-verifier","owner":"cloudflightio","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-11T09:22:30.000Z","size":150,"stargazers_count":3,"open_issues_count":2,"forks_count":2,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-01-02T02:08:52.163Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudflightio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-16T10:20:09.000Z","updated_at":"2024-06-11T09:22:35.000Z","dependencies_parsed_at":"2024-03-12T08:45:46.437Z","dependency_job_id":"685d7e31-3b75-4aad-9cb1-ed7c9d1fc45e","html_url":"https://github.com/cloudflightio/archunit-cleancode-verifier","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/cloudflightio/archunit-cleancode-verifier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflightio%2Farchunit-cleancode-verifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflightio%2Farchunit-cleancode-verifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflightio%2Farchunit-cleancode-verifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflightio%2Farchunit-cleancode-verifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudflightio","download_url":"https://codeload.github.com/cloudflightio/archunit-cleancode-verifier/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflightio%2Farchunit-cleancode-verifier/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408834,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T03:24:31.173Z","updated_at":"2026-01-14T03:24:31.901Z","avatar_url":"https://github.com/cloudflightio.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":" # CleanCode Verifiers powered by ArchUnit\n\n[![License](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Maven Central](https://img.shields.io/maven-central/v/io.cloudflight.cleancode.archunit/archunit-cleancode-verifier.svg?label=Maven%20Central)](https://search.maven.org/artifact/io.cloudflight.cleancode.archunit/archunit-cleancode-verifier)\n\n# Motivation \n\nStatic code analysis is important, and there exist plenty of great tools\nout there like FindBugs, PMD or Detekt.\n\nUnfortunately, all those rules have their limit, they are all not\nanalyzing the whole code base, but only class files in an isolated way.\n\nThis is where the great library [ArchUnit](https://github.com/TNG/ArchUnit) comes into \nthe game. This library uses ArchUnit and provides\na collection of `ArchRule`s which we consider best-practice\nat @cloudflightio. \n\nThose are grouped in:\n\n* [Extended Rules for the JDK](rules/jdk.md)\n* [Java Logging](rules/logging.md)\n* [Java Persistence Framework (JPA)](rules/jpa.md)\n* [Spring Framework (including Transcations \u0026 Spring Data)](rules/spring.md)\n* [Spring Boot](rules/springboot.md)\n\n# Usage\n\nUsing this library is simple. First add it as dependency\nto your test-scope, in Gradle that would be\n\n````groovy\ndependencies {\n    testImplementation(\"io.cloudflight.cleancode.archunit:archunit-cleancode-verifier:\u003cversion\u003e\")\n}\n````\n\nUse the latest version as seen in the badge on top of this page instad of `\u003cversion\u003e`.\n\nThen create a unit-test like this (the notation is Kotlin, but it also works with plain Java):\n\n````kotlin\nimport com.tngtech.archunit.junit.AnalyzeClasses\nimport com.tngtech.archunit.junit.ArchTest\nimport com.tngtech.archunit.junit.ArchTests\nimport io.cloudflight.cleancode.archunit.CleanCodeRuleSets\n\n@AnalyzeClasses(packagesOf = [\"io.cloudflight.sample\"])\nclass ArchitectureTest {\n\n    @ArchTest\n    val cleancode = ArchTests.`in`(CleanCodeRuleSets::class.java)\n}\n````\n\nChange the package in the `AnalyzeClasses` annotation accordingly. \n\nThat's it. Run the test now. `CleanCodeRuleSets` will automatically pick up\nall tests that might be for relevance for you, i.e. JPA-related tests \nwill only be executed if you have JPA on your classpath.\n\n# How it works\n\nBehind the scenes, we are using an own implementation of \nArchUnit's `ViolationStore` in order to achieve a slightly different behaviour\nof [Freezing Arch Rules](https://www.archunit.org/userguide/html/000_Index.html#_freezing_arch_rules).\n\nWhen you run the test the first time, you will find a file\n`archunit_store/knownCleanCodeRules.txt` in your module.\nIt contains all rules that have been evaluated. Add this file to your VCS.\n\nIn case your code violates any of the rules, you will find additional files\nwith the name of the rule inside that folder. Add those to your VCS as well.\n\n* Your initial violations will be frozen not be reported. If you fix your violations,\nthey will be automatically removed from those files. \n* If the file is empty, the file is deleted\n* If you only have the `knownCleanCodeRules.txt` in your `archunit_store` folder, you're free from violations. Congrats!\n* If you wanna fix all violations immediately, remove all files but the `knownCleanCodeRules.txt`. ArchUnit will then raise errors for each of them. \n* If you want to refreeze all violations, add `freeze.refreeze=true` to your `archunit.properties` as explained in the [documentation](https://www.archunit.org/userguide/html/000_Index.html#_configuration)\n\nYou can also ignore rules entirely with [standard functionality of ArchUnit](https://www.archunit.org/userguide/html/000_Index.html#_ignoring_violations):\nCreate a file called `archunit_ignore_patterns.txt` in `src/test/resources` and add regular expressions\ncontaining the names of the rules that you want to ignore (not only for existing code but also for all future code).\n\nIf finally violations are being reported, then you will see errors like that:\n\nSuppose you have an entity like that:\n\n````kotlin\n@Entity\ninternal class Project(\n\n    val name: String,\n\n) : AbstractEntity() { // contains @Id\n\n}\n````\n\nThis violates the rule [Kotlin nullability should match JPA nullability](https://github.com/cloudflightio/archunit-cleancode-verifier/blob/v0.0.3/rules/jpa.md#user-content-nullable-flag-of-kotlin-needs-to-match-jpa-specification) and\nin the log you will see something like this:\n\n````text\njava.lang.AssertionError: Architecture Violation [Priority: MEDIUM] - Rule 'classes that are kotlin classes and are JPA Entity classes should have only members where the nullable flag of kotlin matches the JPA column specification, because https://github.com/cloudflightio/archunit-cleancode-verifier/blob/v0.0.3/rules/jpa.md#user-content-nullable-flag-of-kotlin-needs-to-match-jpa-specification' was violated (1 times):\n[io.cloudflight.tracker.domain.entity.Project]: name is nullable in the DB, but the kotlin field is not nullable\n\tat com.tngtech.archunit.lang.ArchRule$Assertions.assertNoViolation(ArchRule.java:110)\n\tat com.tngtech.archunit.lang.ArchRule$Assertions.check(ArchRule.java:98)\n\n````\n\nClick on the link there and get to a detailled description of the violation including code samples. We believe\nit's important for developers to understand the background of such issues and that usually can't be placed\ninto a single short String.\n\n# Requirements\n\nThis library requires at least JDK 17 and it is built on top of Spring Boot 3 and Jakarta EE 9","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflightio%2Farchunit-cleancode-verifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudflightio%2Farchunit-cleancode-verifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflightio%2Farchunit-cleancode-verifier/lists"}