Validate codecheck.yml metadata against ORCID
Source:R/validation.R
validate_codecheck_yml_orcid.RdValidate codecheck.yml metadata against ORCID
Usage
validate_codecheck_yml_orcid(
yml_file = "codecheck.yml",
strict = FALSE,
validate_authors = TRUE,
validate_codecheckers = TRUE,
skip_on_auth_error = FALSE
)Arguments
- yml_file
Path to the codecheck.yml file (defaults to "./codecheck.yml")
- strict
Logical. If
TRUE, throw an error on any mismatch. IfFALSE(default), only issue warnings.Logical. If
TRUE(default), validate author ORCIDs.- validate_codecheckers
Logical. If
TRUE(default), validate codechecker ORCIDs.- skip_on_auth_error
Logical. If
TRUE, skip validation when ORCID authentication fails instead of throwing an error. Default isFALSE, which requires ORCID authentication. Set toTRUEto allow the function to work without ORCID authentication (e.g., CI/CD pipelines, test environments).
Value
Invisibly returns a list with validation results:
- valid
Logical indicating if all checks passed
- issues
Character vector of any issues found
- skipped
Logical indicating if validation was skipped due to auth issues
Details
Validates author and codechecker information against the ORCID API. For each person with an ORCID, retrieves their ORCID record and compares the name in the ORCID record with the name in the local codecheck.yml file.
Note: This function requires access to the ORCID API. If you encounter authentication issues, you can either:
Set the
ORCID_TOKENenvironment variable with your ORCID tokenRun
rorcid::orcid_auth()to authenticate interactivelySet
skip_on_auth_error = TRUEto skip validation if authentication fails
Examples
if (FALSE) { # \dontrun{
# Validate with warnings only (requires ORCID authentication)
result <- validate_codecheck_yml_orcid()
# Validate with strict error checking
validate_codecheck_yml_orcid(strict = TRUE)
# Validate only codecheckers
validate_codecheck_yml_orcid(validate_authors = FALSE)
# Skip ORCID validation if authentication is not available
validate_codecheck_yml_orcid(skip_on_auth_error = TRUE)
} # }