Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@IndrajeetPatil
Copy link
Collaborator

I also wanted to add a test for Case-2 here, which currently isn't tested. But I couldn't come up with one.
Is it even possible for a package to be installed with a broken NAMESPACE?

## Case 2 (rare?): pkg namespace is broken in pkg::foo
# run here, not in the factory, to allow for run- vs. "compile"-time differences in package structure
namespaces <- lapply(packages, function(package) tryCatch(getNamespace(package), error = identity))
failed_namespace <- vapply(namespaces, inherits, "condition", FUN.VALUE = logical(1L))
if (any(failed_namespace)) {
lints <- c(lints, xml_nodes_to_lints(
package_nodes[failed_namespace],
source_expression = source_expression,
lint_message = vapply(namespaces[failed_namespace], conditionMessage, character(1L)),
type = "warning"
))
ns_nodes <- ns_nodes[!failed_namespace]
packages <- packages[!failed_namespace]
namespaces <- namespaces[!failed_namespace]
}

@codecov-commenter
Copy link

Codecov Report

Merging #1649 (3cf228d) into main (0af31f5) will increase coverage by 0.02%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #1649      +/-   ##
==========================================
+ Coverage   98.29%   98.31%   +0.02%     
==========================================
  Files         100      100              
  Lines        4397     4397              
==========================================
+ Hits         4322     4323       +1     
+ Misses         75       74       -1     
Impacted Files Coverage Δ
R/namespace_linter.R 91.20% <0.00%> (+1.09%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@MichaelChirico
Copy link
Collaborator

Is it even possible for a package to be installed with a broken NAMESPACE?

no, I was thinking it would run on packages under development? maybe I got mixed up when writing here. should we simplify the code instead?

@IndrajeetPatil
Copy link
Collaborator Author

should we simplify the code instead?

Yeah, I agree. I think Case 2 doesn't need to be there.

But I think we should handle it in a separate issue and PR, since the current one is quite straightforward to review and merge.

@IndrajeetPatil
Copy link
Collaborator Author

Created a new issue to track this: #1650

@MichaelChirico MichaelChirico merged commit 854b2c7 into main Oct 8, 2022
@MichaelChirico MichaelChirico deleted the test_cleanup_oct_8 branch October 8, 2022 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants