{"action":"created","issue":{"url":"https://api.github.com/repos/bazelbuild/buildtools/issues/108","repository_url":"https://api.github.com/repos/bazelbuild/buildtools","labels_url":"https://api.github.com/repos/bazelbuild/buildtools/issues/108/labels{/name}","comments_url":"https://api.github.com/repos/bazelbuild/buildtools/issues/108/comments","events_url":"https://api.github.com/repos/bazelbuild/buildtools/issues/108/events","html_url":"https://github.com/bazelbuild/buildtools/issues/108","id":234958771,"number":108,"title":"Buildifier shouldn't break up blocks of constants with newlines","user":{"login":"jmillikin-stripe","id":28275929,"avatar_url":"https://avatars0.githubusercontent.com/u/28275929?v=3","gravatar_id":"","url":"https://api.github.com/users/jmillikin-stripe","html_url":"https://github.com/jmillikin-stripe","followers_url":"https://api.github.com/users/jmillikin-stripe/followers","following_url":"https://api.github.com/users/jmillikin-stripe/following{/other_user}","gists_url":"https://api.github.com/users/jmillikin-stripe/gists{/gist_id}","starred_url":"https://api.github.com/users/jmillikin-stripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmillikin-stripe/subscriptions","organizations_url":"https://api.github.com/users/jmillikin-stripe/orgs","repos_url":"https://api.github.com/users/jmillikin-stripe/repos","events_url":"https://api.github.com/users/jmillikin-stripe/events{/privacy}","received_events_url":"https://api.github.com/users/jmillikin-stripe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-06-09T23:12:15Z","updated_at":"2017-06-14T19:15:59Z","closed_at":null,"body":"```python\r\nUBUNTU_MAIN = \"http://mirrors.kernel.org/ubuntu/pool/main/\"\r\nUBUNTU_UNIVERSE = \"http://mirrors.kernel.org/ubuntu/pool/universe/\"\r\nNODEJS = \"http://deb.nodesource.com/node_6.x/pool/main/\"\r\n```\r\nbecomes\r\n```python\r\nUBUNTU_MAIN = \"http://mirrors.kernel.org/ubuntu/pool/main/\"\r\n\r\nUBUNTU_UNIVERSE = \"http://mirrors.kernel.org/ubuntu/pool/universe/\"\r\n\r\nNODEJS = \"http://deb.nodesource.com/node_6.x/pool/main/\"\r\n```\r\n\r\nThis is not ideal because a `BUILD` file with blocks of related constants can become very \"fluffy\" and difficult to scan over.\r\n\r\nCopying the `gofmt` logic of aligning equals signs in blocks of assignments would be nicer:\r\n```python\r\nUBUNTU_MAIN     = \"http://mirrors.kernel.org/ubuntu/pool/main/\"\r\nUBUNTU_UNIVERSE = \"http://mirrors.kernel.org/ubuntu/pool/universe/\"\r\nNODEJS          = \"http://deb.nodesource.com/node_6.x/pool/main/\"\r\n```\r\n\r\nOr, alternatively, just don't add newlines."},"comment":{"url":"https://api.github.com/repos/bazelbuild/buildtools/issues/comments/308530847","html_url":"https://github.com/bazelbuild/buildtools/issues/108#issuecomment-308530847","issue_url":"https://api.github.com/repos/bazelbuild/buildtools/issues/108","id":308530847,"user":{"login":"mwoehlke-kitware","id":6474409,"avatar_url":"https://avatars0.githubusercontent.com/u/6474409?v=3","gravatar_id":"","url":"https://api.github.com/users/mwoehlke-kitware","html_url":"https://github.com/mwoehlke-kitware","followers_url":"https://api.github.com/users/mwoehlke-kitware/followers","following_url":"https://api.github.com/users/mwoehlke-kitware/following{/other_user}","gists_url":"https://api.github.com/users/mwoehlke-kitware/gists{/gist_id}","starred_url":"https://api.github.com/users/mwoehlke-kitware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwoehlke-kitware/subscriptions","organizations_url":"https://api.github.com/users/mwoehlke-kitware/orgs","repos_url":"https://api.github.com/users/mwoehlke-kitware/repos","events_url":"https://api.github.com/users/mwoehlke-kitware/events{/privacy}","received_events_url":"https://api.github.com/users/mwoehlke-kitware/received_events","type":"User","site_admin":false},"created_at":"2017-06-14T19:15:59Z","updated_at":"2017-06-14T19:15:59Z","body":"First off, that rationale is wrong; we have quite a few Bazel files full of utility functions, rule implementations, etc. that most certainly do *not* \"[have] only top-level statements\".\r\n\r\nThat said, I agree the intent seems to be 'one blank line, not two', rather than 'one blank line, not none'. Anyway, here's another example where adding a blank line is clunky, if not outright misguided:\r\n\r\n```\r\n# This is a comment that applies to multiple declarations.\r\nFOO = \"foo\"\r\nBAR = \"bar\"\r\n```\r\n\r\nWith no blank line, it is clear that the comment applies to *both* declarations. Adding a blank line here is actively harmful to clarity."}}
{"actor":{"display_login":"mwoehlke-kitware"}}