Skip to content

Commit

Permalink
updated full_name_pattern regex to identiify full name from repo url
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanodallapalma committed Nov 6, 2020
1 parent 482c091 commit 2f26871
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions repominer/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from repominer.mining.ansible import AnsibleMiner
from repominer.mining.tosca import ToscaMiner

VERSION = '0.8.4'
VERSION = '0.8.5'


def valid_dir_or_url(x: str) -> str:
Expand Down Expand Up @@ -258,9 +258,9 @@ def mine(args: Namespace):
url_to_repo = None

if args.host == 'github':
url_to_repo = f'https://github.com/{args.repository}.git'
url_to_repo = f'https://github.com/{args.repository}'
elif args.host == 'gitlab':
url_to_repo = f'https://gitlab.com/{args.repository}.git'
url_to_repo = f'https://gitlab.com/{args.repository}'

if args.verbose:
print(f'Mining {args.repository} [started at: {datetime.now().hour}:{datetime.now().minute}]')
Expand Down
4 changes: 2 additions & 2 deletions repominer/metrics/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from repominer.files import FailureProneFile

full_name_pattern = re.compile(r'git(hub|lab){1}\.com/([\w\W]+)\.git')
full_name_pattern = re.compile(r'git(hub|lab){1}\.com/([\w\W]+)$')


def get_content(path: str) -> str:
Expand Down Expand Up @@ -49,7 +49,7 @@ def __init__(self, path_to_repo: str, at: str = 'release'):
only_releases=True if at == 'release' else False,
order='date-order')
elif is_remote(path_to_repo):
match = full_name_pattern.search(path_to_repo)
match = full_name_pattern.search(path_to_repo.replace('.git', ''))
repo_name = match.groups()[1].split('/')[1]
path_to_clone = os.path.join(os.getenv('TMP_REPOSITORIES_DIR'), repo_name)
self.path_to_repo = path_to_clone
Expand Down
4 changes: 2 additions & 2 deletions repominer/mining/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

FIXING_COMMITS_REGEX = r'(bug|fix|error|crash|problem|fail|defect|patch)'

full_name_pattern = re.compile(r'(github|gitlab){1}\.com/([\w\W]+)\.git')
full_name_pattern = re.compile(r'(github|gitlab){1}\.com/([\w\W]+)$')


class BaseMiner:
Expand All @@ -33,7 +33,7 @@ def __init__(self,
:param url_to_repo: the HTTPS url to the remote repository to analyze;
:param branch: the branch to analyze. Default 'master';
"""
match = full_name_pattern.search(url_to_repo)
match = full_name_pattern.search(url_to_repo.replace('.git', ''))
self.host = match.groups()[0]
self.repository = match.groups()[1]
self.branch = branch
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
with open("README.md", "r") as fh:
long_description = fh.read()

VERSION = '0.8.4'
VERSION = '0.8.5'

setup(name='repository-miner',
version=VERSION,
Expand Down

0 comments on commit 2f26871

Please sign in to comment.