def main(): arg_parser = _get_arg_parser() args = arg_parser.parse_args() printer = ConsolePrinter() log_printer = LogPrinter(printer) project_dir = os.getcwd() if not args.non_interactive: print_welcome_message(printer) project_dir = ask_question("What is your project directory?", default=project_dir, typecast=valid_path) project_files, ignore_globs = get_project_files(log_printer, printer, project_dir) used_languages = list(get_used_languages(project_files)) print_used_languages(printer, used_languages) relevant_bears = filter_relevant_bears(used_languages, arg_parser) print_relevant_bears(printer, relevant_bears) if args.non_interactive: unusable_bears = get_non_optional_settings_bears(relevant_bears) remove_unusable_bears(relevant_bears, unusable_bears) print_relevant_bears(printer, relevant_bears, 'usable') settings = generate_settings(project_dir, project_files, ignore_globs, relevant_bears) write_coafile(printer, project_dir, settings)
def test_print_used_languages(self): with retrieve_stdout() as custom_stdout: print_used_languages(self.printer, [('Python', 100)]) res = custom_stdout.getvalue() self.assertIn("Python", res) self.assertIn("100%", res) with retrieve_stdout() as custom_stdout: print_used_languages(self.printer, [('Python', 75), ('C++', 25)]) self.assertIn("75%\n", custom_stdout.getvalue())
def main(): arg_parser = _get_arg_parser() args = arg_parser.parse_args() logging.basicConfig(stream=sys.stdout) printer = ConsolePrinter() logging.getLogger(__name__) fpc = None project_dir = os.getcwd() if args.green_mode: args.non_interactive = None args.no_filter_by_capabilities = None args.incomplete_sections = None if not args.non_interactive and not args.green_mode: fpc = FilePathCompleter() fpc.activate() print_welcome_message(printer) printer.print(PROJECT_DIR_HELP) project_dir = ask_question('What is your project directory?', default=project_dir, typecast=valid_path) fpc.deactivate() project_files, ignore_globs = get_project_files(None, printer, project_dir, fpc, args.non_interactive) used_languages = list(get_used_languages(project_files)) print_used_languages(printer, used_languages) extracted_information = collect_info(project_dir) relevant_bears = filter_relevant_bears(used_languages, printer, arg_parser, extracted_information) if args.green_mode: collect_bear_settings(relevant_bears) print_relevant_bears(printer, relevant_bears) if args.non_interactive and not args.incomplete_sections: unusable_bears = get_non_optional_settings_bears(relevant_bears) remove_unusable_bears(relevant_bears, unusable_bears) print_relevant_bears(printer, relevant_bears, 'usable') settings = generate_settings(project_dir, project_files, ignore_globs, relevant_bears, extracted_information, args.incomplete_sections) write_coafile(printer, project_dir, settings)
def main(): printer = ConsolePrinter() log_printer = LogPrinter(printer) print_welcome_message(printer) project_dir = ask_question("What is your project directory?", default=os.getcwd(), typecast=valid_path) project_files, ignore_globs = get_project_files(log_printer, printer, project_dir) used_languages = list(get_used_languages(project_files)) print_used_languages(printer, used_languages) relevant_bears = filter_relevant_bears(used_languages) print_relevant_bears(printer, relevant_bears) settings = generate_settings(project_dir, project_files, ignore_globs, relevant_bears) write_coafile(printer, project_dir, settings)
def test_no_results(self): with retrieve_stdout() as custom_stdout: print_used_languages(self.printer, []) self.assertNotIn("following langauges", custom_stdout.getvalue())