<commit_before>#!/usr/bin/python

import subprocess
import sys
import json
import optparse
import os
import multiprocessing
import re
from multiprocessing.pool import ThreadPool

enabled_checks = [
    'readability-named-parameter',
    #'clang-analyzer-*',
    #'performance-*',
    #'bugprone-*',
    #'cert-*',
    #'cppcoreguidelines-*',
    #'hicpp-*',
    #'modernize-*',
    #'portability-*',
    #'readability-*',
    #'readability-container-size-empty',
    #'readability-inconsistent-declaration-parameter-name',
]

disabled_checks = [
    '*-array-to-pointer-decay',
    '*-avoid-c-arrays',
    '*-braces-around-statements', # should fix
    '*-no-array-decay',
    '*-else-after-return',
    '*-function-size', # don't care
    'readability-implicit-bool-conversion', # maybe fix this
    'bugprone-easily-swappable-parameters',
    'bugprone-implicit-widening-of-multiplication-result',
    'cppcoreguidelines-pro-bounds-pointer-arithmetic',
    'cppcoreguidelines-pro-bounds-constant-array-index',
    'modernize-pass-by-value',
    'modernize-use-trailing-return-type',
    'readability-isolate-declaration',
    'performance-inefficient-string-concatenation',
    'performance-no-int-to-ptr',
    'readability-function-cognitive-complexity', # bogus
    'portability-simd-intrinsics', # not a problem
    '*-magic-numbers', # not a problem
    'hicpp-signed-bitwise', # djb shit
    'cppcoreguidelines-pro-type-reinterpret-cast', # not possible thanks though
    'cert-err58-cpp' # shut up whiner
    'modernize-return-braced-init-list', # thanks I hate it
]

def create_check_option(enabled, disabled):
    return ','.join(enabled) + ',' + ','.join(['-' + d for d in disabled])

def load_compile_commands(build_dir):
    compile_commands_file = os.path.join(build_dir, 'compile_commands.json')

    compile_commands = open(compile_commands_file).read()
    # hack for configure.py generating invalid JSON
    compile_commands = re.sub(r',\n+]', '\n]', compile_commands)<commit_msg>Update clang-tidy config<commit_after>#!/usr/bin/python

import subprocess
import sys
import json
import optparse
import os
import multiprocessing
import re
from multiprocessing.pool import ThreadPool

enabled_checks = [
    'clang-analyzer-*',
    'performance-*',
    'bugprone-*',
    'cert-*',
    'cppcoreguidelines-*',
    #'hicpp-*',
    #'modernize-*',
    'portability-*',
    #'readability-*',
    'readability-container-size-empty',
    #'readability-inconsistent-declaration-parameter-name',
]

disabled_checks = [
    '*-array-to-pointer-decay',
    '*-avoid-c-arrays',
    '*-braces-around-statements', # should fix
    '*-no-array-decay',
    '*-else-after-return',
    '*-function-size', # don't care
    'readability-implicit-bool-conversion', # maybe fix this
    'bugprone-easily-swappable-parameters',
    'bugprone-implicit-widening-of-multiplication-result',
    'cppcoreguidelines-pro-bounds-pointer-arithmetic',
    'cppcoreguidelines-pro-bounds-constant-array-index',
    'modernize-pass-by-value',
    'modernize-use-trailing-return-type',
    'readability-isolate-declaration',
    'performance-inefficient-string-concatenation',
    'performance-no-int-to-ptr',
    'readability-function-cognitive-complexity', # bogus
    'portability-simd-intrinsics', # not a problem
    'bugprone-macro-parenthesis', # should be fixed (using inline/constexpr)
    '*-magic-numbers', # not a problem
    'hicpp-signed-bitwise', # djb shit
    'cppcoreguidelines-pro-type-reinterpret-cast', # not possible thanks though
    'cert-err58-cpp', # shut up whiner
    'modernize-return-braced-init-list', # thanks I hate it
]

def create_check_option(enabled, disabled):
    return ','.join(enabled) + ',' + ','.join(['-' + d for d in disabled])

def load_compile_commands(build_dir):
    compile_commands_file = os.path.join(build_dir, 'compile_commands.json')

    compile_commands = open(compile_commands_file).read()
    # hack for configure.py generating invalid JSON
    compile_commands = re.sub(r',\n+]', '\n]', compile_commands)
{'fraction_non_alphanumeric': 0.1540934949295078, 'fraction_numerical': 0.0009893643334157804, 'mean_word_length': 3.901818181818182, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3925591', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1322, 'n_words': 228}