Skip to content

No .editorconfig records the formatting conventions the sources already follow #16

Description

@dmccoystephenson

Problem

Every tracked file follows a consistent set of formatting conventions, but nothing in the repository records them. The conventions are held by habit rather than by a rule an editor can read, so the first contributor whose editor defaults differ will introduce mixed indentation or CRLF line endings without anything contradicting it.

Evidence

The ten tracked files were inspected byte by byte in this session:

Property Observed
Line endings LF in all ten files; zero CRLF sequences
Tabs none in any file
Indentation (src/**/*.java) spaces only, in multiples of four
Trailing whitespace (src/**/*.java) none
Trailing whitespace (LICENSE) present on three lines
Encoding ASCII throughout, except LICENSE, which contains a UTF-8 copyright sign
Final newline present in README.md, LICENSE, and .gitignore; absent from all seven .java files

No compiler was required to establish any of the above.

Proposed change

An .editorconfig at the repository root recording the properties that hold uniformly: end_of_line = lf and charset = utf-8 for all files, plus indent_style = space, indent_size = 4, and trim_trailing_whitespace = true scoped to *.java.

Two properties are deliberately handled narrowly:

  • trim_trailing_whitespace is scoped to *.java rather than applied globally, because LICENSE violates it on three lines.
  • insert_final_newline is left unset entirely, because the seven .java files disagree with the other three tracked files.

Setting either one globally would make the file describe an intention rather than the repository, and would cause a conforming editor to rewrite files that such a change is not meant to touch.

Why this is proportionate

No source file is modified, and no dependency, build file, or top-level directory is introduced. The addition is a single configuration file of roughly ten lines, which is appropriate for a project of this size.


This issue was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

drafted by Claude on behalf of Daniel Stephenson

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions