<commit_before>from behave import when, then
from features.src.support import helpers
from features.src.stackAnalyses import StackAnalyses
from pyshould import should_not

@when(u'I send Maven package manifest pom-effective.xml to stack analysis')
def when_send_manifest(context):

    global sa
    sa = StackAnalyses()

    spaceName = helpers.getSpaceName()
    codebaseUrl = sa.getCodebaseUrl()
    stackAnalysesKey = sa.getReportKey(codebaseUrl)
    helpers.setStackReportKey(stackAnalysesKey)
    stackAnalysesKey | should_not.be_none().desc("Obtained Stack Analyses key")


@then(u'I should receive JSON response with stack analysis data')
def then_receive_stack_json(context):
    spaceName = helpers.getSpaceName()
    stackAnalysesKey = helpers.getStackReportKey()
    reportText = sa.getStackReport(stackAnalysesKey)
    reportText | should_not.be_none().desc("Obtained Stack Analyses Report")<commit_msg>Store stack analysis in the context<commit_after>from behave import when, then
from features.src.support import helpers
from features.src.stackAnalyses import StackAnalyses
from pyshould import should_not

@when(u'I send Maven package manifest pom-effective.xml to stack analysis')
def when_send_manifest(context):

    sa = StackAnalyses()

    spaceName = helpers.getSpaceName()
    codebaseUrl = sa.getCodebaseUrl()
    stackAnalysesKey = sa.getReportKey(codebaseUrl)
    helpers.setStackReportKey(stackAnalysesKey)
    stackAnalysesKey | should_not.be_none().desc("Obtained Stack Analyses key")
    context.sa = sa


@then(u'I should receive JSON response with stack analysis data')
def then_receive_stack_json(context):
    spaceName = helpers.getSpaceName()
    stackAnalysesKey = helpers.getStackReportKey()
    reportText = context.sa.getStackReport(stackAnalysesKey)
    reportText | should_not.be_none().desc("Obtained Stack Analyses Report")
{'fraction_non_alphanumeric': 0.08083511777301927, 'fraction_numerical': 0.0, 'mean_word_length': 5.467128027681661, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5384916', 'n_tokens_mistral': 573, 'n_tokens_neox': 542, 'n_words': 136}