Howto setup file-contents-sorter
See original GitHub issueYou maybe aware of the encryption tool StackExchange/blackbox
It tracks the encrypted files in keyrings/live/blackbox-files.txt
. This file soon-ish gets a merge mess up when worked on collaboratively because the tool sorts it when adding new files. Therefore, I wanted to make use of file-contents-sorter
.
However, I am a bit stuck with configuring it properly. I tried many combinations. The union of all and what I consider most reasonable is
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.1.0
hooks:
- id: file-contents-sorter
verbose: true
files: 'blackbox\-files\.txt$'
args: ['./keyrings/live/blackbox-files.txt']
Can you please direct me to the right solution here? Thanks. 💟
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
how to use pre-commit hook to sort a csv file - Stack Overflow
I found this pre-commit hook file-contents-sorter which sorts the file with the first value. repos: - repo: https://github.com/pre-commit/pre- ...
Read more >How to sort file contents in reverse order in Ubuntu - YouTube
How to sort file contents in reverse order in Ubuntu. 197 views 6 years ago ... Getting started with Ansible 02 - SSH...
Read more >Using Bash Sort to Sort Files Like a Boss - Adam the Automator
The sort command sorts file contents depending on the flag you'll be adding. But first, you need a file with contents you'll modify....
Read more >How to Use the Bash Sort Command - Linux Hint
The Bash sort command is used to sort a file's content and give output in the stdout. With sort, you can sort a...
Read more >Supported hooks - pre-commit
python-import-sorter - This hook sorts python imports. ... github.com/asottile/setup-cfg-fmt. setup-cfg-fmt - apply a consistent format to `setup.cfg` files ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the ping @asottile. @xasx - we’ve been using it for the same thing you’re looking for: to sort files that are kinda generic lists to reduce merge conflicts.
Specifically, here’s one example of its entry in a .pre-commit-config.yaml in a production service repository:
looks close – I think the way to configure it (read:I haven’t used it myself so I’m just basing this on the config) is as follows:
CC @dan98765 who might have a concrete example of using this hook somewhere