Page MenuHomeFreeBSD

Add .editorconfig (sane settings that work in most editors)
Needs ReviewPublic

Authored by adamw on Feb 1 2017, 8:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 21, 1:05 AM
Unknown Object (File)
Tue, Oct 21, 1:05 AM
Unknown Object (File)
Mon, Oct 20, 3:26 PM
Unknown Object (File)
Jun 4 2025, 11:57 AM
Unknown Object (File)
Apr 18 2025, 1:38 AM
Unknown Object (File)
Feb 14 2025, 5:16 PM
Unknown Object (File)
Feb 14 2025, 5:03 PM
Unknown Object (File)
Nov 5 2024, 7:30 AM
Subscribers

Details

Reviewers
danfe
Group Reviewers
portmgr
Summary

EditorConfig is a nice way to spec basic file settings in a format that is recognized (through plugins) by every major editor that would conceivably be hacking on FreeBSD ports.

Basically, this config sets up:

Always: eol=LF, UTF-8, newline at end of file, and no trailing whitespace (before newlines)

Makefiles: 8 char tabs
Mk/ stuff: 4 char tabs
pkg-* files: Hard wrap at 80 chars
UPDATING/CHANGES: 2 char tabs, tabs become spaces

Test Plan

With this file in place (/usr/ports/.editorconfig), install the plugin (see the website or Vim instructions.

The right magic should exist in Makefile, Mk/bsd.port.mk, ports-mgmt/pkg/pkg-descr, and UPDATING.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

adamw retitled this revision from to Add .editorconfig (sane settings that work in most editors).
adamw updated this object.
adamw edited the test plan for this revision. (Show Details)
adamw added reviewers: danfe, portmgr.
adamw set the repository for this revision to rP FreeBSD ports repository.

Tabs should always be 8 spaces, except in the very few files in Mk that have a ex:ts=4.
And I would rather someone went over them to change it to 8 than to set things like that in some kind of stone.

.editorconfig
9

This is going to burp on all files that are not utf-8, of those, there are two cases:

  • ports Makefiles that have a Created line with latin* chars, for those, the Created line should likely be removed.
  • all the patches, and files in FILESDIRs that are not utf-8 and can never be because upstream software is not.
18โ€“21

The .sh use tabs for indentation, their size is irrelevant, I have a :set ts=2 sw=2 sts=2 noet in my .vimrc for them, but 8, 4 or 11 would work as well :-)

23โ€“25

This would be bad for pkg-plist files and asking pkg to understand line wraps seems like a very bad idea, and pkg-install/deinstall files because sh will not like wrapped lines unless you end with an \.

I think if you mean pkg-descr, pkg-message and pkg-help, it should be restricted to it. (It cannot be used for pkg-message.in files because %%foo%% interpolations would mess the 80 chars anyway.)

28

Tabs should always be 8 spaces, so 2 is wrong.