rundel / ghclass

Tools for managing classroom organizations
https://rundel.github.io/ghclass/
GNU General Public License v3.0
142 stars 22 forks source link

file versus path #60

Closed thereseanders closed 5 years ago

thereseanders commented 5 years ago

Currently, parameter names for files are not consistent across functions (some use path, others use file).

I suggest to use:

path within functions that make calls to the GitHub API (to match parameter name in API)

local_path within functions that reference local files

mine-cetinkaya-rundel commented 5 years ago

Suggestions sound good!

thereseanders commented 5 years ago

@mine-cetinkaya-rundel or @rundel, could you briefly comment on the two cases below that are not as clear-cut?

FYI, I kept files as an internal object name, for example in file_exists, and changed only user-facing attribute names. See two examples below:

file_exists = function(repo, path, branch = "master"){

  files = repo_files(repo, branch)

  purrr::map_lgl(path, ~.x %in% files[["path"]])

}

repo_get_readme = function(repo, branch = "master") {
  stopifnot(length(repo) == 1)
  stopifnot(length(branch) == 1)

  file = purrr::possibly(github_api_repo_get_readme, NULL)(repo, branch)

  extract_content(file)
}
rundel commented 5 years ago

I think we've got all of these changed now, I'm going to close this for now but let me know if you find any lingering files