tasks/system_probe.py
def clang_format(ctx, targets=None, fix=False, fail_on_issue=False):
    """
    Format C code using clang-format
    """
    ctx.run("which clang-format")
    if isinstance(targets, str):
        # when this function is called from the command line, targets are passed
        # as comma separated tokens in a string
        targets = targets.split(',')

    if not targets:
        targets = get_ebpf_targets()

    # remove externally maintained files
    ignored_files = ["pkg/ebpf/c/bpf_helpers.h", "pkg/ebpf/c/bpf_endian.h", "pkg/ebpf/compiler/clang-stdarg.h"]
    for f in ignored_files:
        if f in targets:
            targets.remove(f)

    fmt_cmd = "clang-format -i --style=file --fallback-style=none"
    if not fix:
        fmt_cmd = fmt_cmd + " --dry-run"
    if fail_on_issue:
        fmt_cmd = fmt_cmd + " --Werror"

    ctx.run(f"{fmt_cmd} {' '.join(targets)}")

    Format C code using clang-format
    
Format C code using clang-format
Format C code using clang - format
def clang_format(ctx, targets=None, fix=False, fail_on_issue=False):
    ctx.run("which clang-format")
    if isinstance(targets, str):
        targets = targets.split(',')
    if not targets:
        targets = get_ebpf_targets()
    ignored_files = ["pkg/ebpf/c/bpf_helpers.h", "pkg/ebpf/c/bpf_endian.h", "pkg/ebpf/compiler/clang-stdarg.h"]
    for f in ignored_files:
        if f in targets:
            targets.remove(f)
    fmt_cmd = "clang-format -i --style=file --fallback-style=none"
    if not fix:
        fmt_cmd = fmt_cmd + " --dry-run"
    if fail_on_issue:
        fmt_cmd = fmt_cmd + " --Werror"
    ctx.run(f"{fmt_cmd} {' '.join(targets)}")
def clang_format ( ctx , targets = None , fix = False , fail_on_issue = False ) : ctx . run ( "which clang-format" ) if isinstance ( targets , str ) : targets = targets . split ( ',' ) if not targets : targets = get_ebpf_targets ( ) ignored_files = [ "pkg/ebpf/c/bpf_helpers.h" , "pkg/ebpf/c/bpf_endian.h" , "pkg/ebpf/compiler/clang-stdarg.h" ] for f in ignored_files : if f in targets : targets . remove ( f ) fmt_cmd = "clang-format -i --style=file --fallback-style=none" if not fix : fmt_cmd = fmt_cmd + " --dry-run" if fail_on_issue : fmt_cmd = fmt_cmd + " --Werror" ctx . run ( f"{fmt_cmd} {' '.join(targets)}" )
Format C code using clang-format
Format C code using clang - format
"""
    Format C code using clang-format
    """ # when this function is called from the command line, targets are passed # as comma separated tokens in a string # remove externally maintained files
ctx
targets
fix
fail_on_issue