{"id":23152712,"url":"https://github.com/frerich/filter_formatter","last_synced_at":"2025-06-12T09:39:25.373Z","repository":{"id":183801373,"uuid":"670795218","full_name":"frerich/filter_formatter","owner":"frerich","description":"A 'mix format' plugin invoking external filter command line tools","archived":false,"fork":false,"pushed_at":"2024-02-26T22:06:34.000Z","size":32,"stargazers_count":8,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-09-16T18:09:49.723Z","etag":null,"topics":["elixir","elixir-lang"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/frerich.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-25T21:22:21.000Z","updated_at":"2024-08-20T20:20:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"92278d30-04e6-412a-ad33-73ad91fa42e3","html_url":"https://github.com/frerich/filter_formatter","commit_stats":null,"previous_names":["frerich/filter_formatter"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frerich%2Ffilter_formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frerich%2Ffilter_formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frerich%2Ffilter_formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frerich%2Ffilter_formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frerich","download_url":"https://codeload.github.com/frerich/filter_formatter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230168011,"owners_count":18183856,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","elixir-lang"],"created_at":"2024-12-17T19:18:25.188Z","updated_at":"2024-12-17T19:18:25.990Z","avatar_url":"https://github.com/frerich.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FilterFormatter\n\nThis is a `mix format`\n[plugin](https://hexdocs.pm/mix/main/Mix.Tasks.Format.html#module-plugins)\nwhich filters user-configurable sigils and files by piping their contents to a\ngiven command line program.\n\nThe program is expected to read input via stdin and produce formatter output on\nstdout. An exit code of 0 is considered success, any other exit code is\nconsidered failure.\n\nThis makes it easy to hook any command line tool into `mix format`.\n\n## Installation\n\nFirst, add `filter_formatter` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:filter_formatter, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\nNext, fetch dependencies. This will also pull in\n[Rambo](https://hex.pm/packages/rambo) since that's what this plugin uses for\nrunning external programs. To make sure that Rambo works, run `mix\ncompile.rambo` once to build any required intermediate binaries.\n\n```sh\nmix deps.get \u0026\u0026 mix compile.rambo\n```\n\nRambo depends on a helper binary written in Rust. In case the `mix\ncompile.rambo` step prints a message like\n\n\u003e ** (RuntimeError) Rambo does not ship with binaries for your environment.\n\nMake sure to have Rust available before running `mix compile.rambo`. Using\nHomebrew, this is a matter of running\n\n```sh\nbrew install rust\n```\n\nFinally, add `FilterFormatter` to your `.formatter.exs` file and configure the\n`filter_formatter` option such that it associates sigils and/or file extensions\nwith commands to execute:\n\n```elixir\n[\n  inputs: [\"*.{ex,exs,heex}\", \"priv/*/seeds.exs\", ...],\n  plugins: [FilterFormatter],\n  filter_formatter: [\n      ...\n  ]\n]\n```\n\n## Example: formatting SQL via pg_format\n\nThis configuration makes `mix format` pass the contents This specification\nwhich makes `mix format` pass the contents of the `SQL` sigil as well as the\ncode in any `.sql` files through\n[pg_format](https://github.com/darold/pgFormatter).\n\n```elixir\n[\n  plugins: [FilterFormatter],\n  filter_formatter: [\n    [\n      extensions: [\".sql\"],\n      sigils: [:SQL],\n      executable: \"pg_format\",\n      args: [\"-L\"]\n    ]\n  }\n]\n```\n\n## Example: formatting SQL via SQLFluff\n\nHere's another example of formatting SQL, this time using\n[SQLFluff](https://sqlfluff.com/):\n\n```elixir\n[\n  plugins: [FilterFormatter],\n  filter_formatter: [\n    [\n      extensions: [\".sql\"],\n      sigils: [:SQL],\n      executable: \"sqlformat\",\n      args: [\"format\", \"-\", \"--dialect\", \"postgres\", \"--nocolor\", \"--disable-progress-bar\"]\n    ]\n  ]\n]\n```\n\nPlease see the [API documentation](https://hexdocs.pm/filter_formatter) for\nmore information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrerich%2Ffilter_formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrerich%2Ffilter_formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrerich%2Ffilter_formatter/lists"}