hydra.validate.packaging module
Validation functions for modules and packages.
- hydra.validate.packaging.append_finding_module(p: ValidationProfile, acc: ValidationResult[T0], finding: object) ValidationResult[T0]
Append a rule-tagged InvalidModuleError finding to a ValidationResult, classifying as error or warning per the profile and respecting maxErrors/maxWarnings bounds.
- hydra.validate.packaging.append_finding_package(p: ValidationProfile, acc: ValidationResult[T0], finding: object) ValidationResult[T0]
Append a rule-tagged InvalidPackageError finding to a ValidationResult, classifying as error or warning per the profile and respecting maxErrors/maxWarnings bounds.
- hydra.validate.packaging.check_conflicting_module_names(pkg: Package) object
Check for module namespaces that conflict when mapped to target language paths.
- hydra.validate.packaging.check_conflicting_variant_names(mod: Module) object
Check for union variant names that, when mapped to constructor names, conflict with other type definitions.
- hydra.validate.packaging.check_definition_documentation(mod: Module) object
Check that every top-level definition is wrapped in a description annotation.
- hydra.validate.packaging.check_definition_module_names(mod: Module) object
Check that all definition names in a module have the module’s name as a prefix.
- hydra.validate.packaging.check_definition_name_convention(mod: Module) object
Check that term definitions have camelCase local names and type definitions have PascalCase local names.
- hydra.validate.packaging.check_definition_ordering(mod: Module) object
Check that a module’s definitions list is sorted in ascending lexicographic order by local name.
- hydra.validate.packaging.check_duplicate_definition_names(mod: Module) object
Check for duplicate definition names in a module.
- hydra.validate.packaging.check_duplicate_module_names(pkg: Package) object
Check for duplicate module namespaces in a package.
- hydra.validate.packaging.check_module_name_convention(mod: Module) object
Check that the module’s namespace matches the dotted-lowercase naming convention.
- hydra.validate.packaging.check_package_name_convention(pkg: Package) object
Check that the package’s name matches the hyphen-separated lowercase naming convention.
- hydra.validate.packaging.check_undeclared_dependencies(owners: Mapping[Name, ModuleName], prim_names: Set[Name], mod: Module) Sequence[InvalidPackageError]
Check a module’s definitions for free names whose owning module is not among its declared dependencies.
- hydra.validate.packaging.definition_name(def_: Definition) Name
Extract the name from a definition.
- hydra.validate.packaging.enabled_packaging(p: ValidationProfile, rule_name: Name) bool
True iff the given rule name appears in the profile’s errorRules or warningRules.
- hydra.validate.packaging.kernel_default_packaging_profile() ValidationProfile
The default validation profile for module/package validation. Every kernel-shipped check classified as an error; no warnings; maxErrors=1, maxWarnings=20.
- hydra.validate.packaging.kernel_module(mod: Module) object
Validate a kernel module against all kernel-default packaging rules; returns the first error found or nothing if valid. Convenience wrapper around ‘module’’ with ‘kernelDefaultPackagingProfile’.
- hydra.validate.packaging.kernel_package(pkg: Package) object
Validate a kernel package against all kernel-default packaging rules; returns the first error found or nothing if valid. Convenience wrapper around ‘package’ with ‘kernelDefaultPackagingProfile’.
- hydra.validate.packaging.kernel_packaging_profile_with_doc_warnings() ValidationProfile
Non-kernel packaging profile (#575): identical to kernelDefaultPackagingProfile except the rules in kernelPackagingWarningRuleNamesForNonKernel (documentation, ordering, naming convention) are warnings, not errors, so each package’s pre-existing backlog does not block sync until that package is promoted to the fully-fatal profile.
- hydra.validate.packaging.kernel_universe_undeclared_dependencies(universe: Sequence[Module], prim_names: Set[Name]) Sequence[InvalidPackageError]
Check every module in the given universe for undeclared cross-module dependencies, returning every finding.
- hydra.validate.packaging.module(p: ValidationProfile, acc0: ValidationResult[InvalidModuleError], mod: Module) ValidationResult[InvalidModuleError]
Validate a module against the given ValidationProfile, accumulating findings into a ValidationResult. Errors hard-stop the rule sequence once maxErrors is reached.
- hydra.validate.packaging.package(p: ValidationProfile, acc0: ValidationResult[InvalidPackageError], pkg: Package) ValidationResult[InvalidPackageError]
Validate a package against the given ValidationProfile, accumulating findings into a ValidationResult. Errors hard-stop traversal once maxErrors is reached.
- hydra.validate.packaging.undeclared_dependency_owners(universe: Sequence[Module]) Mapping[Name, ModuleName]
Build a map from every name defined in the universe to its owning module.