{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/codeformatter/pulls/comments/38226918","id":38226918,"diff_hunk":"@@ -0,0 +1,39 @@\n+﻿// Copyright (c) Microsoft. All rights reserved.\n+// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n+\n+using System.Collections.Concurrent;\n+using System.Diagnostics;\n+using Microsoft.CodeAnalysis.Diagnostics;\n+using Microsoft.CodeAnalysis.Options;\n+\n+namespace Microsoft.DotNet.CodeFormatter.Analyzers\n+{\n+    internal static class OptionsHelper\n+    {\n+        private static PropertyBag defaultProperties = new PropertyBag();\n+\n+        private static ConcurrentDictionary<string, PropertyBag> additionalFileToOptionsMap = new ConcurrentDictionary<string, PropertyBag>();\n+\n+        public static PropertyBag GetProperties(AnalyzerOptions analyzerOptions)\n+        {             \n+            if (analyzerOptions.AdditionalFiles == null ||  analyzerOptions.AdditionalFiles.Length == 0)\n+            {\n+                return defaultProperties;\n+            }\n+\n+            Debug.Assert(analyzerOptions.AdditionalFiles.Length == 1);\n+\n+            string optionsFilePath = analyzerOptions.AdditionalFiles[0].Path;\n+\n+            PropertyBag properties;\n+\n+            if (!additionalFileToOptionsMap.TryGetValue(optionsFilePath, out properties))","path":"src/Microsoft.DotNet.CodeFormatter.Analyzers/OptionsHelper.cs","position":30,"original_position":30,"commit_id":"52106a2b7977c79c0ddbbe4d807740f04c21d560","original_commit_id":"52106a2b7977c79c0ddbbe4d807740f04c21d560","user":{"login":"lgolding","id":11762653,"avatar_url":"https://avatars.githubusercontent.com/u/11762653?v=3","gravatar_id":"","url":"https://api.github.com/users/lgolding","html_url":"https://github.com/lgolding","followers_url":"https://api.github.com/users/lgolding/followers","following_url":"https://api.github.com/users/lgolding/following{/other_user}","gists_url":"https://api.github.com/users/lgolding/gists{/gist_id}","starred_url":"https://api.github.com/users/lgolding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lgolding/subscriptions","organizations_url":"https://api.github.com/users/lgolding/orgs","repos_url":"https://api.github.com/users/lgolding/repos","events_url":"https://api.github.com/users/lgolding/events{/privacy}","received_events_url":"https://api.github.com/users/lgolding/received_events","type":"User","site_admin":false},"body":"What do you do if there is more than one `.formatconfig` in the `AdditionalFiles`?","created_at":"2015-08-28T18:03:39Z","updated_at":"2015-08-28T18:03:39Z","html_url":"https://github.com/dotnet/codeformatter/pull/170#discussion_r38226918","pull_request_url":"https://api.github.com/repos/dotnet/codeformatter/pulls/170","_links":{"self":{"href":"https://api.github.com/repos/dotnet/codeformatter/pulls/comments/38226918"},"html":{"href":"https://github.com/dotnet/codeformatter/pull/170#discussion_r38226918"},"pull_request":{"href":"https://api.github.com/repos/dotnet/codeformatter/pulls/170"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/codeformatter/pulls/170","id":43218552,"html_url":"https://github.com/dotnet/codeformatter/pull/170","diff_url":"https://github.com/dotnet/codeformatter/pull/170.diff","patch_url":"https://github.com/dotnet/codeformatter/pull/170.patch","issue_url":"https://api.github.com/repos/dotnet/codeformatter/issues/170","number":170,"state":"open","locked":false,"title":"CodeFormatter options","user":{"login":"michaelcfanning","id":13526455,"avatar_url":"https://avatars.githubusercontent.com/u/13526455?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelcfanning","html_url":"https://github.com/michaelcfanning","followers_url":"https://api.github.com/users/michaelcfanning/followers","following_url":"https://api.github.com/users/michaelcfanning/following{/other_user}","gists_url":"https://api.github.com/users/michaelcfanning/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelcfanning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelcfanning/subscriptions","organizations_url":"https://api.github.com/users/michaelcfanning/orgs","repos_url":"https://api.github.com/users/michaelcfanning/repos","events_url":"https://api.github.com/users/michaelcfanning/events{/privacy}","received_events_url":"https://api.github.com/users/michaelcfanning/received_events","type":"User","site_admin":false},"body":"1. Add new command for exporting options file. CodeFormatter retrieves all IOptionProvider exports, then persists an XML representation of all settings to user-provided path, e.g.: CodeFormatter options MyOptions.xml\r\n2. Add new --options setting to format verb that accepts an options XML file (and uses it to configure analysis). \r\n3. Drop requirement to provide -t or --target argument. Instead, all 'loose' arguments are bundled together as the project/solution list to operate against. Note that these arguments must precede all other command-line arguments, due to CommandLine parsing behaviors.\r\n4. Serialization mechanism based on property bag implementation from SDL tools. Added corresponding unit tests (99%+ code coverage). We will likely want to look at adding JSON persistence capability to this code. Glad to do that soon.\r\n\r\n@jaredpar @Priya91 @lgolding @srivatsn @genlu ","created_at":"2015-08-24T20:36:08Z","updated_at":"2015-08-28T18:03:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/codeformatter/pulls/170/commits","review_comments_url":"https://api.github.com/repos/dotnet/codeformatter/pulls/170/comments","review_comment_url":"https://api.github.com/repos/dotnet/codeformatter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/codeformatter/issues/170/comments","statuses_url":"https://api.github.com/repos/dotnet/codeformatter/statuses/52106a2b7977c79c0ddbbe4d807740f04c21d560","head":{"label":"michaelcfanning:anfix-options","ref":"anfix-options","sha":"52106a2b7977c79c0ddbbe4d807740f04c21d560","user":{"login":"michaelcfanning","id":13526455,"avatar_url":"https://avatars.githubusercontent.com/u/13526455?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelcfanning","html_url":"https://github.com/michaelcfanning","followers_url":"https://api.github.com/users/michaelcfanning/followers","following_url":"https://api.github.com/users/michaelcfanning/following{/other_user}","gists_url":"https://api.github.com/users/michaelcfanning/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelcfanning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelcfanning/subscriptions","organizations_url":"https://api.github.com/users/michaelcfanning/orgs","repos_url":"https://api.github.com/users/michaelcfanning/repos","events_url":"https://api.github.com/users/michaelcfanning/events{/privacy}","received_events_url":"https://api.github.com/users/michaelcfanning/received_events","type":"User","site_admin":false},"repo":{"id":39793041,"name":"codeformatter","full_name":"michaelcfanning/codeformatter","owner":{"login":"michaelcfanning","id":13526455,"avatar_url":"https://avatars.githubusercontent.com/u/13526455?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelcfanning","html_url":"https://github.com/michaelcfanning","followers_url":"https://api.github.com/users/michaelcfanning/followers","following_url":"https://api.github.com/users/michaelcfanning/following{/other_user}","gists_url":"https://api.github.com/users/michaelcfanning/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelcfanning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelcfanning/subscriptions","organizations_url":"https://api.github.com/users/michaelcfanning/orgs","repos_url":"https://api.github.com/users/michaelcfanning/repos","events_url":"https://api.github.com/users/michaelcfanning/events{/privacy}","received_events_url":"https://api.github.com/users/michaelcfanning/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/michaelcfanning/codeformatter","description":"Tool that uses Roslyn to automatically rewrite the source to follow our coding styles","fork":true,"url":"https://api.github.com/repos/michaelcfanning/codeformatter","forks_url":"https://api.github.com/repos/michaelcfanning/codeformatter/forks","keys_url":"https://api.github.com/repos/michaelcfanning/codeformatter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/michaelcfanning/codeformatter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/michaelcfanning/codeformatter/teams","hooks_url":"https://api.github.com/repos/michaelcfanning/codeformatter/hooks","issue_events_url":"https://api.github.com/repos/michaelcfanning/codeformatter/issues/events{/number}","events_url":"https://api.github.com/repos/michaelcfanning/codeformatter/events","assignees_url":"https://api.github.com/repos/michaelcfanning/codeformatter/assignees{/user}","branches_url":"https://api.github.com/repos/michaelcfanning/codeformatter/branches{/branch}","tags_url":"https://api.github.com/repos/michaelcfanning/codeformatter/tags","blobs_url":"https://api.github.com/repos/michaelcfanning/codeformatter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/michaelcfanning/codeformatter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/michaelcfanning/codeformatter/git/refs{/sha}","trees_url":"https://api.github.com/repos/michaelcfanning/codeformatter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/michaelcfanning/codeformatter/statuses/{sha}","languages_url":"https://api.github.com/repos/michaelcfanning/codeformatter/languages","stargazers_url":"https://api.github.com/repos/michaelcfanning/codeformatter/stargazers","contributors_url":"https://api.github.com/repos/michaelcfanning/codeformatter/contributors","subscribers_url":"https://api.github.com/repos/michaelcfanning/codeformatter/subscribers","subscription_url":"https://api.github.com/repos/michaelcfanning/codeformatter/subscription","commits_url":"https://api.github.com/repos/michaelcfanning/codeformatter/commits{/sha}","git_commits_url":"https://api.github.com/repos/michaelcfanning/codeformatter/git/commits{/sha}","comments_url":"https://api.github.com/repos/michaelcfanning/codeformatter/comments{/number}","issue_comment_url":"https://api.github.com/repos/michaelcfanning/codeformatter/issues/comments{/number}","contents_url":"https://api.github.com/repos/michaelcfanning/codeformatter/contents/{+path}","compare_url":"https://api.github.com/repos/michaelcfanning/codeformatter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/michaelcfanning/codeformatter/merges","archive_url":"https://api.github.com/repos/michaelcfanning/codeformatter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/michaelcfanning/codeformatter/downloads","issues_url":"https://api.github.com/repos/michaelcfanning/codeformatter/issues{/number}","pulls_url":"https://api.github.com/repos/michaelcfanning/codeformatter/pulls{/number}","milestones_url":"https://api.github.com/repos/michaelcfanning/codeformatter/milestones{/number}","notifications_url":"https://api.github.com/repos/michaelcfanning/codeformatter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/michaelcfanning/codeformatter/labels{/name}","releases_url":"https://api.github.com/repos/michaelcfanning/codeformatter/releases{/id}","created_at":"2015-07-27T19:16:49Z","updated_at":"2015-07-27T19:16:49Z","pushed_at":"2015-08-14T23:45:15Z","git_url":"git://github.com/michaelcfanning/codeformatter.git","ssh_url":"git@github.com:michaelcfanning/codeformatter.git","clone_url":"https://github.com/michaelcfanning/codeformatter.git","svn_url":"https://github.com/michaelcfanning/codeformatter","homepage":"","size":1024,"stargazers_count":0,"watchers_count":0,"language":"C#","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":"anfix"}},"base":{"label":"dotnet:anfix","ref":"anfix","sha":"f00ccf5519c40d9ff9d946ffe67db982780db20a","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":28896487,"name":"codeformatter","full_name":"dotnet/codeformatter","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/codeformatter","description":"Tool that uses Roslyn to automatically rewrite the source to follow our coding styles","fork":false,"url":"https://api.github.com/repos/dotnet/codeformatter","forks_url":"https://api.github.com/repos/dotnet/codeformatter/forks","keys_url":"https://api.github.com/repos/dotnet/codeformatter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/codeformatter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/codeformatter/teams","hooks_url":"https://api.github.com/repos/dotnet/codeformatter/hooks","issue_events_url":"https://api.github.com/repos/dotnet/codeformatter/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/codeformatter/events","assignees_url":"https://api.github.com/repos/dotnet/codeformatter/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/codeformatter/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/codeformatter/tags","blobs_url":"https://api.github.com/repos/dotnet/codeformatter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/codeformatter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/codeformatter/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/codeformatter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/codeformatter/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/codeformatter/languages","stargazers_url":"https://api.github.com/repos/dotnet/codeformatter/stargazers","contributors_url":"https://api.github.com/repos/dotnet/codeformatter/contributors","subscribers_url":"https://api.github.com/repos/dotnet/codeformatter/subscribers","subscription_url":"https://api.github.com/repos/dotnet/codeformatter/subscription","commits_url":"https://api.github.com/repos/dotnet/codeformatter/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/codeformatter/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/codeformatter/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/codeformatter/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/codeformatter/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/codeformatter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/codeformatter/merges","archive_url":"https://api.github.com/repos/dotnet/codeformatter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/codeformatter/downloads","issues_url":"https://api.github.com/repos/dotnet/codeformatter/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/codeformatter/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/codeformatter/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/codeformatter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/codeformatter/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/codeformatter/releases{/id}","created_at":"2015-01-07T03:28:44Z","updated_at":"2015-08-28T13:56:45Z","pushed_at":"2015-08-28T06:01:00Z","git_url":"git://github.com/dotnet/codeformatter.git","ssh_url":"git@github.com:dotnet/codeformatter.git","clone_url":"https://github.com/dotnet/codeformatter.git","svn_url":"https://github.com/dotnet/codeformatter","homepage":"","size":1922,"stargazers_count":439,"watchers_count":439,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":84,"mirror_url":null,"open_issues_count":53,"forks":84,"open_issues":53,"watchers":439,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/codeformatter/pulls/170"},"html":{"href":"https://github.com/dotnet/codeformatter/pull/170"},"issue":{"href":"https://api.github.com/repos/dotnet/codeformatter/issues/170"},"comments":{"href":"https://api.github.com/repos/dotnet/codeformatter/issues/170/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/codeformatter/pulls/170/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/codeformatter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/codeformatter/pulls/170/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/codeformatter/statuses/52106a2b7977c79c0ddbbe4d807740f04c21d560"}}}}