{"id":13803566,"url":"https://github.com/dlang-community/dfmt","last_synced_at":"2026-02-22T14:37:21.209Z","repository":{"id":25677794,"uuid":"29113713","full_name":"dlang-community/dfmt","owner":"dlang-community","description":"Dfmt is a formatter for D source code","archived":false,"fork":false,"pushed_at":"2025-10-09T06:25:40.000Z","size":1034,"stargazers_count":212,"open_issues_count":103,"forks_count":47,"subscribers_count":19,"default_branch":"master","last_synced_at":"2026-01-13T19:58:33.938Z","etag":null,"topics":["code-formatter","dlang","formatter"],"latest_commit_sha":null,"homepage":null,"language":"D","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dlang-community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2015-01-12T01:46:36.000Z","updated_at":"2025-12-29T05:10:50.000Z","dependencies_parsed_at":"2024-05-11T19:24:12.753Z","dependency_job_id":"b4e56343-865a-41f7-9d4d-c9e424c6b827","html_url":"https://github.com/dlang-community/dfmt","commit_stats":{"total_commits":578,"total_committers":41,"mean_commits":"14.097560975609756","dds":"0.40830449826989623","last_synced_commit":"840aeee45e2b699a3baaa957880b25df685f6b79"},"previous_names":["hackerpilot/dfmt"],"tags_count":75,"template":false,"template_full_name":null,"purl":"pkg:github/dlang-community/dfmt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlang-community%2Fdfmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlang-community%2Fdfmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlang-community%2Fdfmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlang-community%2Fdfmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dlang-community","download_url":"https://codeload.github.com/dlang-community/dfmt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlang-community%2Fdfmt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29716357,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T13:30:57.152Z","status":"ssl_error","status_checked_at":"2026-02-22T13:30:28.561Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["code-formatter","dlang","formatter"],"created_at":"2024-08-04T01:00:35.500Z","updated_at":"2026-02-22T14:37:21.178Z","avatar_url":"https://github.com/dlang-community.png","language":"D","funding_links":[],"categories":["Dev Tools"],"sub_categories":["Bare metal / kernel development"],"readme":"# dfmt [![Build Status](https://github.com/dlang-community/dfmt/actions/workflows/d.yml/badge.svg)](https://github.com/dlang-community/dfmt/actions?query=workflow%3A%22D%22)\n\n**dfmt** is a formatter for D source code\n\n## Status\n**dfmt** is beta quality. Make backups of your files or use source control\nwhen using the **--inplace** option.\n\n## Installation\n\n### Installing with DUB\n\n```sh\n\u003e dub run dfmt -- -h\n```\n\n### Building from source using Make\n* Clone the repository\n* Run ```git submodule update --init --recursive``` in the dfmt directory\n* To compile with DMD, run ```make``` in the dfmt directory. To compile with\n  LDC, run ```make ldc``` instead. The generated binary will be placed in ```dfmt/bin/```.\n\n### Building from source using dub\n* Clone the repository\n* run `dub build --build=release`, optionally with `--compiler=ldc2`\n\n## Using\nBy default, dfmt reads its input from **stdin** and writes to **stdout**.\nIf a file name is specified on the command line, input will be read from the\nfile instead, and output will be written to **stdout**.\n\n**dfmt** uses [EditorConfig](http://editorconfig.org/) files for configuration. If you run **dfmt** on a\nsource file it will look for *.editorconfig* files that apply to that source file.\nIf no file is specified on the command line, **dfmt** will look for *.editorconfig*\nfiles that would apply to a D file in the current working directory. Command\nline options can be used instead of *.editorconfig* files, or to override options\nfound there.\n\n### Options\n* `--help | -h`: Display command line options.\n* `--inplace | -i`: A file name is required and the file will be edited in-place.\n* `--align_switch_statements`: *see dfmt_align_switch_statements [below](#dfmt-specific-properties)*\n* `--brace_style`: *see dfmt_brace_style [below](#dfmt-specific-properties)*\n* `--compact_labeled_statements`: *see dfmt_compact_labeled_statements [below](#dfmt-specific-properties)*\n* `--end_of_line`: *see end_of_line [below](#standard-editorconfig-properties)*\n* `--indent_size`: *see indent_size [below](#standard-editorconfig-properties)*\n* `--indent_style | -t`: *see indent_style [below](#standard-editorconfig-properties)*\n* `--max_line_length`: *see max_line_length [below](#standard-editorconfig-properties)*\n* `--outdent_attributes`: *see dfmt_outdent_attributes [below](#dfmt-specific-properties)*\n* `--selective_import_space`: *see dfmt_selective_import_space [below](#dfmt-specific-properties)*\n* `--single_template_constraint_indent`: *see dfmt_single_template_constraint_indent [below](#dfmt-specific-properties)*\n* `--soft_max_line_length`: *see dfmt_soft_max_line_length [below](#dfmt-specific-properties)*\n* `--space_after_cast`: *see dfmt_space_after_cast [below](#dfmt-specific-properties)*\n* `--space_before_aa_colon`: *see dfmt_space_before_aa_colon [below](#dfmt-specific-properties)*\n* `--space_before_named_arg_colon`: *see dfmt_space_before_named_arg_colon [below](#dfmt-specific-properties)*\n* `--space_before_function_parameters`: *see dfmt_space_before_function_parameters [below](#dfmt-specific-properties)*\n* `--split_operator_at_line_end`: *see dfmt_split_operator_at_line_end [below](#dfmt-specific-properties)*\n* `--tab_width`: *see tab_width [below](#standard-editorconfig-properties)*\n* `--template_constraint_style`: *see dfmt_template_constraint_style [below](#dfmt-specific-properties)*\n* `--keep_line_breaks`: *see dfmt_keep_line_breaks [below](#dfmt-specific-properties)*\n* `--single_indent`: *see dfmt_single_indent [below](#dfmt-specific-properties)*\n* `--reflow_property_chains`: *see dfmt_property_chains [below](#dfmt-specific-properties)*\n* `--space_after_keywords`: *see dfmt_space_after_keywords [below](#dfmt-specific-properties)*\n\n### Example\n```\ndfmt --inplace --space_after_cast=false --max_line_length=80 \\\n    --soft_max_line_length=70 --brace_style=otbs file.d\n```\n\n## Disabling formatting\nFormatting can be temporarily disabled by placing the comments ```// dfmt off```\nand ```// dfmt on``` around code that you do not want formatted.\n\n```d\nvoid main(string[] args)\n{\n    bool optionOne, optionTwo, optionThree;\n\n    // dfmt has no way of knowing that \"getopt\" is special, so it wraps the\n    // argument list normally\n    getopt(args, \"optionOne\", \u0026optionOne, \"optionTwo\", \u0026optionTwo, \"optionThree\", \u0026optionThree);\n\n    // dfmt off\n    getopt(args,\n        \"optionOne\", \u0026optionOne,\n        \"optionTwo\", \u0026optionTwo,\n        \"optionThree\", \u0026optionThree);\n    // dfmt on\n}\n```\n\n## Configuration\n**dfmt** uses [EditorConfig](http://editorconfig.org/) configuration files.\n**dfmt**-specific properties are prefixed with *dfmt_*.\n### Standard EditorConfig properties\nProperty Name | Allowed Values | Description\n--------------|----------------|------------\nend_of_line | `cr`, `crlf` and `lf` | [See EditorConfig documentation.](https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#end_of_line) When not set, `dfmt` adopts the first line ending in the input.\ninsert_final_newline | **`true`** | Not supported. `dfmt` always inserts a final newline.\ncharset | **`UTF-8`** | Not supported. `dfmt` only works correctly on UTF-8.\nindent_style | `tab`, **`space`** | [See EditorConfig documentation.](https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#indent_style)\nindent_size | positive integers (**`4`**) | [See EditorConfig documentation.](https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#indent_size)\ntab_width | positive integers (**`4`**) | [See EditorConfig documentation.](https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#tab_width)\ntrim_trailing_whitespace | **`true`** | Not supported. `dfmt` does not emit trailing whitespace.\nmax_line_length | positive integers (**`120`**) | [See EditorConfig documentation.](https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#max_line_length)\n### dfmt-specific properties\nProperty Name | Allowed Values | Description\n--------------|----------------|------------\ndfmt_brace_style | **`allman`**, `otbs`, `stroustrup` or `knr` | [See Wikipedia](https://en.wikipedia.org/wiki/Brace_style)\ndfmt_soft_max_line_length | positive integers (**`80`**) | The formatting process will usually keep lines below this length, but they may be up to *max_line_length* columns long.\ndfmt_align_switch_statements | **`true`**, `false` | Align labels, cases, and defaults with their enclosing switch.\ndfmt_outdent_attributes (Not yet implemented) | **`true`**, `false`| Decrease the indentation level of attributes.\ndfmt_split_operator_at_line_end | `true`, **`false`** | Place operators on the end of the previous line when splitting lines.\ndfmt_space_after_cast | **`true`**, `false` | Insert space after the closing paren of a `cast` expression.\ndfmt_space_after_keywords (Not yet implemented) | **`true`**, `false` | Insert space after `if`, `while`, `foreach`, etc, and before the `(`.\ndfmt_space_before_function_parameters | `true`, **`false`** | Insert space before the opening paren of a function parameter list.\ndfmt_selective_import_space | **`true`**, `false` | Insert space after the module name and before the `:` for selective imports.\ndfmt_compact_labeled_statements | **`true`**, `false` | Place labels on the same line as the labeled `switch`, `for`, `foreach`, or `while` statement.\ndfmt_template_constraint_style | **`conditional_newline_indent`** `conditional_newline` `always_newline` `always_newline_indent` | Control the formatting of template constraints.\ndfmt_single_template_constraint_indent | `true`, **`false`** | Set if the constraints are indented by a single tab instead of two. Has only an effect if the style set to `always_newline_indent` or `conditional_newline_indent`.\ndfmt_space_before_aa_colon | `true`, **`false`** | Adds a space after an associative array key before the `:` like in older dfmt versions.\ndfmt_space_before_named_arg_colon | `true`, **`false`** | Adds a space after a named function argument or named struct constructor argument before the `:`.\ndfmt_keep_line_breaks | `true`, **`false`** | Keep existing line breaks if these don't violate other formatting rules.\ndfmt_single_indent | `true`, **`false`** | Set if the code in parens is indented by a single tab instead of two.\ndfmt_reflow_property_chains | **`true`**, `false` | Recalculate the splitting of property chains into multiple lines.\ndfmt_space_after_keywords | **`true`**, `false` | Insert space after keywords (if,while,foreach,for, etc.).\n\n## Terminology\n* Braces - `{` and `}`\n* Brackets - `[` and `]`\n* Parenthesis / Parens  - `(` and `)`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdlang-community%2Fdfmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdlang-community%2Fdfmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdlang-community%2Fdfmt/lists"}