diff --git a/entrypoint.py b/entrypoint.py index 16cae79..752169d 100644 --- a/entrypoint.py +++ b/entrypoint.py @@ -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(): diff --git a/rapidplugin/analysis/lizard_analyzer.py b/rapidplugin/analysis/lizard_analyzer.py index eead982..89b28bb 100644 --- a/rapidplugin/analysis/lizard_analyzer.py +++ b/rapidplugin/analysis/lizard_analyzer.py @@ -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 diff --git a/rapidplugin/domain/package.py b/rapidplugin/domain/package.py index 6aad6b3..8b56e12 100644 --- a/rapidplugin/domain/package.py +++ b/rapidplugin/domain/package.py @@ -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 } } diff --git a/rapidplugin/tests/test_analyzer.py b/rapidplugin/tests/test_analyzer.py index d442af9..850af00 100644 --- a/rapidplugin/tests/test_analyzer.py +++ b/rapidplugin/tests/test_analyzer.py @@ -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) diff --git a/setup.py b/setup.py index e5cbcf4..d8bb5b7 100644 --- a/setup.py +++ b/setup.py @@ -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',