Skip to main content
To rename a check in Prowler, follow these steps when aligning with Check ID structure, fixing typos, or updating check logic that requires a new name. When changing a Check ID, update the following files:

Update Check Folder Structure

First, rename the check folder with the new check name. Path: prowler/providers/<provider>/services/<service>/<check_name> Example:
Next, rename the file that contains the check logic. Inside that file, also rename the class name to match the new check name. Path: prowler/providers/<provider>/services/<service>/<check_name>/<check_name>.py Example:
Then, rename the file that contains the check metadata. Inside that file, add the old check name as an alias in the CheckAliases field and modify the CheckID to the new check name. Path: prowler/providers/<provider>/services/<service>/<check_name>/<check_name>.metadata.json Example:

Update Test Files

Second, rename the tests folder with the new check name. Path: tests/providers/<provider>/services/<service>/<check_name> Example:
Next, rename the test file that contains all the unit tests. Inside that file, rename all appearances of the old check name to the new check name. Path: tests/providers/<provider>/services/<service>/<check_name>/<check_name>_test.py Example:
Important: Update all references to the old check name in the test file, including:
  • Import statements at the top of the file
  • Class name in the test class
  • Any function calls to the check
  • Any string references to the check name
  • Mock patches that reference the check
Complete example of all changes needed in test files:

Update Compliance Mappings

Finally, rename all appearances of the old check name to the new check name inside any compliance framework where the check is mapped.
  • prowler/compliance/<service>/<compliance_where_the_check_is_mapped>.json
Example:
The development compliance file may contain examples of the check being renamed. If so, modify this file as well:
  • api/src/backend/api/fixtures/dev/7_dev_compliance.json