def create_checks()

in dev-scripts/generate.py [0:0]


def create_checks(checks):
    generated = False

    for check in checks:
        edit_changelog = False
        include_file = check.path() + check.include()
        cpp_file = check.path() + check.cpp_filename()
        copyright = get_copyright()
        include_missing = not os.path.exists(include_file)
        cpp_missing = not os.path.exists(cpp_file)
        if include_missing:

            existing_include_path = search_in_all_levels(check.include())
            if existing_include_path:
                # File already exists, but is in another level. Just move it:
                contents = read_file(existing_include_path)
                write_file(include_file, contents)
                os.remove(existing_include_path)
                print("Moved " + check.include())
            else:
                contents = read_file(templates_path() + 'check.h')
                contents = contents.replace('%1', check.include_guard())
                contents = contents.replace('%2', check.get_class_name())
                contents = contents.replace('%3', check.name)
                contents = contents.replace('%4', copyright)
                write_file(include_file, contents)
                print("Created " + include_file)
                edit_changelog = True
            generated = True
        if cpp_missing:
            existing_cpp_path = search_in_all_levels(check.cpp_filename())
            if existing_cpp_path:
                # File already exists, but is in another level. Just move it:
                contents = read_file(existing_cpp_path)
                write_file(cpp_file, contents)
                os.remove(existing_cpp_path)
                print("Moved " + check.cpp_filename())
            else:
                contents = read_file(templates_path() + 'check.cpp')
                contents = contents.replace('%1', check.include())
                contents = contents.replace('%2', check.get_class_name())
                contents = contents.replace('%3', copyright)
                write_file(cpp_file, contents)
                print("Created " + cpp_file)
            generated = True

        if edit_changelog:
            # We created a new check, let's also edit the ChangeLog
            changelog_file = clazy_source_path() + 'Changelog'
            contents = read_file(changelog_file)
            contents += '\n  - <dont forget changelog entry for ' + check.name + '>\n'
            write_file(changelog_file, contents)
            print('Edited Changelog')

    return generated