{"action":"created","comment":{"url":"https://api.github.com/repos/PecanProject/pecan/pulls/comments/83765318","pull_request_review_id":4586818,"id":83765318,"diff_hunk":"@@ -154,47 +162,53 @@ dbfile.input.insert <- function(in.path, in.prefix, siteid, startdate, enddate,\n ##' \\dontrun{\n ##'   dbfile.input.check(siteid, startdate, enddate, 'application/x-RData', 'traits', dbcon)\n ##' }\n-dbfile.input.check <- function(siteid, startdate=NULL, enddate=NULL, mimetype, formatname, parentid=NA, \n-                               con, hostname=fqdn(), ignore.dates=FALSE) {\n-  if (hostname == \"localhost\") hostname <- fqdn();\n-\n-  mimetypeid <- get.id('mimetypes', 'type_string', mimetype, con = con)\n+dbfile.input.check <- function(siteid, startdate = NULL, enddate = NULL, mimetype, \n+                               formatname, parentid = NA, con, hostname = fqdn(), ignore.dates = FALSE) {\n+  if (hostname == \"localhost\") {\n+    hostname <- fqdn()\n+  }\n+  \n+  mimetypeid <- get.id(\"mimetypes\", \"type_string\", mimetype, con = con)\n   if (is.null(mimetypeid)) {\n     return(invisible(data.frame()))\n   }\n   \n   # find appropriate format\n-  formatid <- get.id('formats', c(\"mimetype_id\", \"name\"), c(mimetypeid, formatname), con) \n+  formatid <- get.id(\"formats\", c(\"mimetype_id\", \"name\"),\n+                     c(mimetypeid, formatname), \n+                     con)\n   if (is.null(formatid)) {\n-    invisible(data.frame())\n+    return(invisible(data.frame()))\n   }\n-\n+  \n   # setup parent part of query if specified\n   if (is.na(parentid)) {\n     parent <- \"\"\n   } else {\n     parent <- paste0(\" AND parent_id=\", parentid)\n   }\n-\n+  \n   # find appropriate input\n-  if(ignore.dates) {\n-    inputid <- db.query(paste0(\n-      \"SELECT id FROM inputs WHERE site_id=\", siteid, \" AND format_id=\", formatid, parent), con)[['id']]\n+  if (ignore.dates) {\n+    inputid <- db.query(paste0(\"SELECT id FROM inputs WHERE site_id=\", siteid, \n+                               \" AND format_id=\", formatid, parent), con)[[\"id\"]]\n   } else {\n-    inputid <- db.query(paste0(\n-      \"SELECT id FROM inputs WHERE site_id=\", siteid, \" AND format_id=\", formatid,\n-      \" AND start_date>='\", startdate, \"' AND end_date<='\", enddate, \"'\", parent), con)[['id']]\n+    inputid <- db.query(paste0(\"SELECT id FROM inputs WHERE site_id=\", siteid, \n+                               \" AND format_id=\", formatid, \n+                               \" AND start_date>='\", startdate, \n+                               \"' AND end_date<='\", enddate, \"'\", parent), con)[[\"id\"]]\n   }\n   if (is.null(inputid)) {\n-    invisible(data.frame())\n+    return(invisible(data.frame()))","path":"db/R/dbfiles.R","position":251,"original_position":251,"commit_id":"e97e18ffdbcee05ccec268248d7d00cc21d2530a","original_commit_id":"3e7a07922a76768e7a835e349bd1255495d54fd7","user":{"login":"robkooper","id":1580696,"avatar_url":"https://avatars.githubusercontent.com/u/1580696?v=3","gravatar_id":"","url":"https://api.github.com/users/robkooper","html_url":"https://github.com/robkooper","followers_url":"https://api.github.com/users/robkooper/followers","following_url":"https://api.github.com/users/robkooper/following{/other_user}","gists_url":"https://api.github.com/users/robkooper/gists{/gist_id}","starred_url":"https://api.github.com/users/robkooper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robkooper/subscriptions","organizations_url":"https://api.github.com/users/robkooper/orgs","repos_url":"https://api.github.com/users/robkooper/repos","events_url":"https://api.github.com/users/robkooper/events{/privacy}","received_events_url":"https://api.github.com/users/robkooper/received_events","type":"User","site_admin":false},"body":"I sort of agree with them, I had always thought that invisible would return as well, until I realized some of my code does not work. So I do think having an explicit return(invisible()) is a good thing.","created_at":"2016-10-18T00:58:56Z","updated_at":"2016-10-18T00:58:56Z","html_url":"https://github.com/PecanProject/pecan/pull/1091#discussion_r83765318","pull_request_url":"https://api.github.com/repos/PecanProject/pecan/pulls/1091","_links":{"self":{"href":"https://api.github.com/repos/PecanProject/pecan/pulls/comments/83765318"},"html":{"href":"https://github.com/PecanProject/pecan/pull/1091#discussion_r83765318"},"pull_request":{"href":"https://api.github.com/repos/PecanProject/pecan/pulls/1091"}}},"pull_request":{"url":"https://api.github.com/repos/PecanProject/pecan/pulls/1091","id":89550088,"html_url":"https://github.com/PecanProject/pecan/pull/1091","diff_url":"https://github.com/PecanProject/pecan/pull/1091.diff","patch_url":"https://github.com/PecanProject/pecan/pull/1091.patch","issue_url":"https://api.github.com/repos/PecanProject/pecan/issues/1091","number":1091,"state":"open","locked":false,"title":"Style cleanup for `db/R/*.R` scripts ","user":{"login":"bpbond","id":1956468,"avatar_url":"https://avatars.githubusercontent.com/u/1956468?v=3","gravatar_id":"","url":"https://api.github.com/users/bpbond","html_url":"https://github.com/bpbond","followers_url":"https://api.github.com/users/bpbond/followers","following_url":"https://api.github.com/users/bpbond/following{/other_user}","gists_url":"https://api.github.com/users/bpbond/gists{/gist_id}","starred_url":"https://api.github.com/users/bpbond/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bpbond/subscriptions","organizations_url":"https://api.github.com/users/bpbond/orgs","repos_url":"https://api.github.com/users/bpbond/repos","events_url":"https://api.github.com/users/bpbond/events{/privacy}","received_events_url":"https://api.github.com/users/bpbond/received_events","type":"User","site_admin":false},"body":"Ran through formatR::tidy_dir with arrow=TRUE and indent=2; made sure all if blocks have braces. Tried to make sure formatR didn’t make things too jaggy. Substituted `seq_len`, `seq_along`, and `paste0`, and `file.path` as necessary. Made sure all functions end with an explicit `return`.","created_at":"2016-10-17T01:49:50Z","updated_at":"2016-10-18T00:58:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2da44337a23fe0c3f9b24e8e4c1d3891c28a5ec6","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/PecanProject/pecan/pulls/1091/commits","review_comments_url":"https://api.github.com/repos/PecanProject/pecan/pulls/1091/comments","review_comment_url":"https://api.github.com/repos/PecanProject/pecan/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PecanProject/pecan/issues/1091/comments","statuses_url":"https://api.github.com/repos/PecanProject/pecan/statuses/e97e18ffdbcee05ccec268248d7d00cc21d2530a","head":{"label":"bpbond:style-update-db","ref":"style-update-db","sha":"e97e18ffdbcee05ccec268248d7d00cc21d2530a","user":{"login":"bpbond","id":1956468,"avatar_url":"https://avatars.githubusercontent.com/u/1956468?v=3","gravatar_id":"","url":"https://api.github.com/users/bpbond","html_url":"https://github.com/bpbond","followers_url":"https://api.github.com/users/bpbond/followers","following_url":"https://api.github.com/users/bpbond/following{/other_user}","gists_url":"https://api.github.com/users/bpbond/gists{/gist_id}","starred_url":"https://api.github.com/users/bpbond/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bpbond/subscriptions","organizations_url":"https://api.github.com/users/bpbond/orgs","repos_url":"https://api.github.com/users/bpbond/repos","events_url":"https://api.github.com/users/bpbond/events{/privacy}","received_events_url":"https://api.github.com/users/bpbond/received_events","type":"User","site_admin":false},"repo":{"id":70360084,"name":"pecan","full_name":"bpbond/pecan","owner":{"login":"bpbond","id":1956468,"avatar_url":"https://avatars.githubusercontent.com/u/1956468?v=3","gravatar_id":"","url":"https://api.github.com/users/bpbond","html_url":"https://github.com/bpbond","followers_url":"https://api.github.com/users/bpbond/followers","following_url":"https://api.github.com/users/bpbond/following{/other_user}","gists_url":"https://api.github.com/users/bpbond/gists{/gist_id}","starred_url":"https://api.github.com/users/bpbond/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bpbond/subscriptions","organizations_url":"https://api.github.com/users/bpbond/orgs","repos_url":"https://api.github.com/users/bpbond/repos","events_url":"https://api.github.com/users/bpbond/events{/privacy}","received_events_url":"https://api.github.com/users/bpbond/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bpbond/pecan","description":"The Predictive Ecosystem Analyzer (PEcAn) is an integrated ecological bioinformatics toolbox.","fork":true,"url":"https://api.github.com/repos/bpbond/pecan","forks_url":"https://api.github.com/repos/bpbond/pecan/forks","keys_url":"https://api.github.com/repos/bpbond/pecan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bpbond/pecan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bpbond/pecan/teams","hooks_url":"https://api.github.com/repos/bpbond/pecan/hooks","issue_events_url":"https://api.github.com/repos/bpbond/pecan/issues/events{/number}","events_url":"https://api.github.com/repos/bpbond/pecan/events","assignees_url":"https://api.github.com/repos/bpbond/pecan/assignees{/user}","branches_url":"https://api.github.com/repos/bpbond/pecan/branches{/branch}","tags_url":"https://api.github.com/repos/bpbond/pecan/tags","blobs_url":"https://api.github.com/repos/bpbond/pecan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bpbond/pecan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bpbond/pecan/git/refs{/sha}","trees_url":"https://api.github.com/repos/bpbond/pecan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bpbond/pecan/statuses/{sha}","languages_url":"https://api.github.com/repos/bpbond/pecan/languages","stargazers_url":"https://api.github.com/repos/bpbond/pecan/stargazers","contributors_url":"https://api.github.com/repos/bpbond/pecan/contributors","subscribers_url":"https://api.github.com/repos/bpbond/pecan/subscribers","subscription_url":"https://api.github.com/repos/bpbond/pecan/subscription","commits_url":"https://api.github.com/repos/bpbond/pecan/commits{/sha}","git_commits_url":"https://api.github.com/repos/bpbond/pecan/git/commits{/sha}","comments_url":"https://api.github.com/repos/bpbond/pecan/comments{/number}","issue_comment_url":"https://api.github.com/repos/bpbond/pecan/issues/comments{/number}","contents_url":"https://api.github.com/repos/bpbond/pecan/contents/{+path}","compare_url":"https://api.github.com/repos/bpbond/pecan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bpbond/pecan/merges","archive_url":"https://api.github.com/repos/bpbond/pecan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bpbond/pecan/downloads","issues_url":"https://api.github.com/repos/bpbond/pecan/issues{/number}","pulls_url":"https://api.github.com/repos/bpbond/pecan/pulls{/number}","milestones_url":"https://api.github.com/repos/bpbond/pecan/milestones{/number}","notifications_url":"https://api.github.com/repos/bpbond/pecan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bpbond/pecan/labels{/name}","releases_url":"https://api.github.com/repos/bpbond/pecan/releases{/id}","deployments_url":"https://api.github.com/repos/bpbond/pecan/deployments","created_at":"2016-10-08T22:10:19Z","updated_at":"2016-10-08T22:10:24Z","pushed_at":"2016-10-17T23:36:25Z","git_url":"git://github.com/bpbond/pecan.git","ssh_url":"git@github.com:bpbond/pecan.git","clone_url":"https://github.com/bpbond/pecan.git","svn_url":"https://github.com/bpbond/pecan","homepage":"www.pecanproject.org","size":123442,"stargazers_count":0,"watchers_count":0,"language":"R","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":"PecanProject:master","ref":"master","sha":"3d8cfba22c4214b133fa78c9607b4aaf79f7067d","user":{"login":"PecanProject","id":2879854,"avatar_url":"https://avatars.githubusercontent.com/u/2879854?v=3","gravatar_id":"","url":"https://api.github.com/users/PecanProject","html_url":"https://github.com/PecanProject","followers_url":"https://api.github.com/users/PecanProject/followers","following_url":"https://api.github.com/users/PecanProject/following{/other_user}","gists_url":"https://api.github.com/users/PecanProject/gists{/gist_id}","starred_url":"https://api.github.com/users/PecanProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PecanProject/subscriptions","organizations_url":"https://api.github.com/users/PecanProject/orgs","repos_url":"https://api.github.com/users/PecanProject/repos","events_url":"https://api.github.com/users/PecanProject/events{/privacy}","received_events_url":"https://api.github.com/users/PecanProject/received_events","type":"Organization","site_admin":false},"repo":{"id":6857384,"name":"pecan","full_name":"PecanProject/pecan","owner":{"login":"PecanProject","id":2879854,"avatar_url":"https://avatars.githubusercontent.com/u/2879854?v=3","gravatar_id":"","url":"https://api.github.com/users/PecanProject","html_url":"https://github.com/PecanProject","followers_url":"https://api.github.com/users/PecanProject/followers","following_url":"https://api.github.com/users/PecanProject/following{/other_user}","gists_url":"https://api.github.com/users/PecanProject/gists{/gist_id}","starred_url":"https://api.github.com/users/PecanProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PecanProject/subscriptions","organizations_url":"https://api.github.com/users/PecanProject/orgs","repos_url":"https://api.github.com/users/PecanProject/repos","events_url":"https://api.github.com/users/PecanProject/events{/privacy}","received_events_url":"https://api.github.com/users/PecanProject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PecanProject/pecan","description":"The Predictive Ecosystem Analyzer (PEcAn) is an integrated ecological bioinformatics toolbox.","fork":false,"url":"https://api.github.com/repos/PecanProject/pecan","forks_url":"https://api.github.com/repos/PecanProject/pecan/forks","keys_url":"https://api.github.com/repos/PecanProject/pecan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PecanProject/pecan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PecanProject/pecan/teams","hooks_url":"https://api.github.com/repos/PecanProject/pecan/hooks","issue_events_url":"https://api.github.com/repos/PecanProject/pecan/issues/events{/number}","events_url":"https://api.github.com/repos/PecanProject/pecan/events","assignees_url":"https://api.github.com/repos/PecanProject/pecan/assignees{/user}","branches_url":"https://api.github.com/repos/PecanProject/pecan/branches{/branch}","tags_url":"https://api.github.com/repos/PecanProject/pecan/tags","blobs_url":"https://api.github.com/repos/PecanProject/pecan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PecanProject/pecan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PecanProject/pecan/git/refs{/sha}","trees_url":"https://api.github.com/repos/PecanProject/pecan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PecanProject/pecan/statuses/{sha}","languages_url":"https://api.github.com/repos/PecanProject/pecan/languages","stargazers_url":"https://api.github.com/repos/PecanProject/pecan/stargazers","contributors_url":"https://api.github.com/repos/PecanProject/pecan/contributors","subscribers_url":"https://api.github.com/repos/PecanProject/pecan/subscribers","subscription_url":"https://api.github.com/repos/PecanProject/pecan/subscription","commits_url":"https://api.github.com/repos/PecanProject/pecan/commits{/sha}","git_commits_url":"https://api.github.com/repos/PecanProject/pecan/git/commits{/sha}","comments_url":"https://api.github.com/repos/PecanProject/pecan/comments{/number}","issue_comment_url":"https://api.github.com/repos/PecanProject/pecan/issues/comments{/number}","contents_url":"https://api.github.com/repos/PecanProject/pecan/contents/{+path}","compare_url":"https://api.github.com/repos/PecanProject/pecan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PecanProject/pecan/merges","archive_url":"https://api.github.com/repos/PecanProject/pecan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PecanProject/pecan/downloads","issues_url":"https://api.github.com/repos/PecanProject/pecan/issues{/number}","pulls_url":"https://api.github.com/repos/PecanProject/pecan/pulls{/number}","milestones_url":"https://api.github.com/repos/PecanProject/pecan/milestones{/number}","notifications_url":"https://api.github.com/repos/PecanProject/pecan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PecanProject/pecan/labels{/name}","releases_url":"https://api.github.com/repos/PecanProject/pecan/releases{/id}","deployments_url":"https://api.github.com/repos/PecanProject/pecan/deployments","created_at":"2012-11-25T23:48:26Z","updated_at":"2016-09-29T15:14:45Z","pushed_at":"2016-10-17T23:36:25Z","git_url":"git://github.com/PecanProject/pecan.git","ssh_url":"git@github.com:PecanProject/pecan.git","clone_url":"https://github.com/PecanProject/pecan.git","svn_url":"https://github.com/PecanProject/pecan","homepage":"www.pecanproject.org","size":349213,"stargazers_count":48,"watchers_count":48,"language":"R","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":83,"mirror_url":null,"open_issues_count":216,"forks":83,"open_issues":216,"watchers":48,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PecanProject/pecan/pulls/1091"},"html":{"href":"https://github.com/PecanProject/pecan/pull/1091"},"issue":{"href":"https://api.github.com/repos/PecanProject/pecan/issues/1091"},"comments":{"href":"https://api.github.com/repos/PecanProject/pecan/issues/1091/comments"},"review_comments":{"href":"https://api.github.com/repos/PecanProject/pecan/pulls/1091/comments"},"review_comment":{"href":"https://api.github.com/repos/PecanProject/pecan/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PecanProject/pecan/pulls/1091/commits"},"statuses":{"href":"https://api.github.com/repos/PecanProject/pecan/statuses/e97e18ffdbcee05ccec268248d7d00cc21d2530a"}}}}
{"actor":{"display_login":"robkooper"}}