Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected blank line after %% @private #165

Closed
paulo-ferraz-oliveira opened this issue Sep 25, 2020 · 15 comments
Closed

Unexpected blank line after %% @private #165

paulo-ferraz-oliveira opened this issue Sep 25, 2020 · 15 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed started
Milestone

Comments

@paulo-ferraz-oliveira
Copy link
Contributor

I usually write my edoc related "tag" like so

-spec resolve(Module :: module(), Host :: dispatcher:host()) ->
                 {ok, [inet:ip_address()]}.
%% @private
resolve(Module, Host) ->
    Module:resolve(Host).

This is getting formatted to

-spec resolve(Module :: module(), Host :: dispatcher:host()) ->
                 {ok, [inet:ip_address()]}.
%% @private

resolve(Module, Host) ->
    Module:resolve(Host).

Is seems like a bug, but I'm not sure.

@elbrujohalcon
Copy link
Collaborator

Definitely a bug.

@elbrujohalcon elbrujohalcon added bug Something isn't working help wanted Extra attention is needed labels Sep 25, 2020
@elbrujohalcon elbrujohalcon added this to the 1.0.0 milestone Sep 25, 2020
@elbrujohalcon
Copy link
Collaborator

Although… Why do you put your edoc comments after the spec… WHY???? :trollface:

@paulo-ferraz-oliveira
Copy link
Contributor Author

WHY????

I imagined that, some years after starting to write Erlang, I'd come across a formatting tool whose developers I really wanted to annoy 😄.

On a serious note, I'll try to find a reference as to why I started doing this. I didn't start this by myself; I remember I saw it somewhere.

@paulo-ferraz-oliveira
Copy link
Contributor Author

If it's of any consolation, erlfmt suffered from a similar bug. 😄

@elbrujohalcon
Copy link
Collaborator

Yeah, I know.

@paulo-ferraz-oliveira
Copy link
Contributor Author

@paulo-ferraz-oliveira
Copy link
Contributor Author

But my source was most surely something more widely used like lager.

@elbrujohalcon
Copy link
Collaborator

Oh, man! Specs with parentheses!! 🙈

@paulo-ferraz-oliveira
Copy link
Contributor Author

😄 long live diversity...

What about specs as comments?

I'm sure you're not surprised; you've seen much more that I have while working on the tool, for sure...

@paulo-ferraz-oliveira
Copy link
Contributor Author

In any case, I wouldn't mind (let me know if I should open a new issue) that the tool moved comments from "between the spec and the function" to "above the spec", like so...

This

-spec resolve(Module :: module(), Host :: dispatcher:host()) ->
                 {ok, [inet:ip_address()]}.
%% @private
resolve(Module, Host) ->
    Module:resolve(Host).

would become

%% @private
-spec resolve(Module :: module(), Host :: dispatcher:host()) ->
                 {ok, [inet:ip_address()]}.
resolve(Module, Host) ->
    Module:resolve(Host).

@elbrujohalcon
Copy link
Collaborator

😄 long live diversity...

What about specs as comments?

I'm sure you're not surprised; you've seen much more that I have while working on the tool, for sure...

Yeah… that's ye ould edoc style…

@elbrujohalcon
Copy link
Collaborator

In any case, I wouldn't mind (let me know if I should open a new issue) that the tool moved comments from "between the spec and the function" to "above the spec", like so...

This

-spec resolve(Module :: module(), Host :: dispatcher:host()) ->
                 {ok, [inet:ip_address()]}.
%% @private
resolve(Module, Host) ->
    Module:resolve(Host).

would become

%% @private
-spec resolve(Module :: module(), Host :: dispatcher:host()) ->
                 {ok, [inet:ip_address()]}.
resolve(Module, Host) ->
    Module:resolve(Host).

This will be super nice, but I don't know if it's possible at all, without breaking other things.

@elbrujohalcon elbrujohalcon modified the milestones: 1.0.0, 0.6.0 Oct 7, 2020
@elbrujohalcon
Copy link
Collaborator

@paulo-ferraz-oliveira can you confirm if this is still happening?
I just tried to format the following module and there was no new line introduced after the comment.

-module(a_module).

-spec resolve(Module :: module(), Host :: dispatcher:host()) -> {ok, [inet:ip_address()]}.
%% @private
resolve(Module, Host) ->
    Module:resolve(Host).

@paulo-ferraz-oliveira
Copy link
Contributor Author

This seems to have gone away. At least in master.

@elbrujohalcon
Copy link
Collaborator

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed started
Projects
None yet
Development

No branches or pull requests

2 participants