{"id":21450621,"url":"https://github.com/typelevel/sbt-tpolecat","last_synced_at":"2026-02-07T16:05:56.586Z","repository":{"id":38356765,"uuid":"97763451","full_name":"typelevel/sbt-tpolecat","owner":"typelevel","description":"scalac options for the enlightened","archived":false,"fork":false,"pushed_at":"2025-10-10T01:03:57.000Z","size":438,"stargazers_count":403,"open_issues_count":20,"forks_count":54,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-10-23T02:58:48.177Z","etag":null,"topics":["compiler-options","sbt","sbt-plugin","scala"],"latest_commit_sha":null,"homepage":null,"language":"Scala","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/typelevel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-07-19T21:38:35.000Z","updated_at":"2025-10-12T16:32:13.000Z","dependencies_parsed_at":"2023-11-09T12:29:31.655Z","dependency_job_id":"b0130f18-aca2-4bf6-a70c-7b1ace6979d6","html_url":"https://github.com/typelevel/sbt-tpolecat","commit_stats":{"total_commits":298,"total_committers":35,"mean_commits":8.514285714285714,"dds":0.7651006711409396,"last_synced_commit":"82147f99baeec94d3aa54a5177b65da778ca7a99"},"previous_names":["davidgregory084/sbt-tpolecat"],"tags_count":39,"template":false,"template_full_name":null,"purl":"pkg:github/typelevel/sbt-tpolecat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelevel%2Fsbt-tpolecat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelevel%2Fsbt-tpolecat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelevel%2Fsbt-tpolecat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelevel%2Fsbt-tpolecat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typelevel","download_url":"https://codeload.github.com/typelevel/sbt-tpolecat/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelevel%2Fsbt-tpolecat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280872016,"owners_count":26405606,"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","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"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":["compiler-options","sbt","sbt-plugin","scala"],"created_at":"2024-11-23T04:16:00.703Z","updated_at":"2026-02-07T16:05:56.573Z","avatar_url":"https://github.com/typelevel.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"## sbt-tpolecat\n\n[![Continuous Integration](https://github.com/typelevel/sbt-tpolecat/actions/workflows/ci.yml/badge.svg)](https://github.com/typelevel/sbt-tpolecat/actions/workflows/ci.yml)\n[![License](https://img.shields.io/github/license/typelevel/sbt-tpolecat.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Latest Version](https://index.scala-lang.org/typelevel/sbt-tpolecat/sbt-tpolecat/latest.svg)](https://index.scala-lang.org/typelevel/sbt-tpolecat/sbt-tpolecat)\n\n### scalac options for the enlightened\n\nsbt-tpolecat is an SBT plugin for automagically configuring scalac options according to the project Scala version, inspired by Rob Norris ([@tpolecat](https://github.com/tpolecat))'s excellent series of blog posts providing [recommended options](https://tpolecat.github.io/2017/04/25/scalac-flags.html) to get the most out of the compiler.\n\nAs of version 0.1.11, it also supports setting options for Scala 3.x.\n\n### Usage\n\nAdd the following to your project's `project/plugins.sbt`:\n\n```scala\naddSbtPlugin(\"org.typelevel\" % \"sbt-tpolecat\" % \"0.5.2\")\n```\n\nOnce you are using this plugin we recommend that you don't manipulate the `scalacOptions` key directly.\n\nInstead you should modify the `tpolecatScalacOptions` key or the options key for the relevant mode, for example `tpolecatDevModeOptions` for the development mode.\n\n### Excluding specific warnings\n\nTo exclude an individual warning, say to ignore unused imports during testing, you can add the following to your configuration:\n\n```scala\nimport org.typelevel.scalacoptions.ScalacOptions\n\nTest / tpolecatExcludeOptions += ScalacOptions.warnUnusedImports\n```\n\nIf you would like to exclude more than one warning, you can add a `Set` of scalac options, like so:\n\n```scala\nimport org.typelevel.scalacoptions.ScalacOptions\n\nTest / tpolecatExcludeOptions ++= Set(\n  ScalacOptions.warnValueDiscard,\n  ScalacOptions.warnUnusedImports,\n  ScalacOptions.warnUnusedLocals\n)\n```\n\n### ScalaTest warnings\n\nOne of the options configured by **sbt-tpolecat** (`-Wnonunit-statement`) is designed to warn users about discarded values in their code.\n\nHowever, Scalatest assertions return a value of type `Assertion` by design, in order to support async testing.\n\nUnfortunately, this means that in synchronous test suites, every assertion discards this `Assertion` value, triggering the `-Wnonunit-statement` compiler warning.\n\nIf you find yourself in this situation, you can disable the `-Wnonunit-statement` option in your test suite like so:\n\n```scala\nimport org.typelevel.scalacoptions.ScalacOptions\n\nTest / tpolecatExcludeOptions += ScalacOptions.warnNonUnitStatement\n```\n\n### Configuring the REPL\n\nTo filter out scala compiler options that don't work well in the REPL, use the `tpolecatExcludeOptions`.\n\nBy default, the plugin only applies this filter to the `console` task in the `Compile` and `Test` configurations.\n\nFor example, to apply this filter to the `console` task in the `IntegrationTest` configuration you can do the following:\n\n```scala\nIntegrationTest / console / tpolecatExcludeOptions ++= ScalacOptions.defaultConsoleExclude\n```\n\n### Modes\n\nThis plugin can be used in several modes. The default mode is the continuous integration mode.\n\nModes can be selected by using mode switching commands, or by setting environment variables.\n\nWhen multiple mode-setting environment variables are defined, the most restrictive mode is selected. For example, if the `SBT_TPOLECAT_DEV` and `SBT_TPOLECAT_CI` variables are both defined, continuous integration mode will be enabled.\n\nYou can customise the default mode by modifying the `ThisBuild / tpolecatDefaultOptionsMode` key. Default is `CiMode`, and the available modes are `org.typelevel.sbt.tpolecat.{CiMode, DevMode, ReleaseMode, VerboseMode}`.\n\n#### Development mode\n\nTo enable the development mode, use the `tpolecatDevMode` command or define the environment variable `SBT_TPOLECAT_DEV`.\n\nIn this mode a baseline set of scala compiler options are enabled.\n\nYou can customise the options that are enabled in this mode by modifying the `tpolecatDevModeOptions` key. Default: `ScalacOptions.default`.\n\nFor example, to disable macros you could customise the development mode options as follows:\n\n```scala\ntpolecatDevModeOptions ~= { opts =\u003e\n  opts.filterNot(Set(ScalacOptions.languageExperimentalMacros))\n}\n```\n\nYou can customise the environment variable that is used to enable this mode by modifying the `ThisBuild / tpolecatDevModeEnvVar` key. Default: `\"SBT_TPOLECAT_DEV\"`.\n\n#### Verbose mode\n\nTo enable the verbose mode, use the `tpolecatVerboseMode` command or define the environment variable `SBT_TPOLECAT_VERBOSE`.\n\nIn this mode all development mode options are enabled, and several verbose options that are commonly used for debugging implicit resolution and providing detailed compile errors are enabled.\n\nYou can customise the options that are enabled in this mode by modifying the `tpolecatVerboseModeOptions` key. Default: `tpolecatDevModeOptions.value ++ ScalacOptions.verboseOptions`.\n\nFor example, to disable verbose implicit logging you could customise the verbose mode options as follows:\n\n```scala\ntpolecatVerboseModeOptions ~= { opts =\u003e\n  opts.filterNot(Set(ScalacOptions.verboseImplicits))\n}\n```\n\nYou can customise the environment variable that is used to enable this mode by modifying the `ThisBuild / tpolecatVerboseModeEnvVar` key. Default: `\"SBT_TPOLECAT_VERBOSE\"`.\n\n#### Continuous integration mode\n\nTo enable the continuous integration mode, use the `tpolecatCiMode` command or define the environment variable `SBT_TPOLECAT_CI`.\n\nIn this mode all development mode options are enabled, and the fatal warnings option (`-Xfatal-warnings` or `-Werror`, depending on the Scala version ) is added.\n\nYou can customise the options that are enabled in this mode by modifying the `tpolecatCiModeOptions` key. Default: `tpolecatDevModeOptions.value + ScalacOptions.fatalWarningOptions`.\n\nFor example, to disable unused linting you could customise the CI options as follows:\n\n```scala\ntpolecatCiModeOptions ~= { opts =\u003e\n  opts.filterNot(\n    ScalacOptions.privateWarnUnusedOptions ++\n      ScalacOptions.warnUnusedOptions\n  )\n}\n```\n\nYou can customise the environment variable that is used to enable this mode by modifying the `ThisBuild / tpolecatCiModeEnvVar` key. Default: `\"SBT_TPOLECAT_CI\"`.\n\n#### Release mode\n\nTo enable the release mode, use the `tpolecatReleaseMode` command or define the environment variable `SBT_TPOLECAT_RELEASE`.\n\nIn this mode all CI mode options are enabled, and the method-local optimisation option (`-opt:l:method`) is enabled if available for your Scala version.\n\nYou can customise the options that are enabled in this mode by modifying the `tpolecatReleaseModeOptions` key. Default: `tpolecatCiModeOptions.value + ScalacOptions.optimizerMethodLocal`.\n\nFor example, to enable inlining within your library or application's packages you could customise the release options as follows:\n\n```scala\ntpolecatReleaseModeOptions ++= ScalacOptions.optimizerOptions(\"your.library.**\")\n```\n\nTo understand more about the Scala optimizer read [The Scala 2.12 / 2.13 Inliner and Optimizer](https://docs.scala-lang.org/overviews/compiler-options/optimizer.html).\n\nYou can customise the environment variable that is used to enable this mode by modifying the `ThisBuild / tpolecatReleaseModeEnvVar` key. Default: `\"SBT_TPOLECAT_RELEASE\"`.\n\n### Caveat\n\nI can't promise this plugin will work for old minor releases of Scala.\n\nIt is currently tested with Scala 2.x releases:\n\n* 2.13.8\n* 2.12.16\n* 2.11.12\n\nand Scala 3.x releases:\n\n* 3.0.2\n* 3.1.3\n* 3.3.0\n* 3.3.1\n\n### Conduct\n\nParticipants are expected to follow the [Scala Code of Conduct](https://www.scala-lang.org/conduct/) while discussing the project on GitHub and any other venues associated with the project.\n\n### License\n\nAll code in this repository is licensed under the Apache License, Version 2.0.  See [LICENSE](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypelevel%2Fsbt-tpolecat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftypelevel%2Fsbt-tpolecat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypelevel%2Fsbt-tpolecat/lists"}