Skip to main content

#Precommit0 discussing

Hi, does anyone use pre-commit hooks to reorder XML files to minimize diffs down the pipeline ?  Do you have best practices crafted from this experience ?

 

#precommit #XML Reorder 

7 comments
  1. Sep 29, 2020, 5:21 PM
    @Rupert Barrow

    Our process is older (still using MDAPI) and a bit weird, but we end up doing a lot of things on a build server -- have jobs that retrieve the metadata from an org, then immediately format it before committing.

    I imagine a git pre-commit hook could work.

    You can also customize the SFDX CLI with command hooks, so perhaps you could implement a "postretrieve" command hook to sort and format the XML files as well. Good post here:

    https://developer.salesforce.com/blogs/2020/09/the-cli-and-salesforce-extensions.html
0/9000