- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我已经阅读了很多关于 StopShip
Android Lint Check 和 Gradle 支持的内容
我想使用 SO 中的一些人已经提到的,而不是 TODO 或 FIXME 注释,使用它来确保用于开发/调试/测试的代码块不会到达生产环境。
为此,我想做两件事:- 启用 StopShip 检查,因为默认情况下它是禁用的- 将严重性从警告(默认)更改为错误
(假设我们在我们的 gradle 配置中使用了 abortOnError true
)。
我没能做到这一点!无论我尝试什么,如果我在代码中添加 //STOPSHIP
注释,android 构建都不会失败。这很奇怪,因为在文本编辑器中它突出显示为错误,如果我运行 Lint 检查(分析 > 检查代码...)它被列为问题之一。
这是我在我的 build.gradle
lintOptions {
checkReleaseBuilds true
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError true
enable 'StopShip'
error 'StopShip'
}
我还尝试在"file">“设置”>“项目设置”>“检查”(或 Android Studio >“首选项”>“Mac 上的检查”)中更改我的 Android Studio 首选项。在这里,我检查了 Code contains STOPSHIP marker
并将严重性更改为错误,但仍然没有。
这是我的 lint.xml
的样子:
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="BackButton" severity="warning" />
<issue id="EasterEgg" severity="warning" />
<issue id="FieldGetter" severity="warning" />
<issue id="IconExpectedSize" severity="warning" />
<issue id="RtlCompat" severity="error" />
<issue id="RtlEnabled" severity="warning" />
<issue id="RtlHardcoded" severity="warning" />
<issue id="SelectableText" severity="warning" />
<issue id="StopShip" severity="error" />
<issue id="TypographyQuotes" severity="warning" />
<issue id="UnusedIds" severity="warning" />
</lint>
最佳答案
我终于破解了! 致命的“StopShip”
。终于做到了!留下我的发现,以防它对任何人有帮助。
在我的 build.gradle
配置中用 fatal 'StopShip'
替换 error 'StopShip'
解决了这个问题。
我不完全理解为什么我之前尝试使用error 'StopShip'
失败,因为 abortOnError docs明确说明:
Whether lint should set the exit code of the process if errors are found
我将 StopShip
检查严重性标记为错误。看起来 abortOnError
只会让 Gradle 构建因 fatal error 而中止。谁能证实一下?
当然,如果有人提供更好的解决方案/解释,请分享。
关于android - 如何使用 Lint Option StopShip 使 Grade 发布构建失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33504186/
PHPLint、JSLint,我最近在阅读一些IDE. 那么,什么是“linting”? 最佳答案 Linting 是运行程序的过程,该程序将分析代码是否存在潜在错误。 参见lint在维基百科上: l
Elixir是否有 Lint (如Javascript)可以检查每个函数是否具有类型规范? 最佳答案 有一个Erlang编译器开关+warn_missing_spec可以做到这一点,但是目前我无法使其
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 5 年前。 Improve this qu
例如,我让它在 .rb 和 .js 文件上匹配。 例如**/*.{js,rb} 并且还想在 Gemfile 和 Rakefile 上进行匹配。 最佳答案 解决方案是递归地使用 {},例如 "lin
我有一个自述文件,其中包含文件夹的文档、包含的库以及如何使用它们。 自述文件不是任何库的一部分,因此 nx-lint 会引发此错误: NX ERROR The following file(s
我的 React Native 构建突然失败并出现错误,尽管一天前工作得很好,没有任何相关的更改。 FAILURE: Build failed with an exception. * What we
我有一个 lint-gradle-api.jar 错误,我在论坛上查看了其他类似的问题,但我仍然有问题。有人有想法吗? Error running Gradle: Exit code 1 from:
我已经将 Android Studio 更新到 3.2.1,现在停止了这样的问题:找不到 lint-gradle-api.jar (com.android.tools.lint:lint-gradle
我目前正在从 tslint 迁移到 eslint。我在我的 .eslintignore 中配置了几个文件夹,我想从 linting 中完全忽略它们。这确实有效,但现在我收到错误: “无效的 lint
Q (tldr;): 我如何使用 android-lint 中的 JavaScanner 检查特定函数调用是否具有特定作为参数的字符串已被 try/catch block 包围。 详细信息:我已经完成
我有一个在 Cocoapods 上发布的库。 当我运行pod lib lint时从包含 MyProject.podspec 的目录中,命令行挂起 $ pod lib lint -> MyProject
我正在尝试使用 Android lint 来检查有关我的项目的一些事情。它似乎忽略了我提供的 lint.xml 文件,使我无法启用检查。 我在 Ubuntu 14.04 上使用 Android Stu
我正在使用工具栏附带的 CodeMirror 设计一个应用程序。由于性能原因,我没有通过异步或异步模式执行 lint。 我在工具栏中提供了一个图标,单击它我正在解析和构建错误。但是我对如何在编辑器中更
使用 ./gradlew lintDebug 生成 Android lint 报告时,报告中不包括 javac lint 错误,例如弃用或未经检查的转换。 我目前只是在编译时启用这些 javac 选项
默认情况下,在 gradle 中为发布构建启用了 lint。没有 abortOnError false 此选项会中止构建。 我的发布构建成功执行(没有 lint 警告),但是当我通过 gradle 调
我有一个使用 Android 构建工具版本 1.3.1 的 gradle Android 构建,并对我的代码运行 lint 检查。运行 Sonar 任务(由 org.sonarqube gradle
只是想知道是否有人可以帮助我进行 Gulp 设置。目前我正在使用 gulp-sass 和 gulp-scss-lint 进行监视任务。我想要发生的是,当为 linting 任务完全运行保存一个 scs
我正在做一个项目,最近更新到 android Gradle 构建工具 3.0.0 (com.android.tools.build:gradle:3.0.0)。我现在在通过 Android studi
我有一个带有 gradle 的 Android 项目。虽然 gradle 插件是 2.x.x,但运行 ./gradlew lint 的时间大约为 4 分钟。我已经将项目升级到 gradle plugi
事情是这样的。我有一个与 API 15 及更高版本兼容的应用程序,但由于它非常大并且我已经达到 65k 方法限制,我不得不将它设为 MultiDexApplication 类的后代。这会稍微减慢构建时
我是一名优秀的程序员,十分优秀!