4

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 (e.g. with escaping).

Michal Kordas
  • 10,475
  • 7
  • 58
  • 103

1 Answers1

0

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

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

xuanyue
  • 1,368
  • 1
  • 17
  • 36