{"action":"created","issue":{"url":"https://api.github.com/repos/jimhester/covr/issues/113","labels_url":"https://api.github.com/repos/jimhester/covr/issues/113/labels{/name}","comments_url":"https://api.github.com/repos/jimhester/covr/issues/113/comments","events_url":"https://api.github.com/repos/jimhester/covr/issues/113/events","html_url":"https://github.com/jimhester/covr/issues/113","id":108243361,"number":113,"title":"Functions Defined Inside Structures Not Tracked","user":{"login":"brodieG","id":6105908,"avatar_url":"https://avatars.githubusercontent.com/u/6105908?v=3","gravatar_id":"","url":"https://api.github.com/users/brodieG","html_url":"https://github.com/brodieG","followers_url":"https://api.github.com/users/brodieG/followers","following_url":"https://api.github.com/users/brodieG/following{/other_user}","gists_url":"https://api.github.com/users/brodieG/gists{/gist_id}","starred_url":"https://api.github.com/users/brodieG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brodieG/subscriptions","organizations_url":"https://api.github.com/users/brodieG/orgs","repos_url":"https://api.github.com/users/brodieG/repos","events_url":"https://api.github.com/users/brodieG/events{/privacy}","received_events_url":"https://api.github.com/users/brodieG/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-25T01:03:56Z","updated_at":"2015-09-25T02:12:50Z","closed_at":null,"body":"I discovered this when the validity methods defined within `setClass` for my S4 classes as well as all methods defined for my RC classes were not tracked.  I created a package to illustrate the issue (on [github](https://github.com/brodieG/pckgA/tree/covr)):\r\n```\r\n## R/pckgA.R\r\nfun.list <- list(\r\n  a=function(x) {\r\n    y <- x + 1\r\n    y\r\n  },\r\n  b=function(x) {\r\n    y <- x + 1\r\n    y\r\n  }\r\n)\r\n#' @export\r\n\r\nfun <- function() 1 + 1\r\n\r\n## tests/test.R\r\n\r\nfun.list$a(5)\r\nfun.list$b(6)\r\nfun()\r\n```\r\nThen, after running `covr:::package_coverage`:\r\n```\r\npckgA Test Coverage: 100.00%\r\nR/pckgA.R: 100.00%\r\n```\r\neven though I'm not running the functions inside the list.  I'm using a list here because it is simpler, but the same thing happens with functions defined in:\r\n```\r\nsetClass(\r\n  ...,\r\n  validity=function(object) ...\r\n)\r\n```\r\nor in\r\n```\r\nsetRefClass(\r\n   ...,\r\n   methods=list(\r\n    a=function() ...\r\n) )\r\n```\r\n```"},"comment":{"url":"https://api.github.com/repos/jimhester/covr/issues/comments/143103879","html_url":"https://github.com/jimhester/covr/issues/113#issuecomment-143103879","issue_url":"https://api.github.com/repos/jimhester/covr/issues/113","id":143103879,"user":{"login":"brodieG","id":6105908,"avatar_url":"https://avatars.githubusercontent.com/u/6105908?v=3","gravatar_id":"","url":"https://api.github.com/users/brodieG","html_url":"https://github.com/brodieG","followers_url":"https://api.github.com/users/brodieG/followers","following_url":"https://api.github.com/users/brodieG/following{/other_user}","gists_url":"https://api.github.com/users/brodieG/gists{/gist_id}","starred_url":"https://api.github.com/users/brodieG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brodieG/subscriptions","organizations_url":"https://api.github.com/users/brodieG/orgs","repos_url":"https://api.github.com/users/brodieG/repos","events_url":"https://api.github.com/users/brodieG/events{/privacy}","received_events_url":"https://api.github.com/users/brodieG/received_events","type":"User","site_admin":false},"created_at":"2015-09-25T02:12:50Z","updated_at":"2015-09-25T02:12:50Z","body":"Actually, realized you can see this in `TestRC` in the existing package.  From `covr` working directory, run `setwd(\"tests/testthat/TestRC\")` then `shine(package_coverage()` and you can see in the file tab that the RC methods are not tracked (i.e. neither green nor red)."}}