Gradle配置lintOptions

lint檢查對於app來講也是很重要的,能夠檢查出不少問題。 
lint配置 
從stackoverflow上扒了一個配置。html

 
  1. android {android

  2. lintOptions {app

  3. // true--關閉lint報告的分析進度gradle

  4. quiet trueui

  5. // true--錯誤發生後中止gradle構建code

  6. abortOnError falsexml

  7. // true--只報告errorhtm

  8. ignoreWarnings true文檔

  9. // true--忽略有錯誤的文件的全/絕對路徑(默認是true)get

  10. //absolutePaths true

  11. // true--檢查全部問題點,包含其餘默認關閉項

  12. checkAllWarnings true

  13. // true--全部warning當作error

  14. warningsAsErrors true

  15. // 關閉指定問題檢查

  16. disable 'TypographyFractions','TypographyQuotes'

  17. // 打開指定問題檢查

  18. enable 'RtlHardcoded','RtlCompat', 'RtlEnabled'

  19. // 僅檢查指定問題

  20. check 'NewApi', 'InlinedApi'

  21. // true--error輸出文件不包含源碼行號

  22. noLines true

  23. // true--顯示錯誤的全部發生位置,不截取

  24. showAll true

  25. // 回退lint設置(默認規則)

  26. lintConfig file("default-lint.xml")

  27. // true--生成txt格式報告(默認false)

  28. textReport true

  29. // 重定向輸出;能夠是文件或'stdout'

  30. textOutput 'stdout'

  31. // true--生成XML格式報告

  32. xmlReport false

  33. // 指定xml報告文檔(默認lint-results.xml)

  34. xmlOutput file("lint-report.xml")

  35. // true--生成HTML報告(帶問題解釋,源碼位置,等)

  36. htmlReport true

  37. // html報告可選路徑(構建器默認是lint-results.html )

  38. htmlOutput file("lint-report.html")

  39. // true--全部正式版構建執行規則生成崩潰的lint檢查,若是有崩潰問題將中止構建

  40. checkReleaseBuilds true

  41. // 在發佈版本編譯時檢查(即便不包含lint目標),指定問題的規則生成崩潰

  42. fatal 'NewApi', 'InlineApi'

  43. // 指定問題的規則生成錯誤

  44. error 'Wakelock', 'TextViewEdits'

  45. // 指定問題的規則生成警告

  46. warning 'ResourceAsColor'

  47. // 忽略指定問題的規則(同關閉檢查)

  48. ignore 'TypographyQuotes'

  49. }

  50. }

  • 1
相關文章
相關標籤/搜索