2

I'd like to auto format apex class/method/field names on pre-commit hook.

I'm looking for rules like PMD fieldnamingconventions but to be automatically formatted like Prettier can do. https://pmd.sourceforge.io/pmd-6.48.0/pmd_rules_apex_codestyle.html#fieldnamingconventions

I could use PMD or sfdx-scanner, but both just report the issue and don't fix it automatically. I could use Prettier apex plugin, but I couldn't find any config for naming conventions in the docs.

Is there some configuration for these tools or some different tool that can achieve this?

Thanks!

2
  • 1
    I haven't come across any such tool that can rename fields/methods but I agree it would be awesome if there is such tool.
    – metasync
    Commented Sep 14, 2022 at 16:16
  • This wouldn't be too hard to patch into Prettier, if you really wanted to. Prettier already has a --write option, you'd just need to patch the logic to fix the symbols. You won't find an option like that, because, as Prettier says, it is "An opinionated code formatter".
    – sfdcfox
    Commented Sep 14, 2022 at 16:40

0

You must log in to answer this question.

Browse other questions tagged .