if is_enum_class: if v.startswith(enum_name): common.log_warning( "check_enum_style", filename, line_number, "enum class value may not begin with " + enum_name + ": " + v) else: if not v.startswith(enum_name): common.log_warning( "check_enum_style", filename, line_number, "enum value must begin with " + enum_name + "_ : " + v) if __name__ == "__main__": targets = sys.argv[1:] targets = common.get_all_files(targets) if len(targets) == 0: print(""" \t**** No input provided **** \tTakes a list of files/directories as input and performs specific style checking on all files/directories. \tGives warnings if a file contains more than one class definition or if class name is not identical to file name """) exit(0) for t in targets: clean_file_contents, _ = common.clean_file_content( common.read_file(t)[0]) check_enum_style(t, clean_file_contents)
i + 1, "curly brace after while", file_lines[i].strip(" ")) elif re_for.search(line): common.log_warning( "check_curly_braces_alone_on_line", filename, i + 1, "curly brace or statement on same line with for", file_lines[i].strip(" ")) if __name__ == "__main__": targets = sys.argv[1:] targets = common.get_all_files(targets) if len(targets) == 0: print(""" \t**** No input provided **** \tTakes a list of files/directories as input and performs specific style checking on all files/directories \tGives warnings if unnecessary code exists on the same line with curly braces. """) exit(0) for t in targets: if t[-2:] == ".h" or t[-4:] == ".cpp" or t[-2] == ".c": file_contents, file_lines = common.read_file(t) clean_file_contents, clean_file_lines = common.clean_file_content( file_contents) check_curly_braces_alone_on_line(t, file_contents, clean_file_contents, file_lines, clean_file_lines)