devops.cpp.checks

C++ checks module.

Functions

run_cpp_checks(rules[, config, dirs])

Run C++ checks based on the provided rules.

run_file_rules(rules, file)

Run file-based C++ checks on a given file.

run_line_checks(rules, file)

Run line-based C++ checks on a given file.

Exceptions

CppCheckError

Custom exception for C++ check errors.

exception devops.cpp.checks.CppCheckError[source]

Bases: Exception

Custom exception for C++ check errors.

devops.cpp.checks.run_line_checks(rules, file)[source]

Run line-based C++ checks on a given file.

Parameters:
  • rules (list[Rule]) – The list of rules to apply.

  • file (Path) – The file to check.

Returns:

list[ResultType] – The list of results from the checks.

Raises:

CppCheckError – If a non-line rule is provided.

Return type:

list[ResultType]

devops.cpp.checks.run_file_rules(rules, file)[source]

Run file-based C++ checks on a given file.

Parameters:
  • rules (list[Rule]) – The list of rules to apply.

  • file (Path) – The file to check.

Returns:

list[ResultType] – The list of results from the checks.

Raises:

CppCheckError – If a non-file rule is provided.

Return type:

list[ResultType]

devops.cpp.checks.run_cpp_checks(rules, config=CppConfig(style_checks=True, license_header_check=True, license_header=None, check_only_staged_files=False, header_guards_according_to_filepath=False), dirs=None)[source]

Run C++ checks based on the provided rules.

Returns immediately after encountering the first file with errors.

Parameters:
  • rules (list[Rule]) – The list of rules to apply.

  • config (CppConfig) – The global C++ configuration.

  • dirs (list[Path] | None)

Raises:

CppCheckError – If invalid (non-file or non-line) rules are provided.

Returns:

bool – True if all checks pass, False if any check fails.

Return type:

bool