@cli.command("<STR_LIT>")<EOL>@click.pass_context<EOL>def lint(ctx):
lint_config = ctx.obj[<NUM_LIT:0>]<EOL>msg_filename = ctx.obj[<NUM_LIT:3>]<EOL>stdin_input = get_stdin_data()<EOL>if msg_filename:<EOL><INDENT>LOG.debug("<STR_LIT>")<EOL>gitcontext = GitContext.from_commit_msg(ustr(msg_filename.read()))<EOL><DEDENT>elif stdin_input:<EOL><INDENT>LOG.debug("<STR_LIT>")<EOL>gitcontext = GitContext.from_commit_msg(stdin_input)<EOL><DEDENT>else:<EOL><INDENT>LOG.debug("<STR_LIT>")<EOL>gitcontext = GitContext.from_local_repository(lint_config.target, ctx.obj[<NUM_LIT:2>])<EOL><DEDENT>number_of_commits = len(gitcontext.commits)<EOL>if number_of_commits == <NUM_LIT:0>:<EOL><INDENT>LOG.debug(u'<STR_LIT>', ctx.obj[<NUM_LIT:2>])<EOL>ctx.exit(<NUM_LIT:0>)<EOL><DEDENT>general_config_builder = ctx.obj[<NUM_LIT:1>]<EOL>last_commit = gitcontext.commits[-<NUM_LIT:1>]<EOL>first_violation = True<EOL>exit_code = <NUM_LIT:0><EOL>for commit in gitcontext.commits:<EOL><INDENT>config_builder = general_config_builder.clone()<EOL>config_builder.set_config_from_commit(commit)<EOL>commit_config = config_builder.build(copy.deepcopy(lint_config))<EOL>linter = GitLinter(commit_config)<EOL>violations = linter.lint(commit)<EOL>exit_code += len(violations)<EOL>if violations:<EOL><INDENT>if number_of_commits > <NUM_LIT:1> and commit.sha:<EOL><INDENT>linter.display.e(u"<STR_LIT>".format(<EOL>"<STR_LIT:\n>" if not first_violation or commit is last_commit else "<STR_LIT>",<EOL>commit.sha[:<NUM_LIT:10>]<EOL>))<EOL><DEDENT>linter.print_violations(violations)<EOL>first_violation = False<EOL><DEDENT><DEDENT>exit_code = min(MAX_VIOLATION_ERROR_CODE, exit_code)<EOL>LOG.debug("<STR_LIT>", exit_code)<EOL>ctx.exit(exit_code)<EOL>
Lints a git repository [default command]