Configuration naming consistency

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.

copy reviewer prompt

Prompt

Reviewer Prompt

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:

  • Use identical names in code, environment variables, logs, and documentation
  • Add clear comments explaining the purpose of configuration wrappers or compatibility functions
  • Ensure feature flags and configuration parameters are properly propagated through function calls

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);
}

Source discussions