Skip to content

Add a rule that formats missing spaces after -- characters #808

@dmarticus

Description

@dmarticus

Is your feature request related to a problem? Please describe.

As far as I can tell, there's no good tool for catching missing spaces after comments in Haskell. For example, when code reviewing, I sometimes see things like this:

--this is a comment

when I think most folks would prefer

-- this is a comment

This type of comment isn't super fun to make in code reviews, since it's more of a nit than anything, and it seems like something that should be enforced by a linting/formatting tool. Other formatters, such as eslint and SwiftLint have such rules, and it'd be awesome if fourmolu could support something similar.

Let me know if there's anything helpful I can add to this issue!

Describe the solution you'd like

As I said in the description, I'd like it if Ormolu would support adding spaces in front of the comment, itself, but after the -- characters.

Describe alternatives you've considered

I looked at HLint, since other languages use linters for this type of thing, but the folks at HLint think it's more appropriate to do with a formatter.

Additional context

So this issue comes with a PR (LINK TODO), and I already implemented this change in fourmolu, but the folks there figured that such a rule may be applicable to Ormolu as well, so I figured I'd run it past y'all and see if this seems like something that would be worth adding to Ormolu and upstreaming to Fourmolu. If not, I'll just add it there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    styleNitpicking and things related to purely visual aspect for formatting.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions