Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build an editorconfig conformance tool around binary #20

Open
colindean opened this issue Dec 26, 2020 · 1 comment
Open

Build an editorconfig conformance tool around binary #20

colindean opened this issue Dec 26, 2020 · 1 comment

Comments

@colindean
Copy link
Owner

EditorConfig has a binary easily installed with Homebrew. This binary takes a path and splits out the config for that file. Build something around this and find or fd that

  • Takes some file names
  • Looks them up in editorconfig
  • Runs them through some scripts that
    • end_of_line: Convert line endings to whatever is specified
    • insert_final_newline: Inserts a newline if it doesn't end with one
    • charset: Convert to the desired charset
    • trim_trailing_whitespace: Remove if specified
    • and so on
  • Outputs a patch - it doesn't change the files on disk
  • Exits non-zero when any patch is output, because any input file has changes needed to conform
@colindean
Copy link
Owner Author

It'd be invoked something like fd . --absolute-path --exec editorconfig-changes {} or fd . --absolute-path | editorconfig - | editorconfig_check-for-patch.

editorconfig if given just one file spits out key=value pairs but spits out INI (may be TOML?) when given multiple files, in the format

[/home/colin/Source/something/pandoc-crossref.yaml]
end_of_line=lf
insert_final_newline=true
charset="utf-8"
trim_trailing_whitespace="false"
[/home/colin/Source/something/refs.bibtex]
end_of_line=lf
insert_final_newline=true
charset="utf-8"
trim_trailing_whitespace="false"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant