{"id":16558459,"url":"https://github.com/zacsweers/redacted-compiler-plugin","last_synced_at":"2025-11-21T00:06:37.786Z","repository":{"id":38208307,"uuid":"125680582","full_name":"ZacSweers/redacted-compiler-plugin","owner":"ZacSweers","description":"A Kotlin compiler plugin that generates redacted toString() implementations.","archived":false,"fork":false,"pushed_at":"2025-05-06T18:16:12.000Z","size":1207,"stargazers_count":415,"open_issues_count":4,"forks_count":27,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-13T13:00:24.256Z","etag":null,"topics":["codegen","compiler","compiler-plugin","kotlin"],"latest_commit_sha":null,"homepage":"","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/ZacSweers.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null}},"created_at":"2018-03-18T00:35:50.000Z","updated_at":"2025-05-12T13:28:57.000Z","dependencies_parsed_at":"2023-10-17T01:47:50.980Z","dependency_job_id":"c2326d88-8757-4770-81c5-738ef53f1bbe","html_url":"https://github.com/ZacSweers/redacted-compiler-plugin","commit_stats":{"total_commits":303,"total_committers":9,"mean_commits":"33.666666666666664","dds":"0.47854785478547857","last_synced_commit":"a6d909fc00e4a9404013e10e1226a9344d882a4e"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZacSweers%2Fredacted-compiler-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZacSweers%2Fredacted-compiler-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZacSweers%2Fredacted-compiler-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZacSweers%2Fredacted-compiler-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZacSweers","download_url":"https://codeload.github.com/ZacSweers/redacted-compiler-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254414497,"owners_count":22067272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["codegen","compiler","compiler-plugin","kotlin"],"created_at":"2024-10-11T20:10:48.372Z","updated_at":"2025-11-21T00:06:37.740Z","avatar_url":"https://github.com/ZacSweers.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"redacted-compiler-plugin\n========================\n\nA multiplatform Kotlin compiler plugin that generates redacted `toString()` implementations.\n\nInspired by the [`auto-value-redacted`](https://github.com/square/auto-value-redacted) extension for AutoValue.\n\n## Usage\n\nInclude the gradle plugin in your project, define a `@Redacted` annotation, and apply it to any\nproperties that you wish to redact.\n\n```kotlin\n@Retention(SOURCE)\n@Target(PROPERTY)\nannotation class Redacted\n\ndata class User(val name: String, @Redacted val phoneNumber: String)\n```\n\nWhen you call `toString()` any `@Redacted` properties are hidden:\n\n```\nUser(name=Bob, phoneNumber=██)\n```\n\nIf your annotation is applied to the class, then `toString()` will emit a single replacement string:\n\n```kotlin\n@Retention(SOURCE)\n@Target(CLASS)\nannotation class Redacted\n\n@Redacted\ndata class SensitiveData(val ssn: String, val birthday: String)\n```\n\n```\nSensitiveData(██)\n```\n\n## Installation\n\nApply the gradle plugin.\n\n```gradle\nplugins {\n  id(\"dev.zacsweers.redacted\") version \u003cversion\u003e\n}\n```\n\nAnd that's it! The default configuration will add the multiplatform `-annotations` artifact (which has a\n`@Redacted` annotation you can use) and wire it all automatically. Just annotate what you want to\nredact.\n\nYou can configure custom behavior with properties on the `redacted` extension.\n\n```kotlin\nredacted {\n  // Define custom annotations. The -annotations artifact won't be automatically added to\n  // dependencies if you define your own!\n  // Note that these must be in the format of a string where packages are delimited by '/' and\n  // classes by '.', e.g. \"kotlin/Map.Entry\"\n  redactedAnnotations.add(\"dev/zacsweers/redacted/annotations/Redacted\") // Default\n\n  // Define custom unredacted annotations.\n  unredactedAnnotations.add(\"dev/zacsweers/redacted/annotations/Unredacted\") // Default\n\n  // Define whether this plugin is enabled on this compilation. Useful if you want to\n  // gate this behind a dynamic build configuration.\n  enabled = true // Default\n\n  // Define a custom replacement string for redactions.\n  replacementString = \"██\" // Default\n}\n```\n\nSnapshots of the development version are available in [Sonatype's `snapshots` repository][snapshots].\n\n## Supported platforms\n\nThe compiler plugin itself supports all multiplatform project types. The first-party annotations artifact is also\nmultiplatform and supports all common JVM, JS, and native targets.\n\n## IDE Support\n\nFIR diagnostics can render in the IDE under the following conditions:\n\n1. The K2 Kotlin IDE plugin must be enabled.\n2. The IntelliJ `kotlin.k2.only.bundled.compiler.plugins.enabled` registry key must be set to `false`.\n\n## Caveats\n\n- Kotlin compiler plugins are not a stable API! Compiled outputs from this plugin _should_ be stable,\nbut usage in newer versions of kotlinc are not guaranteed to be stable.\n\n\n## Advanced Usage\n\nIn situations where it is desirable to redact everything and opt-out on certain properties,\ntwo options are provided:\n\n**Class redaction**\n\nFor one-off classes that may contain a large number of fields that should be redacted, you can augment the `@Redacted`\nclass behavior:\n\n```kotlin\n@Redacted\ndata class User(@Unredacted val name: String, val phoneNumber: String, val ssn: String)\n```\n\n```\nUser(name=Bob, phoneNumber=██, ssn=██)\n```\n\n**Supertype redaction**\n\nFor situations where you need to enforce that an API only accepts redacted inputs, you can apply `@Redacted` to a\nparent interface.\n\n```kotlin\n@Redacted\ninterface RedactedObject\n\ndata class User(@Unredacted val name: String, val phoneNumber: String, val ssn: String) : RedactedObject\n```\n\n```\nUser(name=Bob, phoneNumber=██, ssn=██)\n```\n\nLicense\n-------\n\n    Copyright (C) 2018 Zac Sweers\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       https://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n [snapshots]: https://oss.sonatype.org/content/repositories/snapshots/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzacsweers%2Fredacted-compiler-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzacsweers%2Fredacted-compiler-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzacsweers%2Fredacted-compiler-plugin/lists"}