{"action":"created","issue":{"url":"https://api.github.com/repos/ocaml-ppx/ocamlformat/issues/43","repository_url":"https://api.github.com/repos/ocaml-ppx/ocamlformat","labels_url":"https://api.github.com/repos/ocaml-ppx/ocamlformat/issues/43/labels{/name}","comments_url":"https://api.github.com/repos/ocaml-ppx/ocamlformat/issues/43/comments","events_url":"https://api.github.com/repos/ocaml-ppx/ocamlformat/issues/43/events","html_url":"https://github.com/ocaml-ppx/ocamlformat/issues/43","id":272901350,"number":43,"title":"indentation quirks","user":{"login":"hannesm","id":228456,"avatar_url":"https://avatars1.githubusercontent.com/u/228456?v=4","gravatar_id":"","url":"https://api.github.com/users/hannesm","html_url":"https://github.com/hannesm","followers_url":"https://api.github.com/users/hannesm/followers","following_url":"https://api.github.com/users/hannesm/following{/other_user}","gists_url":"https://api.github.com/users/hannesm/gists{/gist_id}","starred_url":"https://api.github.com/users/hannesm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hannesm/subscriptions","organizations_url":"https://api.github.com/users/hannesm/orgs","repos_url":"https://api.github.com/users/hannesm/repos","events_url":"https://api.github.com/users/hannesm/events{/privacy}","received_events_url":"https://api.github.com/users/hannesm/received_events","type":"User","site_admin":false},"labels":[{"id":726290034,"url":"https://api.github.com/repos/ocaml-ppx/ocamlformat/labels/style%20suggestion","name":"style suggestion","color":"eeeeee","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-11-10T11:23:03Z","updated_at":"2017-11-14T01:21:12Z","closed_at":null,"author_association":"NONE","body":"thank you for developing ocamlformat.  I ran it on some source of mine, and struggle with the diff below (esp. ocamlformat (v0.2) disagrees with ocp-indent (1.6.1):\r\n\r\n```\r\n let is_hostname t =\r\n   (* TLD should not be all-numeric! *)\r\n-  (if Array.length t > 0 then\r\n-     String.exists Char.Ascii.is_letter (Array.get t 0)\r\n-   else true) &&\r\n-  Array.for_all check_host_label t\r\n+  ( if Array.length t > 0 then String.exists Char.Ascii.is_letter t.(0)\r\n+  else true )\r\n+  && Array.for_all check_host_label t\r\n```\r\n\r\nI'd expect the `else` to be indented 4 spaces (instead of the 2)."},"comment":{"url":"https://api.github.com/repos/ocaml-ppx/ocamlformat/issues/comments/344114392","html_url":"https://github.com/ocaml-ppx/ocamlformat/issues/43#issuecomment-344114392","issue_url":"https://api.github.com/repos/ocaml-ppx/ocamlformat/issues/43","id":344114392,"user":{"login":"jberdine","id":1466830,"avatar_url":"https://avatars1.githubusercontent.com/u/1466830?v=4","gravatar_id":"","url":"https://api.github.com/users/jberdine","html_url":"https://github.com/jberdine","followers_url":"https://api.github.com/users/jberdine/followers","following_url":"https://api.github.com/users/jberdine/following{/other_user}","gists_url":"https://api.github.com/users/jberdine/gists{/gist_id}","starred_url":"https://api.github.com/users/jberdine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jberdine/subscriptions","organizations_url":"https://api.github.com/users/jberdine/orgs","repos_url":"https://api.github.com/users/jberdine/repos","events_url":"https://api.github.com/users/jberdine/events{/privacy}","received_events_url":"https://api.github.com/users/jberdine/received_events","type":"User","site_admin":false},"created_at":"2017-11-14T01:21:12Z","updated_at":"2017-11-14T01:21:12Z","author_association":"CONTRIBUTOR","body":"The reasoning behind these cases is about being economical with indentation. That is, in cases where an expression/pattern/etc is parenthesized, breaks across multiple lines, and will have the actual user code (that is, not keywords and syntactic elements such as `|`) within indented anyhow, then the indentation is not increased just because of the parens. A rough goal is to have the high-level structure be clear by looking at the left margin, and to minimize indentation subject to that. Note that the current approach to indentation is not independent of how infix operators are formatted at the beginning of lines instead of at the end of the preceding line. This has been tested on only so much code though, and there are likely bad cases.\r\n\r\nCases where the formatting is \"unfamiliar\" are expected, but I would like to hear about cases where the formatting is misleading."}}
{"actor":{"display_login":"jberdine"}}