{"action":"created","comment":{"url":"https://api.github.com/repos/HewlettPackard/gas/pulls/comments/73889898","id":73889898,"diff_hunk":"@@ -57,6 +59,52 @@ USAGE:\n \n `\n \n+var logger *log.Logger\n+\n+func extendConfList(conf map[string]interface{}, name string, input []string) {\n+\tif val, ok := conf[name]; ok {\n+\t\tif data, ok := val.(*[]string); ok {\n+\t\t\tconf[name] = append(*data, input...)\n+\t\t} else {\n+\t\t\tlogger.Fatal(\"Config item must be a string list: \", name)\n+\t\t}\n+\t} else {\n+\t\tconf[name] = []string{}\n+\t}\n+}\n+\n+func buildConfig(incRules string, excRules string) map[string]interface{} {\n+\tconfig := make(map[string]interface{})\n+\tif flagConfig != nil && *flagConfig != \"\" { // parse config if we have one\n+\t\tif data, err := ioutil.ReadFile(*flagConfig); err == nil {\n+\t\t\tif err := json.Unmarshal(data, &(config)); err != nil {\n+\t\t\t\tlogger.Fatal(\"Could not parse JSON config: \", *flagConfig, \": \", err)\n+\t\t\t}\n+\t\t} else {\n+\t\t\tlogger.Fatal(\"Could not read config file: \", *flagConfig)\n+\t\t}\n+\t}\n+\n+\t// add in CLI include and exclude data\n+\textendConfList(config, \"include\", strings.Split(incRules, \",\"))\n+\textendConfList(config, \"exclude\", strings.Split(excRules, \",\"))\n+\n+\t// override ignoreNosec if given on CLI\n+\tif flagIgnoreNoSec != nil {\n+\t\tconfig[\"ignoreNosec\"] = *flagIgnoreNoSec\n+\t} else {\n+\t\tval, ok := config[\"ignoreNosec\"]\n+\t\tif !ok {\n+\t\t\tconfig[\"ignoreNosec\"] = false\n+\t\t} else if _, ok := val.(bool); !ok {\n+\t\t\tlogger.Fatal(\"Config value must be a bool: 'ignoreNosec'\")\n+\t\t}\n+\t}\n+\n+\tfmt.Println(config)","path":"main.go","position":57,"original_position":57,"commit_id":"0c2d477dd95089c687ba3237ba1b20bbacc85572","original_commit_id":"0c2d477dd95089c687ba3237ba1b20bbacc85572","user":{"login":"gcmurphy","id":222833,"avatar_url":"https://avatars.githubusercontent.com/u/222833?v=3","gravatar_id":"","url":"https://api.github.com/users/gcmurphy","html_url":"https://github.com/gcmurphy","followers_url":"https://api.github.com/users/gcmurphy/followers","following_url":"https://api.github.com/users/gcmurphy/following{/other_user}","gists_url":"https://api.github.com/users/gcmurphy/gists{/gist_id}","starred_url":"https://api.github.com/users/gcmurphy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gcmurphy/subscriptions","organizations_url":"https://api.github.com/users/gcmurphy/orgs","repos_url":"https://api.github.com/users/gcmurphy/repos","events_url":"https://api.github.com/users/gcmurphy/events{/privacy}","received_events_url":"https://api.github.com/users/gcmurphy/received_events","type":"User","site_admin":false},"body":"Did you mean to leave the fmt.Println here? ","created_at":"2016-08-08T14:55:00Z","updated_at":"2016-08-08T14:55:00Z","html_url":"https://github.com/HewlettPackard/gas/pull/35#discussion_r73889898","pull_request_url":"https://api.github.com/repos/HewlettPackard/gas/pulls/35","_links":{"self":{"href":"https://api.github.com/repos/HewlettPackard/gas/pulls/comments/73889898"},"html":{"href":"https://github.com/HewlettPackard/gas/pull/35#discussion_r73889898"},"pull_request":{"href":"https://api.github.com/repos/HewlettPackard/gas/pulls/35"}}},"pull_request":{"url":"https://api.github.com/repos/HewlettPackard/gas/pulls/35","id":80244209,"html_url":"https://github.com/HewlettPackard/gas/pull/35","diff_url":"https://github.com/HewlettPackard/gas/pull/35.diff","patch_url":"https://github.com/HewlettPackard/gas/pull/35.patch","issue_url":"https://api.github.com/repos/HewlettPackard/gas/issues/35","number":35,"state":"open","locked":false,"title":"Configuration","user":{"login":"callidus","id":1265498,"avatar_url":"https://avatars.githubusercontent.com/u/1265498?v=3","gravatar_id":"","url":"https://api.github.com/users/callidus","html_url":"https://github.com/callidus","followers_url":"https://api.github.com/users/callidus/followers","following_url":"https://api.github.com/users/callidus/following{/other_user}","gists_url":"https://api.github.com/users/callidus/gists{/gist_id}","starred_url":"https://api.github.com/users/callidus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/callidus/subscriptions","organizations_url":"https://api.github.com/users/callidus/orgs","repos_url":"https://api.github.com/users/callidus/repos","events_url":"https://api.github.com/users/callidus/events{/privacy}","received_events_url":"https://api.github.com/users/callidus/received_events","type":"User","site_admin":false},"body":"This re-works the way that CLI options are passed through to the\r\nanalyzer so that they can act as overrides for config options. If\r\nnot given on the CLI, options will come from a config file. If no\r\nfile is used then a default value is chosen.\r\n\r\nTwo lists are also populated with tests to include or exclude.\r\nThese lists are not used for now but will eventually replace the\r\nway we select test to run in a future patch to follow.  NOTE that\r\nthe \"exclude\" CLI option has been repurposed to mean\r\nexcluded rules, a new \"skip\" option has been added to replace\r\nthe old behaviour.\r\n","created_at":"2016-08-05T13:36:44Z","updated_at":"2016-08-08T14:55:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0532340160105224027eae686faaeaec6414ad15","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/HewlettPackard/gas/pulls/35/commits","review_comments_url":"https://api.github.com/repos/HewlettPackard/gas/pulls/35/comments","review_comment_url":"https://api.github.com/repos/HewlettPackard/gas/pulls/comments{/number}","comments_url":"https://api.github.com/repos/HewlettPackard/gas/issues/35/comments","statuses_url":"https://api.github.com/repos/HewlettPackard/gas/statuses/0c2d477dd95089c687ba3237ba1b20bbacc85572","head":{"label":"HewlettPackard:config_cli","ref":"config_cli","sha":"0c2d477dd95089c687ba3237ba1b20bbacc85572","user":{"login":"HewlettPackard","id":6004705,"avatar_url":"https://avatars.githubusercontent.com/u/6004705?v=3","gravatar_id":"","url":"https://api.github.com/users/HewlettPackard","html_url":"https://github.com/HewlettPackard","followers_url":"https://api.github.com/users/HewlettPackard/followers","following_url":"https://api.github.com/users/HewlettPackard/following{/other_user}","gists_url":"https://api.github.com/users/HewlettPackard/gists{/gist_id}","starred_url":"https://api.github.com/users/HewlettPackard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HewlettPackard/subscriptions","organizations_url":"https://api.github.com/users/HewlettPackard/orgs","repos_url":"https://api.github.com/users/HewlettPackard/repos","events_url":"https://api.github.com/users/HewlettPackard/events{/privacy}","received_events_url":"https://api.github.com/users/HewlettPackard/received_events","type":"Organization","site_admin":false},"repo":{"id":63625434,"name":"gas","full_name":"HewlettPackard/gas","owner":{"login":"HewlettPackard","id":6004705,"avatar_url":"https://avatars.githubusercontent.com/u/6004705?v=3","gravatar_id":"","url":"https://api.github.com/users/HewlettPackard","html_url":"https://github.com/HewlettPackard","followers_url":"https://api.github.com/users/HewlettPackard/followers","following_url":"https://api.github.com/users/HewlettPackard/following{/other_user}","gists_url":"https://api.github.com/users/HewlettPackard/gists{/gist_id}","starred_url":"https://api.github.com/users/HewlettPackard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HewlettPackard/subscriptions","organizations_url":"https://api.github.com/users/HewlettPackard/orgs","repos_url":"https://api.github.com/users/HewlettPackard/repos","events_url":"https://api.github.com/users/HewlettPackard/events{/privacy}","received_events_url":"https://api.github.com/users/HewlettPackard/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HewlettPackard/gas","description":"Go AST Scanner","fork":false,"url":"https://api.github.com/repos/HewlettPackard/gas","forks_url":"https://api.github.com/repos/HewlettPackard/gas/forks","keys_url":"https://api.github.com/repos/HewlettPackard/gas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HewlettPackard/gas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HewlettPackard/gas/teams","hooks_url":"https://api.github.com/repos/HewlettPackard/gas/hooks","issue_events_url":"https://api.github.com/repos/HewlettPackard/gas/issues/events{/number}","events_url":"https://api.github.com/repos/HewlettPackard/gas/events","assignees_url":"https://api.github.com/repos/HewlettPackard/gas/assignees{/user}","branches_url":"https://api.github.com/repos/HewlettPackard/gas/branches{/branch}","tags_url":"https://api.github.com/repos/HewlettPackard/gas/tags","blobs_url":"https://api.github.com/repos/HewlettPackard/gas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HewlettPackard/gas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HewlettPackard/gas/git/refs{/sha}","trees_url":"https://api.github.com/repos/HewlettPackard/gas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HewlettPackard/gas/statuses/{sha}","languages_url":"https://api.github.com/repos/HewlettPackard/gas/languages","stargazers_url":"https://api.github.com/repos/HewlettPackard/gas/stargazers","contributors_url":"https://api.github.com/repos/HewlettPackard/gas/contributors","subscribers_url":"https://api.github.com/repos/HewlettPackard/gas/subscribers","subscription_url":"https://api.github.com/repos/HewlettPackard/gas/subscription","commits_url":"https://api.github.com/repos/HewlettPackard/gas/commits{/sha}","git_commits_url":"https://api.github.com/repos/HewlettPackard/gas/git/commits{/sha}","comments_url":"https://api.github.com/repos/HewlettPackard/gas/comments{/number}","issue_comment_url":"https://api.github.com/repos/HewlettPackard/gas/issues/comments{/number}","contents_url":"https://api.github.com/repos/HewlettPackard/gas/contents/{+path}","compare_url":"https://api.github.com/repos/HewlettPackard/gas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HewlettPackard/gas/merges","archive_url":"https://api.github.com/repos/HewlettPackard/gas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HewlettPackard/gas/downloads","issues_url":"https://api.github.com/repos/HewlettPackard/gas/issues{/number}","pulls_url":"https://api.github.com/repos/HewlettPackard/gas/pulls{/number}","milestones_url":"https://api.github.com/repos/HewlettPackard/gas/milestones{/number}","notifications_url":"https://api.github.com/repos/HewlettPackard/gas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HewlettPackard/gas/labels{/name}","releases_url":"https://api.github.com/repos/HewlettPackard/gas/releases{/id}","deployments_url":"https://api.github.com/repos/HewlettPackard/gas/deployments","created_at":"2016-07-18T18:01:08Z","updated_at":"2016-08-08T03:17:09Z","pushed_at":"2016-08-08T09:06:58Z","git_url":"git://github.com/HewlettPackard/gas.git","ssh_url":"git@github.com:HewlettPackard/gas.git","clone_url":"https://github.com/HewlettPackard/gas.git","svn_url":"https://github.com/HewlettPackard/gas","homepage":null,"size":64,"stargazers_count":527,"watchers_count":527,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":5,"forks":13,"open_issues":5,"watchers":527,"default_branch":"master"}},"base":{"label":"HewlettPackard:master","ref":"master","sha":"4e30ca386659d57f7c1df5d60830084b878c8240","user":{"login":"HewlettPackard","id":6004705,"avatar_url":"https://avatars.githubusercontent.com/u/6004705?v=3","gravatar_id":"","url":"https://api.github.com/users/HewlettPackard","html_url":"https://github.com/HewlettPackard","followers_url":"https://api.github.com/users/HewlettPackard/followers","following_url":"https://api.github.com/users/HewlettPackard/following{/other_user}","gists_url":"https://api.github.com/users/HewlettPackard/gists{/gist_id}","starred_url":"https://api.github.com/users/HewlettPackard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HewlettPackard/subscriptions","organizations_url":"https://api.github.com/users/HewlettPackard/orgs","repos_url":"https://api.github.com/users/HewlettPackard/repos","events_url":"https://api.github.com/users/HewlettPackard/events{/privacy}","received_events_url":"https://api.github.com/users/HewlettPackard/received_events","type":"Organization","site_admin":false},"repo":{"id":63625434,"name":"gas","full_name":"HewlettPackard/gas","owner":{"login":"HewlettPackard","id":6004705,"avatar_url":"https://avatars.githubusercontent.com/u/6004705?v=3","gravatar_id":"","url":"https://api.github.com/users/HewlettPackard","html_url":"https://github.com/HewlettPackard","followers_url":"https://api.github.com/users/HewlettPackard/followers","following_url":"https://api.github.com/users/HewlettPackard/following{/other_user}","gists_url":"https://api.github.com/users/HewlettPackard/gists{/gist_id}","starred_url":"https://api.github.com/users/HewlettPackard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HewlettPackard/subscriptions","organizations_url":"https://api.github.com/users/HewlettPackard/orgs","repos_url":"https://api.github.com/users/HewlettPackard/repos","events_url":"https://api.github.com/users/HewlettPackard/events{/privacy}","received_events_url":"https://api.github.com/users/HewlettPackard/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HewlettPackard/gas","description":"Go AST Scanner","fork":false,"url":"https://api.github.com/repos/HewlettPackard/gas","forks_url":"https://api.github.com/repos/HewlettPackard/gas/forks","keys_url":"https://api.github.com/repos/HewlettPackard/gas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HewlettPackard/gas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HewlettPackard/gas/teams","hooks_url":"https://api.github.com/repos/HewlettPackard/gas/hooks","issue_events_url":"https://api.github.com/repos/HewlettPackard/gas/issues/events{/number}","events_url":"https://api.github.com/repos/HewlettPackard/gas/events","assignees_url":"https://api.github.com/repos/HewlettPackard/gas/assignees{/user}","branches_url":"https://api.github.com/repos/HewlettPackard/gas/branches{/branch}","tags_url":"https://api.github.com/repos/HewlettPackard/gas/tags","blobs_url":"https://api.github.com/repos/HewlettPackard/gas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HewlettPackard/gas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HewlettPackard/gas/git/refs{/sha}","trees_url":"https://api.github.com/repos/HewlettPackard/gas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HewlettPackard/gas/statuses/{sha}","languages_url":"https://api.github.com/repos/HewlettPackard/gas/languages","stargazers_url":"https://api.github.com/repos/HewlettPackard/gas/stargazers","contributors_url":"https://api.github.com/repos/HewlettPackard/gas/contributors","subscribers_url":"https://api.github.com/repos/HewlettPackard/gas/subscribers","subscription_url":"https://api.github.com/repos/HewlettPackard/gas/subscription","commits_url":"https://api.github.com/repos/HewlettPackard/gas/commits{/sha}","git_commits_url":"https://api.github.com/repos/HewlettPackard/gas/git/commits{/sha}","comments_url":"https://api.github.com/repos/HewlettPackard/gas/comments{/number}","issue_comment_url":"https://api.github.com/repos/HewlettPackard/gas/issues/comments{/number}","contents_url":"https://api.github.com/repos/HewlettPackard/gas/contents/{+path}","compare_url":"https://api.github.com/repos/HewlettPackard/gas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HewlettPackard/gas/merges","archive_url":"https://api.github.com/repos/HewlettPackard/gas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HewlettPackard/gas/downloads","issues_url":"https://api.github.com/repos/HewlettPackard/gas/issues{/number}","pulls_url":"https://api.github.com/repos/HewlettPackard/gas/pulls{/number}","milestones_url":"https://api.github.com/repos/HewlettPackard/gas/milestones{/number}","notifications_url":"https://api.github.com/repos/HewlettPackard/gas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HewlettPackard/gas/labels{/name}","releases_url":"https://api.github.com/repos/HewlettPackard/gas/releases{/id}","deployments_url":"https://api.github.com/repos/HewlettPackard/gas/deployments","created_at":"2016-07-18T18:01:08Z","updated_at":"2016-08-08T03:17:09Z","pushed_at":"2016-08-08T09:06:58Z","git_url":"git://github.com/HewlettPackard/gas.git","ssh_url":"git@github.com:HewlettPackard/gas.git","clone_url":"https://github.com/HewlettPackard/gas.git","svn_url":"https://github.com/HewlettPackard/gas","homepage":null,"size":64,"stargazers_count":527,"watchers_count":527,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":5,"forks":13,"open_issues":5,"watchers":527,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/HewlettPackard/gas/pulls/35"},"html":{"href":"https://github.com/HewlettPackard/gas/pull/35"},"issue":{"href":"https://api.github.com/repos/HewlettPackard/gas/issues/35"},"comments":{"href":"https://api.github.com/repos/HewlettPackard/gas/issues/35/comments"},"review_comments":{"href":"https://api.github.com/repos/HewlettPackard/gas/pulls/35/comments"},"review_comment":{"href":"https://api.github.com/repos/HewlettPackard/gas/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/HewlettPackard/gas/pulls/35/commits"},"statuses":{"href":"https://api.github.com/repos/HewlettPackard/gas/statuses/0c2d477dd95089c687ba3237ba1b20bbacc85572"}}}}
{"actor":{"display_login":"gcmurphy"}}