{"id":16330960,"url":"https://github.com/ghik/zerowaste","last_synced_at":"2025-04-07T12:10:28.349Z","repository":{"id":65507728,"uuid":"529567048","full_name":"ghik/zerowaste","owner":"ghik","description":"Scala compiler plugin to detect unused expressions","archived":false,"fork":false,"pushed_at":"2025-03-19T18:21:25.000Z","size":98,"stargazers_count":65,"open_issues_count":0,"forks_count":12,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-31T11:04:19.142Z","etag":null,"topics":["compiler-plugin","purely-functional","scala","static-analysis"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ghik.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-08-27T11:34:42.000Z","updated_at":"2025-03-19T10:44:00.000Z","dependencies_parsed_at":"2024-02-15T09:25:32.231Z","dependency_job_id":"4c84545b-aa31-42b2-ad84-a13998a761b1","html_url":"https://github.com/ghik/zerowaste","commit_stats":{"total_commits":74,"total_committers":13,"mean_commits":"5.6923076923076925","dds":0.5,"last_synced_commit":"77217c7f8046bc4a56a272e1b3441eaf3dda7640"},"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghik%2Fzerowaste","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghik%2Fzerowaste/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghik%2Fzerowaste/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghik%2Fzerowaste/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghik","download_url":"https://codeload.github.com/ghik/zerowaste/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247648977,"owners_count":20972945,"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":["compiler-plugin","purely-functional","scala","static-analysis"],"created_at":"2024-10-10T23:25:03.147Z","updated_at":"2025-04-07T12:10:28.332Z","avatar_url":"https://github.com/ghik.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zerowaste\n\nScala compiler plugin to detect unused expressions (non-`Unit`).\n\nZerowaste is currently available for Scala 2.12.17+, 2.13.10+, 3.2.1+, 3.3.0+, and 3.4.0+\n\nCompiler plugins must be cross-built for every minor and patch version of Scala. If `zerowaste` is not available for a Scala version that you want to use (most likely some freshly released one), please file an issue or submit a PR.\n\n### How to submit a PR with a new Scala version\n\n1. Add your desired Scala version to `crossScalaVersions` in `build.sbt`\n1. Run `sbt githubWorkflowGenerate`\n1. Commit the changes in `build.sbt` and github workflows\n1. Submit a PR\n\n## Introduction\n\nPure functional programming operates under the principle that expressions are free from side-effects.\nSide-effects are instead handled through an IO-like type, such as Cats Effect's IO, and are only executed upon explicit,\nunsafe `runX` invocation, usually hidden somewhere in library code.\n\nAs a consequence, discarding a result of an expression in purely functional code can always be assumed to be a mistake, e.g.\n\n```scala\nval number = {\n  discardedExpression // pointless!\n  42\n}\n```\n\nThis is an easy mistake and it can lead to tricky bugs, such as when an important IO action is unintentionally discarded.\nThe Scala compiler cannot detect this issue as Scala is not a purely functional language and cannot assume all expressions are pure.\n\nThis plugin addresses this problem by reporting a warning for every discarded expression whose type is different than `Unit`.\n\n## Usage\n\nEnable the plugin in `build.sbt`:\n\n```scala\nlibraryDependencies += compilerPlugin(\"com.github.ghik\" % \"zerowaste\" % \"\u003cversion\u003e\" cross CrossVersion.full)\n```\n\nThe plugin issues warnings, but it is often a good idea to turn them into compilation errors:\n\n```scala\nscalacOptions += \"-Werror\"\n```\n\nNote that these warnings, despite being converted to errors, can be suppressed with the `@nowarn` annotation:\n\n```scala\nimport scala.annotation.nowarn\n\nval number = {\n  discardedExpression: @nowarn(\"msg=discarded expression\")\n  42\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghik%2Fzerowaste","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghik%2Fzerowaste","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghik%2Fzerowaste/lists"}