Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
MagielBruntink committed Jan 11, 2021

Verified

This commit was signed with the committer’s verified signature. The key has expired.
aymanbagabas Ayman Bagabas
2 parents 0007ece + 2875d5d commit ce79174
Showing 5 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion entrypoint.py
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@

plugin_name = 'RapidPlugin'
plugin_description = 'A FASTEN plug-in to populate risk related metadata for a product.'
plugin_version = '1.1.0'
plugin_version = '1.1.1'


def get_args_parser():
1 change: 1 addition & 0 deletions rapidplugin/analysis/lizard_analyzer.py
Original file line number Diff line number Diff line change
@@ -115,6 +115,7 @@ def __init__(self, func_info):
self.complexity = func_info.cyclomatic_complexity
self.token_count = func_info.token_count
self.parameters = func_info.parameters
self.parameter_count = len(func_info.parameters)
self.start_line = func_info.start_line
self.end_line = func_info.end_line
self.fan_in = func_info.fan_in
4 changes: 3 additions & 1 deletion rapidplugin/domain/package.py
Original file line number Diff line number Diff line change
@@ -155,6 +155,7 @@ def __init__(self):
self.complexity = None
self.token_count = None
self.parameters = None
self.parameter_count = None
self.start_line = None
self.end_line = None
self.fan_in = None
@@ -179,7 +180,8 @@ def metrics(self):
"complexity": self.complexity,
"token_count": self.token_count,
"parameters": self.parameters,
"length": self.length
"length": self.length,
"parameter_count": self.parameter_count
}
}

15 changes: 8 additions & 7 deletions rapidplugin/tests/test_analyzer.py
Original file line number Diff line number Diff line change
@@ -94,11 +94,11 @@ def analyzer(sources):
(pypi_message, 1, 2)
]

# List of (payload, nloc, complexity, token_count) tuples
# List of (payload, nloc, complexity, token_count, parameter_count) tuples
FUNCTION_METRICS_DATA = [
(mvn_message_with_hg_repo, 3, 1, 18),
(debian_message, 1, 1, 5),
(pypi_message, 2, 1, 5)
(mvn_message_with_hg_repo, 3, 1, 18, 1),
(debian_message, 1, 1, 5, 0),
(pypi_message, 2, 1, 5, 0)
]

# List of (payload, filename) pairs
@@ -122,13 +122,14 @@ def test_function_location(analyzer, sources, record, start_line: int, end_line:
assert metadata['end_line'] == end_line


@pytest.mark.parametrize('record,nloc,complexity,token_count', FUNCTION_METRICS_DATA)
def test_function_metrics(analyzer, sources, record, nloc: int, complexity: int, token_count: int):
@pytest.mark.parametrize('record,nloc,complexity,token_cnt,parameter_cnt', FUNCTION_METRICS_DATA)
def test_function_metrics(analyzer, sources, record, nloc: int, complexity: int, token_cnt: int, parameter_cnt: int):
out_payloads = analyzer.analyze(fix_sourcePath(record, sources))
metrics = out_payloads[0]['metrics']
assert metrics['nloc'] == nloc
assert metrics['complexity'] == complexity
assert metrics['token_count'] == token_count
assert metrics['token_count'] == token_cnt
assert metrics['parameter_count'] == parameter_cnt


@pytest.mark.parametrize('record,filename', FUNCTION_FILENAME_DATA)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@

setup(
name='quality-analyzer',
version='1.1.0',
version='1.1.1',
description='FASTEN RAPID Plugin',
long_description=long_description,
long_description_content_type='text/markdown',

0 comments on commit ce79174

Please sign in to comment.