Anton Shestakov <av6@dwimlabs.net>, Fri, 08 Jul 2016 00:11:51 +0800
tests: name projects in setup_module() according to module name
candolint/adapters.py
Permissions: -rw-r--r--
from os.path import basename class HostingAdapter(object): def __init__(self, project): def get_commit_url(self, change): def get_branch_url(self, change): def get_line_url(self, change, line): class BitbucketAdapter(HostingAdapter): def get_commit_url(self, change): return '{url}/commits/{node}'.format(**{ def get_branch_url(self, change): return '{url}/branch/{branch}'.format(**{ def get_line_url(self, change, line): return '{url}/src/{node}/{filename}#{basename}-{line}'.format(**{ 'filename': line['filename'], 'basename': basename(line['filename']), 'line': line['line_number'] class GithubAdapter(HostingAdapter): def get_commit_url(self, change): return '{url}/commits/{node}'.format(**{ def get_branch_url(self, change): return '{url}/tree/{branch}'.format(**{ def get_line_url(self, change, line): return '{url}/blob/{node}/{filename}#L{line}'.format(**{ 'filename': line['filename'], 'basename': basename(line['filename']), 'line': line['line_number'] class HgwebAdapter(HostingAdapter): def get_commit_url(self, change): return '{url}/rev/{node}'.format(**{ def get_branch_url(self, change): return '{url}/log/{branch}'.format(**{ def get_line_url(self, change, line): return '{url}/file/{node}/{filename}#l{line}'.format(**{ 'filename': line['filename'], 'line': line['line_number']