diff --git a/docs/404.html b/docs/404.html index 156ab50f..4cbf1f1e 100644 --- a/docs/404.html +++ b/docs/404.html @@ -6,12 +6,11 @@
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
+pkgnet is an R package for analyzing R packages using graph theory. It builds network representations of packages to: - Analyze function interdependencies within a package - Map recursive package dependencies - Trace class inheritance structures (S4, R5/Reference Classes, R6) - Prioritize functions for unit testing based on centrality metrics
+The core functionality is CreatePackageReport() which generates HTML reports analyzing package structure.
The package uses an object-oriented architecture built on R6 classes with a hierarchical reporter system:
+Base Classes: - AbstractPackageReporter (R/AbstractPackageReporter.R): Base class for all reporters. Handles package setup via set_package() method. - AbstractGraphReporter (R/AbstractGraphReporter.R): Extends AbstractPackageReporter for network-based reporters. Provides nodes, edges, network_measures, and pkg_graph active bindings.
Concrete Reporters: - DependencyReporter (R/DependencyReporter.R): Analyzes recursive package dependencies - FunctionReporter (R/FunctionReporter.R): Maps function call networks and test coverage - InheritanceReporter (R/InheritanceReporter.R): Traces S4/R5/R6 class inheritance
Report Generation: - PackageReport (R/CreatePackageReport.R): Aggregates multiple reporters and renders HTML via rmarkdown - CreatePackageReport(): Convenience function that instantiates PackageReport with default reporters
DirectedGraph class (R/GraphClasses.R) wraps igraph functionality and provides: - Node and graph measure calculations - Network visualization via visNetwork - Integration with reporter system
set_package() → extract nodes/edges → calculate measures → rendernodes, edges, and network_measures
+:: namespace operator (e.g., data.table::data.table())DT suffix (e.g., nodesDT)Run full test suite (builds tarball and runs R CMD check):
+ +This script: - Builds package tarball with R CMD build - Runs R CMD check --as-cran in isolated directory - Fails if any WARNINGs found - Fails if NOTEs exceed allowed count (currently 0)
Run tests interactively in R:
+
+# Set to run NOT_CRAN tests
+Sys.setenv(NOT_CRAN = "true")
+
+# Run all tests
+devtools::test()
+
+# Run specific test file
+devtools::test(filter = "FunctionReporter")Tests use a temporary package library (PKGNET_TEST_LIB) with fake test packages (baseballstats, sartre, milne). Setup/teardown in: - tests/testthat/setup-setTestEnv.R - tests/testthat/teardown-setTestEnv.R
On CRAN, only test-cran-true.R runs due to complications with temporary package handling.
+covr::package_coverage()FunctionReporter)CreatePackageReport)set_package, pkg_name)DT (e.g., nodesDT):: namespacing for non-base calls#' @importFrom package function in roxygen docs%>% and := don’t need namespacingImports
+Functions require: - #' @title - #' @name - #' @description - #' @param (for each parameter) - #' @export (if public API)
R6 Classes require sections: - #' @section Class Constructor: - #' @section Public Methods: - #' @section Public Members: - Document all public methods and active bindings
FunctionReporter treats R6 methods as functions with naming convention: - Format: <classname>$<methodtype>$<methodname> - Example: FunctionReporter$private$extract_nodes - Uses generator object name from namespace, not classname attribute
InheritanceReporter naming: - Reference Classes: Uses Class arg from setRefClass() - R6 Classes: Uses generator object name in namespace (not classname arg)
Follows semantic versioning (MAJOR.MINOR.PATCH): - Development versions append .9999 (e.g., 0.5.0.9999) - Release versions remove .9999 for CRAN submission
GitHub Actions workflows: - .github/workflows/ci.yml: Tests on Ubuntu/macOS with R release - .github/workflows/release.yml: Tests on R-devel for CRAN submission - .github/workflows/smoke-tests.yaml: Runs CreatePackageReport() on many packages - .github/workflows/website.yaml: Builds pkgdown site