Ensure configuration elements (environment variables, feature flags, config files) maintain consistent naming and clear documentation across code, logs, and documentation. Mismatched names between implementation and logging/documentation create confusion and debugging difficulties.
Ensure configuration elements (environment variables, feature flags, config files) maintain consistent naming and clear documentation across code, logs, and documentation. Mismatched names between implementation and logging/documentation create confusion and debugging difficulties.
When working with configuration:
Example of inconsistent naming to avoid:
// Code uses SNYK_CONFIG_FILE but logs reference TEST_CONFIG_FILE
if (!process.env.SNYK_CONFIG_FILE && !process.env.TEST_CONFIG_FILE) {
// ...
}
console.info('Snyk configuration [TEST_CONFIG_FILE] ...' + process.env.SNYK_CONFIG_FILE);
Example of proper configuration handling:
// Wrapper for CommonJS compatibility
async function callModule(mod, args) {
// Clear documentation of purpose
}
function run(root, options, featureFlags) {
// Properly propagate configuration parameters
validateProjectType(options, projectType, featureFlags);
return runTest(projectType, root, options, featureFlags);
}
Enter the URL of a public GitHub repository