Skip to content

Instantly share code, notes, and snippets.

@gylaz
Created March 30, 2015 16:47
Show Gist options
  • Save gylaz/7056707cad4457257716 to your computer and use it in GitHub Desktop.
Save gylaz/7056707cad4457257716 to your computer and use it in GitHub Desktop.
Hound: Helpful commands
# Run violations on a repo/pr/sha:
def violations_in_pr(repo, pr_number, sha)
api = GithubApi.new(ENV["HOUND_GITHUB_TOKEN"])
commit = Commit.new(repo, sha, api)
pr_files = api.pull_request_files(repo, pr_number).map { |file| CommitFile.new(file, commit) }
repo_config = RepoConfig.new(commit)
style_guide = StyleGuide::Ruby.new(repo_config, repo.split("/").first)
pr_files.flat_map { |file| style_guide.violations_in_file(file) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment