Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
MagielBruntink committed Nov 6, 2020
2 parents 8c5a8ef + 5d73030 commit b79fdd5
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 8 deletions.
2 changes: 1 addition & 1 deletion entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

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


def get_args_parser():
Expand Down
51 changes: 50 additions & 1 deletion integration_tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def test_successes(plugin_run, in_message):


@pytest.mark.parametrize('in_message', [
# missing 'forge'
{
"groupId": "ai.api",
"artifactId": "libai",
Expand All @@ -139,11 +140,13 @@ def test_successes(plugin_run, in_message):
"repoType": "",
"commitTag": ""
},
# missing 'sourcePath' for pypi
{
"forge": "PyPI",
"product": "p1",
"version": "1.0.0"
},
# empty 'sourcesUrl', and svn repo not supported
{
"forge": "mvn",
"groupId": "test-mvn",
Expand All @@ -154,6 +157,7 @@ def test_successes(plugin_run, in_message):
"repoType": "svn",
"commitTag": "1.0.0"
},
# empty 'sourcesUrl', and invalid 'commitTag'
{
"forge": "mvn",
"groupId": "test-mvn",
Expand All @@ -163,7 +167,52 @@ def test_successes(plugin_run, in_message):
"repoPath": "/home/plugin/rapidplugin/tests/resources/maven/hg/m3",
"repoType": "hg",
"commitTag": "1.0.1"
}])
},
# empty 'sourcesUrl', and missing 'repoType'
{
"date": 1434489838,
"forge": "mvn",
"groupId": "org.apache.avro",
"sourcesUrl": "",
"artifactId": "trevni-doc",
"repoPath": "",
"version": "1.7.6-cdh5.4.2.1",
"commitTag": ""
},
# empty 'sourcesUrl', and empty 'repoPath'
{
"forge": "mvn",
"groupId": "test-mvn",
"artifactId": "m3",
"version": "1.0.0",
"sourcesUrl": "",
"repoPath": "",
"repoType": "hg",
"commitTag": "1.0.0"
},
# empty 'sourcesUrl', and empty 'repoType'
{
"forge": "mvn",
"groupId": "test-mvn",
"artifactId": "m3",
"version": "1.0.0",
"sourcesUrl": "",
"repoPath": "/home/plugin/rapidplugin/tests/resources/maven/hg/m3",
"repoType": "",
"commitTag": "1.0.0"
},
# empty 'sourcesUrl', and empty 'commitTag'
{
"forge": "mvn",
"groupId": "test-mvn",
"artifactId": "m3",
"version": "1.0.0",
"sourcesUrl": "",
"repoPath": "/home/plugin/rapidplugin/tests/resources/maven/hg/m3",
"repoType": "hg",
"commitTag": ""
}
])
def test_failures(plugin_run, in_message):
out, log, err = plugin_run
assert len(out) == 0
Expand Down
2 changes: 0 additions & 2 deletions rapidplugin/analysis/lizard_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
# limitations under the License.
#

import os
import logging
import datetime
from pathlib import Path

import lizard

Expand Down
7 changes: 5 additions & 2 deletions rapidplugin/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,12 @@ def test_checkout_hg(repo_path, repo_type, commit_tag, sources_dir, repos):
assert sorted(os.listdir(source_path)) == sorted(['m3.java', '.hg_archival.txt'])

@pytest.mark.parametrize('repo_path,repo_type,commit_tag',
[("maven/git/m1", "git", "1.0.1"),
("maven/hg/m3", "hg", "1.0.1"),
# wrong version tag
[("maven/git/m1", "git", "1.0.1"), \
("maven/hg/m3", "hg", "1.0.1"), \
# svn not supported
("maven/svn/m2", "svn", "1.0.0")])

def test_checkout_fail(repo_path, repo_type, commit_tag, sources_dir, repos):
repo_path = os.path.join(repos, repo_path)
with pytest.raises(Exception) as e:
Expand Down
3 changes: 2 additions & 1 deletion rapidplugin/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def get_source_mvn(payload, base_dir):
sources_url = payload['sourcesUrl']
if sources_url != "":
return MavenUtils.download_jar(sources_url, base_dir)
elif 'repoPath' in payload and 'commitTag' in payload and 'repoType' in payload:
else:
assert 'repoType' in payload, f"Missing field 'repoType' to check out source code."
repo_path = payload['repoPath']
repo_type = payload['repoType']
commit_tag = payload['commitTag']
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 @@

setup(
name='quality-analyzer',
version='0.0.1',
version='1.0.0',
description='FASTEN RAPID Plugin',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit b79fdd5

Please sign in to comment.