有没有办法在 Android Studio 的整个项目中自动修复所有可能的 lint 警告? [英] Is there a way to automatically fix all of the possible lint warnings in the whole project in Android Studio?

查看:78
本文介绍了有没有办法在 Android Studio 的整个项目中自动修复所有可能的 lint 警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想象一下,在正确设置 analysis_options.yaml 文件后,您有一个带有数千个 lint 警告的项目.现在你需要解决所有的混乱.手工完成这一切可能会花费您很多时间,而大多数问题都非常简单,例如var";代替final",双引号代替单引号等

Imagine you have a project with thousands of lint warnings after you set up analysis_options.yaml file properly. And now you need to fix all of the mess you have. Doing it all by hand can cost you a lot of time, while most of the issues are very simple like "var" instead of "final", double quotes instead of single, etc.

有什么方法可以让 Android Studio 自动修复所有最简单的 lint 警告,例如在终端中或通过运行任何特定命令的Prefer const with constant constructors"等?

Is there any way to make Android Studio automatically fix all of the easiest lint warnings like "Prefer const with constant constructors", etc. in terminal or by running any specific command?

推荐答案

首先在项目内做:dart fix --dry-run然后在它完成使用后:dart fix --apply

first within the project do : dart fix --dry-run then after it finish use : dart fix --apply

这篇关于有没有办法在 Android Studio 的整个项目中自动修复所有可能的 lint 警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆