简体   繁体   中英

Fix UnnecessaryGString violations in IntelliJ IDEA

When I analyzed my project using CodeNarc I get huge number of UnnecessaryGString violations.

I can fix them one by one by pressing ALT + ENTER and choosing Convert to String option. This is very tedious process though.

Is there any autofix in IntelliJ to replace all unncessary GStrings with Strings? If not, what do I need to do to create my own?

Currently I use error prone replacement from "([^$\n"]+)"(?!\() to '$1' . It gives some false positives on more complex cases (eg with escaping).

You can try use this tool and run it with --fix :

https://github.com/nvuillam/npm-groovy-lint

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM