【问题标题】:How to skip running scalafmt on test code?如何跳过在测试代码上运行 scalafmt?
【发布时间】:2019-04-07 17:50:26
【问题描述】:

Scalafmt official plugin:

addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.5.1")

似乎没有提供任何设置来禁用对测试代码运行检查。有一个非官方的neo-sbt-scalafmt 有一个设置scalafmtTestOnCompile,但它似乎不再维护了。

有没有办法使用官方插件跳过在测试代码上运行 scalafmt?

【问题讨论】:

    标签: scala sbt sbt-plugin


    【解决方案1】:

    将此添加到您的 scalafmt.conf 中

    project.excludeFilters = [
      com.xxx.test
    ]
    

    【讨论】:

    • 其实我发现默认排除了test文件夹。此外,您假设有一个用于测试代码的特殊包,但通常情况并非如此。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-25
    • 1970-01-01
    • 2020-01-25
    • 1970-01-01
    • 2015-03-30
    相关资源
    最近更新 更多