{"action":"created","comment":{"url":"https://api.github.com/repos/stylelint/stylelint/pulls/comments/59718402","id":59718402,"diff_hunk":"@@ -47,3 +40,139 @@ function invalidOptionsFormatter(results) {\n     return output + \"\\n\"\n   }, \"\\n\")\n }\n+\n+function getSeverity(type) {\n+  if (type == \"error\") {\n+    return \"error\"\n+  }\n+\n+  if (type == \"info\") {\n+    return \"info\"\n+  }\n+\n+  return \"warning\"\n+}\n+\n+function logFrom(fromValue) {\n+  if (fromValue.charAt(0) === \"<\") return fromValue\n+  return path.relative(process.cwd(), fromValue).split(path.sep).join(\"/\")\n+}\n+\n+function getMessageWidth(columnWidths) {\n+  if (!process.stdout.isTTY) {\n+    return columnWidths[3]\n+  }\n+\n+  const availableWidth = process.stdout.columns\n+  const fullWidth = _.sum(_.values(columnWidths))\n+\n+  // If there is no reason to wrap the text, we won't align the last column to the right\n+  if (availableWidth > fullWidth + marginWidths) {\n+    return columnWidths[3]\n+  }\n+\n+  return availableWidth - (fullWidth - columnWidths[3] + marginWidths)\n+}\n+\n+function formatter(opts) {\n+  const options = opts || {}\n+  const sortByPosition = (typeof options.sortByPosition !== \"undefined\") ? options.sortByPosition : true\n+  const positionless = options.positionless || \"first\"\n+\n+  return function (input) {\n+    const messages = input.messages\n+    const source = input.source\n+\n+    if (!messages.length) return \"\"\n+\n+    const orderedMessages = _.sortBy(\n+      messages,\n+      (m) => {\n+        if (!m.line) return 1\n+        if (positionless === \"any\") return 1\n+        if (positionless === \"first\") return 2\n+        if (positionless === \"last\") return 0\n+      },\n+      (m) => sortByPosition? m.line : 1,\n+      (m) => sortByPosition? m.column : 1\n+    )\n+\n+    // Create a list of column widths, needed to calculate\n+    // the size of the message column and if needed wrap it.\n+    const columnWidths = { 0: 1, 1: 1, 2: 1, 3: 1, 4: 1 }\n+\n+    const calculateWidths = function (columns) {\n+      let width, i\n+      for (i in columns) {\n+        if (columns.hasOwnProperty(i)) {\n+          width = chalk.stripColor(columns[i]).toString().length\n+          if (width > columnWidths[i]) {\n+            columnWidths[i] = width\n+          }\n+        }\n+      }\n+\n+      return columns\n+    }\n+\n+    let output = \"\\n\"\n+\n+    if (source) {\n+      output += chalk.bold.underline(logFrom(source)) + \"\\n\"\n+    }\n+\n+    const cleanedMessages = orderedMessages.map(\n+      (message) => {\n+        const location = utils.getLocation(message)\n+        const severity = getSeverity(message.severity)\n+        const messageType = chalk[levelColors[severity]](options.noIcon ? severity : symbols[severity])\n+\n+        const escapedRule = (\"(\" + message.rule + \")\").replace(/[|\\\\{}()[\\]^$+*?.]/g, \"\\\\$&\")\n+\n+        return calculateWidths([\n+          location.line || \"\",\n+          location.column || \"\",\n+          messageType,\n+          message.text.replace(/\\.$/, \"\").replace(new RegExp(escapedRule + \"$\"), \"\"),\n+          chalk.yellow(message.rule || \"\"),\n+        ])\n+      })\n+\n+    output += table(\n+      cleanedMessages,\n+      {\n+        border: getBorderCharacters(\"void\"),\n+        columns: {\n+          0: { alignment: \"right\", width: columnWidths[0], paddingRight: 0 },\n+          1: { alignment: \"left\", width: columnWidths[1] },\n+          2: { alignment: \"left\", width: columnWidths[2] },\n+          3: { alignment: \"left\", width: getMessageWidth(columnWidths), wrapWord: true },\n+          4: { alignment: \"left\", width: columnWidths[4], paddingRight: 0 },\n+        },\n+        drawHorizontalLine: () => false,\n+      }\n+      )\n+      .split(\"\\n\")\n+      .map((el) => el.replace(/(\\d+)\\s+(\\d+)/, (m, p1, p2) => chalk.bold(p1 + \":\" + p2)))\n+      .join(\"\\n\")\n+\n+    return output\n+  }\n+}\n+\n+const minimalFormatter = formatter({","path":"src/formatters/stringFormatter.js","position":157,"original_position":157,"commit_id":"4670188c321486c4e5bd05e270a3299073a7a516","original_commit_id":"4670188c321486c4e5bd05e270a3299073a7a516","user":{"login":"davidtheclark","id":628431,"avatar_url":"https://avatars.githubusercontent.com/u/628431?v=3","gravatar_id":"","url":"https://api.github.com/users/davidtheclark","html_url":"https://github.com/davidtheclark","followers_url":"https://api.github.com/users/davidtheclark/followers","following_url":"https://api.github.com/users/davidtheclark/following{/other_user}","gists_url":"https://api.github.com/users/davidtheclark/gists{/gist_id}","starred_url":"https://api.github.com/users/davidtheclark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidtheclark/subscriptions","organizations_url":"https://api.github.com/users/davidtheclark/orgs","repos_url":"https://api.github.com/users/davidtheclark/repos","events_url":"https://api.github.com/users/davidtheclark/events{/privacy}","received_events_url":"https://api.github.com/users/davidtheclark/received_events","type":"User","site_admin":false},"body":"This is kind of confusing to me because it's no longer a \"minimal\" formatter.","created_at":"2016-04-14T13:42:17Z","updated_at":"2016-04-14T13:42:17Z","html_url":"https://github.com/stylelint/stylelint/pull/1056#discussion_r59718402","pull_request_url":"https://api.github.com/repos/stylelint/stylelint/pulls/1056","_links":{"self":{"href":"https://api.github.com/repos/stylelint/stylelint/pulls/comments/59718402"},"html":{"href":"https://github.com/stylelint/stylelint/pull/1056#discussion_r59718402"},"pull_request":{"href":"https://api.github.com/repos/stylelint/stylelint/pulls/1056"}}},"pull_request":{"url":"https://api.github.com/repos/stylelint/stylelint/pulls/1056","id":66277085,"html_url":"https://github.com/stylelint/stylelint/pull/1056","diff_url":"https://github.com/stylelint/stylelint/pull/1056.diff","patch_url":"https://github.com/stylelint/stylelint/pull/1056.patch","issue_url":"https://api.github.com/repos/stylelint/stylelint/issues/1056","number":1056,"state":"open","locked":false,"title":"Create a new layout for message styles. ","user":{"login":"onigoetz","id":309594,"avatar_url":"https://avatars.githubusercontent.com/u/309594?v=3","gravatar_id":"","url":"https://api.github.com/users/onigoetz","html_url":"https://github.com/onigoetz","followers_url":"https://api.github.com/users/onigoetz/followers","following_url":"https://api.github.com/users/onigoetz/following{/other_user}","gists_url":"https://api.github.com/users/onigoetz/gists{/gist_id}","starred_url":"https://api.github.com/users/onigoetz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onigoetz/subscriptions","organizations_url":"https://api.github.com/users/onigoetz/orgs","repos_url":"https://api.github.com/users/onigoetz/repos","events_url":"https://api.github.com/users/onigoetz/events{/privacy}","received_events_url":"https://api.github.com/users/onigoetz/received_events","type":"User","site_admin":false},"body":"This is related to postcss/postcss-reporter#23\r\n\r\nWhat it brings : \r\n- Add an icon for severity\r\n- Put the rule name in a new column.\r\n\r\nThese are set in a table which will automatically wrap the content to the next line if it's too long.\r\n\r\nThe dependency to postcss-reporter is left as-is for two reasons : \r\n- a dependency of stylelint (stylehacks) uses postcss-reporter, so it would be imported anyway.\r\n- We use the utils from postcss-reporter, and I'm not sure it would add great value to copy that util over.","created_at":"2016-04-13T07:32:29Z","updated_at":"2016-04-14T13:42:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a9bd7226ba46f183b333833b35660d66ff6ee08f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/stylelint/stylelint/pulls/1056/commits","review_comments_url":"https://api.github.com/repos/stylelint/stylelint/pulls/1056/comments","review_comment_url":"https://api.github.com/repos/stylelint/stylelint/pulls/comments{/number}","comments_url":"https://api.github.com/repos/stylelint/stylelint/issues/1056/comments","statuses_url":"https://api.github.com/repos/stylelint/stylelint/statuses/4670188c321486c4e5bd05e270a3299073a7a516","head":{"label":"onigoetz:reporter-improvement","ref":"reporter-improvement","sha":"4670188c321486c4e5bd05e270a3299073a7a516","user":{"login":"onigoetz","id":309594,"avatar_url":"https://avatars.githubusercontent.com/u/309594?v=3","gravatar_id":"","url":"https://api.github.com/users/onigoetz","html_url":"https://github.com/onigoetz","followers_url":"https://api.github.com/users/onigoetz/followers","following_url":"https://api.github.com/users/onigoetz/following{/other_user}","gists_url":"https://api.github.com/users/onigoetz/gists{/gist_id}","starred_url":"https://api.github.com/users/onigoetz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onigoetz/subscriptions","organizations_url":"https://api.github.com/users/onigoetz/orgs","repos_url":"https://api.github.com/users/onigoetz/repos","events_url":"https://api.github.com/users/onigoetz/events{/privacy}","received_events_url":"https://api.github.com/users/onigoetz/received_events","type":"User","site_admin":false},"repo":{"id":53090153,"name":"stylelint","full_name":"onigoetz/stylelint","owner":{"login":"onigoetz","id":309594,"avatar_url":"https://avatars.githubusercontent.com/u/309594?v=3","gravatar_id":"","url":"https://api.github.com/users/onigoetz","html_url":"https://github.com/onigoetz","followers_url":"https://api.github.com/users/onigoetz/followers","following_url":"https://api.github.com/users/onigoetz/following{/other_user}","gists_url":"https://api.github.com/users/onigoetz/gists{/gist_id}","starred_url":"https://api.github.com/users/onigoetz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onigoetz/subscriptions","organizations_url":"https://api.github.com/users/onigoetz/orgs","repos_url":"https://api.github.com/users/onigoetz/repos","events_url":"https://api.github.com/users/onigoetz/events{/privacy}","received_events_url":"https://api.github.com/users/onigoetz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/onigoetz/stylelint","description":"A mighty, modern CSS linter","fork":true,"url":"https://api.github.com/repos/onigoetz/stylelint","forks_url":"https://api.github.com/repos/onigoetz/stylelint/forks","keys_url":"https://api.github.com/repos/onigoetz/stylelint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/onigoetz/stylelint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/onigoetz/stylelint/teams","hooks_url":"https://api.github.com/repos/onigoetz/stylelint/hooks","issue_events_url":"https://api.github.com/repos/onigoetz/stylelint/issues/events{/number}","events_url":"https://api.github.com/repos/onigoetz/stylelint/events","assignees_url":"https://api.github.com/repos/onigoetz/stylelint/assignees{/user}","branches_url":"https://api.github.com/repos/onigoetz/stylelint/branches{/branch}","tags_url":"https://api.github.com/repos/onigoetz/stylelint/tags","blobs_url":"https://api.github.com/repos/onigoetz/stylelint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/onigoetz/stylelint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/onigoetz/stylelint/git/refs{/sha}","trees_url":"https://api.github.com/repos/onigoetz/stylelint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/onigoetz/stylelint/statuses/{sha}","languages_url":"https://api.github.com/repos/onigoetz/stylelint/languages","stargazers_url":"https://api.github.com/repos/onigoetz/stylelint/stargazers","contributors_url":"https://api.github.com/repos/onigoetz/stylelint/contributors","subscribers_url":"https://api.github.com/repos/onigoetz/stylelint/subscribers","subscription_url":"https://api.github.com/repos/onigoetz/stylelint/subscription","commits_url":"https://api.github.com/repos/onigoetz/stylelint/commits{/sha}","git_commits_url":"https://api.github.com/repos/onigoetz/stylelint/git/commits{/sha}","comments_url":"https://api.github.com/repos/onigoetz/stylelint/comments{/number}","issue_comment_url":"https://api.github.com/repos/onigoetz/stylelint/issues/comments{/number}","contents_url":"https://api.github.com/repos/onigoetz/stylelint/contents/{+path}","compare_url":"https://api.github.com/repos/onigoetz/stylelint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/onigoetz/stylelint/merges","archive_url":"https://api.github.com/repos/onigoetz/stylelint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/onigoetz/stylelint/downloads","issues_url":"https://api.github.com/repos/onigoetz/stylelint/issues{/number}","pulls_url":"https://api.github.com/repos/onigoetz/stylelint/pulls{/number}","milestones_url":"https://api.github.com/repos/onigoetz/stylelint/milestones{/number}","notifications_url":"https://api.github.com/repos/onigoetz/stylelint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/onigoetz/stylelint/labels{/name}","releases_url":"https://api.github.com/repos/onigoetz/stylelint/releases{/id}","deployments_url":"https://api.github.com/repos/onigoetz/stylelint/deployments","created_at":"2016-03-03T22:51:40Z","updated_at":"2016-03-03T22:51:41Z","pushed_at":"2016-04-14T08:26:05Z","git_url":"git://github.com/onigoetz/stylelint.git","ssh_url":"git@github.com:onigoetz/stylelint.git","clone_url":"https://github.com/onigoetz/stylelint.git","svn_url":"https://github.com/onigoetz/stylelint","homepage":"http://stylelint.io/","size":3052,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"stylelint:master","ref":"master","sha":"464b7733c9b92caa5caf3ae5d7aedba8637dd113","user":{"login":"stylelint","id":10076935,"avatar_url":"https://avatars.githubusercontent.com/u/10076935?v=3","gravatar_id":"","url":"https://api.github.com/users/stylelint","html_url":"https://github.com/stylelint","followers_url":"https://api.github.com/users/stylelint/followers","following_url":"https://api.github.com/users/stylelint/following{/other_user}","gists_url":"https://api.github.com/users/stylelint/gists{/gist_id}","starred_url":"https://api.github.com/users/stylelint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stylelint/subscriptions","organizations_url":"https://api.github.com/users/stylelint/orgs","repos_url":"https://api.github.com/users/stylelint/repos","events_url":"https://api.github.com/users/stylelint/events{/privacy}","received_events_url":"https://api.github.com/users/stylelint/received_events","type":"Organization","site_admin":false},"repo":{"id":27549019,"name":"stylelint","full_name":"stylelint/stylelint","owner":{"login":"stylelint","id":10076935,"avatar_url":"https://avatars.githubusercontent.com/u/10076935?v=3","gravatar_id":"","url":"https://api.github.com/users/stylelint","html_url":"https://github.com/stylelint","followers_url":"https://api.github.com/users/stylelint/followers","following_url":"https://api.github.com/users/stylelint/following{/other_user}","gists_url":"https://api.github.com/users/stylelint/gists{/gist_id}","starred_url":"https://api.github.com/users/stylelint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stylelint/subscriptions","organizations_url":"https://api.github.com/users/stylelint/orgs","repos_url":"https://api.github.com/users/stylelint/repos","events_url":"https://api.github.com/users/stylelint/events{/privacy}","received_events_url":"https://api.github.com/users/stylelint/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stylelint/stylelint","description":"A mighty, modern CSS linter","fork":false,"url":"https://api.github.com/repos/stylelint/stylelint","forks_url":"https://api.github.com/repos/stylelint/stylelint/forks","keys_url":"https://api.github.com/repos/stylelint/stylelint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stylelint/stylelint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stylelint/stylelint/teams","hooks_url":"https://api.github.com/repos/stylelint/stylelint/hooks","issue_events_url":"https://api.github.com/repos/stylelint/stylelint/issues/events{/number}","events_url":"https://api.github.com/repos/stylelint/stylelint/events","assignees_url":"https://api.github.com/repos/stylelint/stylelint/assignees{/user}","branches_url":"https://api.github.com/repos/stylelint/stylelint/branches{/branch}","tags_url":"https://api.github.com/repos/stylelint/stylelint/tags","blobs_url":"https://api.github.com/repos/stylelint/stylelint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stylelint/stylelint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stylelint/stylelint/git/refs{/sha}","trees_url":"https://api.github.com/repos/stylelint/stylelint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stylelint/stylelint/statuses/{sha}","languages_url":"https://api.github.com/repos/stylelint/stylelint/languages","stargazers_url":"https://api.github.com/repos/stylelint/stylelint/stargazers","contributors_url":"https://api.github.com/repos/stylelint/stylelint/contributors","subscribers_url":"https://api.github.com/repos/stylelint/stylelint/subscribers","subscription_url":"https://api.github.com/repos/stylelint/stylelint/subscription","commits_url":"https://api.github.com/repos/stylelint/stylelint/commits{/sha}","git_commits_url":"https://api.github.com/repos/stylelint/stylelint/git/commits{/sha}","comments_url":"https://api.github.com/repos/stylelint/stylelint/comments{/number}","issue_comment_url":"https://api.github.com/repos/stylelint/stylelint/issues/comments{/number}","contents_url":"https://api.github.com/repos/stylelint/stylelint/contents/{+path}","compare_url":"https://api.github.com/repos/stylelint/stylelint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stylelint/stylelint/merges","archive_url":"https://api.github.com/repos/stylelint/stylelint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stylelint/stylelint/downloads","issues_url":"https://api.github.com/repos/stylelint/stylelint/issues{/number}","pulls_url":"https://api.github.com/repos/stylelint/stylelint/pulls{/number}","milestones_url":"https://api.github.com/repos/stylelint/stylelint/milestones{/number}","notifications_url":"https://api.github.com/repos/stylelint/stylelint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stylelint/stylelint/labels{/name}","releases_url":"https://api.github.com/repos/stylelint/stylelint/releases{/id}","deployments_url":"https://api.github.com/repos/stylelint/stylelint/deployments","created_at":"2014-12-04T16:25:23Z","updated_at":"2016-04-14T02:55:24Z","pushed_at":"2016-04-14T11:26:35Z","git_url":"git://github.com/stylelint/stylelint.git","ssh_url":"git@github.com:stylelint/stylelint.git","clone_url":"https://github.com/stylelint/stylelint.git","svn_url":"https://github.com/stylelint/stylelint","homepage":"http://stylelint.io/","size":3341,"stargazers_count":1019,"watchers_count":1019,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":61,"mirror_url":null,"open_issues_count":33,"forks":61,"open_issues":33,"watchers":1019,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/stylelint/stylelint/pulls/1056"},"html":{"href":"https://github.com/stylelint/stylelint/pull/1056"},"issue":{"href":"https://api.github.com/repos/stylelint/stylelint/issues/1056"},"comments":{"href":"https://api.github.com/repos/stylelint/stylelint/issues/1056/comments"},"review_comments":{"href":"https://api.github.com/repos/stylelint/stylelint/pulls/1056/comments"},"review_comment":{"href":"https://api.github.com/repos/stylelint/stylelint/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/stylelint/stylelint/pulls/1056/commits"},"statuses":{"href":"https://api.github.com/repos/stylelint/stylelint/statuses/4670188c321486c4e5bd05e270a3299073a7a516"}}}}