Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/ammen99/clang-format-auto-infer
/ functions
Functions
31 in github.com/ammen99/clang-format-auto-infer
⨍
Functions
31
◇
Types & classes
9
↓ 5 callers
Function
generate_clang_format_config
Generates a YAML string for a .clang-format file from a flat dictionary of options. Reconstructs nested dictionaries from dot-separated names
src/clang_format_parser.py:80
↓ 5 callers
Function
run_command
Runs a subprocess command and optionally prints it if debug is enabled. Args: cmd (list): The command and its arguments. cap
src/utils.py:5
↓ 4 callers
Function
run_clang_format_and_count_changes
Runs a clang-format configuration on a repository, counts changes, and resets. Args: config_string (str): The clang-format configura
src/repo_formatter.py:15
↓ 3 callers
Function
parse_clang_format_options
Parses the YAML output from 'clang-format --dump-config' and flattens it. Nested dictionaries are represented with dot-separated keys (e.g.,
src/clang_format_parser.py:36
↓ 2 callers
Function
get_clang_format_options
Runs 'clang-format --dump-config' to get a list of all possible options. Args: debug (bool): Enable debug output for run_command.
src/clang_format_parser.py:7
↓ 2 callers
Function
load_forced_options
Loads forced clang-format options from a YAML file and flattens the structure. Nested dictionaries are represented with dot-separated keys (e
src/config_loader.py:41
↓ 2 callers
Function
load_json_option_values
Loads clang-format option values and possible values from a JSON file. Args: file_path (str): Path to the JSON file. Returns:
src/config_loader.py:6
↓ 2 callers
Method
optimize
Optimizes clang-format configuration using Nevergrad. Args: base_options_info (dict): The initial flat dictionary from c
src/nevergrad_optimizer.py:114
↓ 2 callers
Function
optimize_option_with_values
Optimizes a single option by testing each value in the provided list. If multiple values yield the same minimum changes, one is randomly sele
src/optimizer.py:23
↓ 1 callers
Function
_evolve_island_generation_task
Helper function to evolve a single island for one generation. This function is called by the multiprocessing pool. Args: island_
src/optimizer.py:215
↓ 1 callers
Function
_extract_option_details
Extracts option details (name, type, possible values) from a given BeautifulSoup tag. Handles both top-level options (from dd tags) and neste
get_option_values.py:17
↓ 1 callers
Function
_perform_migration
Performs migration between islands. Each island sends its best individual to a randomly chosen other island, replacing a random individua
src/optimizer.py:310
↓ 1 callers
Function
create_dummy_repo
Creates a dummy git repository with a C++ file for testing.
test.py:19
↓ 1 callers
Function
crossover
Performs a uniform crossover between two parent configurations. For each option, randomly picks the value from parent1 or parent2.
src/optimizer.py:128
↓ 1 callers
Function
fetch_html_content
Fetches HTML content from a given URL.
get_option_values.py:7
↓ 1 callers
Function
find_options_without_json_values
Finds options in the flat dump-config structure that are not in the JSON lookup or have no possible values listed (excluding booleans which a
main.py:24
↓ 1 callers
Function
flatten_dict
(data, current_path="")
src/config_loader.py:69
↓ 1 callers
Function
flatten_dict
(data, current_path="")
src/clang_format_parser.py:58
↓ 1 callers
Function
main
()
test.py:57
↓ 1 callers
Function
main
Parses command-line arguments and runs the clang-format optimization tool.
main.py:49
↓ 1 callers
Function
mutate
Mutates an individual by selecting one random mutable option and optimizing its value by testing all possible values using optimize_option_wi
src/optimizer.py:143
↓ 1 callers
Function
parse_options
Parses HTML content to extract clang-format options and their values.
get_option_values.py:161
Method
__init__
(self, config: GeneticOptimizationConfig)
src/optimizer.py:376
Method
__init__
(self, config: NevergradConfig)
src/nevergrad_optimizer.py:29
Method
__init__
(self, config: BaseOptimizerConfig)
src/base_optimizer.py:10
Function
_island_evolution_task_wrapper
Wrapper function for multiprocessing.Pool.map. It unpacks arguments, determines the worker's specific repo_path and process_id, creates a
src/optimizer.py:277
Method
_nevergrad_objective_function
The objective function to be minimized by Nevergrad. It takes Nevergrad's parameters, converts them to a clang-format config,
src/nevergrad_optimizer.py:34
Method
_refill_queue
()
src/nevergrad_optimizer.py:250
Method
_submit_next_evaluation
()
src/nevergrad_optimizer.py:238
Method
optimize
Optimizes clang-format configuration using a genetic algorithm with an island model. Args: base_options_info (dict): The
src/optimizer.py:380
Method
optimize
Abstract method to optimize clang-format configuration. Args: base_options_info (dict): The initial flat dictionary from
src/base_optimizer.py:14