<commit_before>import React from 'react'
import { messages } from '@cucumber/messages'
import CucumberQueryContext from '../../CucumberQueryContext'
import ErrorMessage from './ErrorMessage'
import StepContainer from './StepContainer'
import Attachment from './Attachment'

interface IProps {
  step: messages.TestCase.ITestStep
}

const HookStep: React.FunctionComponent<IProps> = ({ step }) => {
  const cucumberQuery = React.useContext(CucumberQueryContext)

  const stepResult = cucumberQuery.getWorstTestStepResult(
    cucumberQuery.getTestStepResults(step.id)
  )

  const hook = cucumberQuery.getHook(step.hookId)
  const attachments = cucumberQuery.getTestStepsAttachments([step.id])

  if (
    stepResult.status === messages.TestStepFinished.TestStepResult.Status.FAILED
  ) {
    const location = hook.sourceReference.location
      ? hook.sourceReference.location.line
      : hook.sourceReference.javaMethod
      ? hook.sourceReference.javaMethod.className +
        '.' +
        hook.sourceReference.javaMethod.methodName
      : 'Unknown location'
    return (
      <StepContainer status={stepResult.status}>
        <h3>
          Hook failed: {hook.sourceReference.uri}:{location}
        </h3>
        {stepResult.message && <ErrorMessage message={stepResult.message} />}
        {attachments.map((attachment, i) => (
          <Attachment key={i} attachment={attachment} />
        ))}
      </StepContainer>
    )
  }

  if (attachments) {
    return (
      <li className="cucumber-step">
        {attachments.map((attachment, i) => (
          <Attachment key={i} attachment={attachment} />
        ))}
      </li>
    )
  }
}

export default HookStep<commit_msg>Do not use url for java<commit_after>import React from 'react'
import { messages } from '@cucumber/messages'
import CucumberQueryContext from '../../CucumberQueryContext'
import ErrorMessage from './ErrorMessage'
import StepContainer from './StepContainer'
import Attachment from './Attachment'

interface IProps {
  step: messages.TestCase.ITestStep
}

const HookStep: React.FunctionComponent<IProps> = ({ step }) => {
  const cucumberQuery = React.useContext(CucumberQueryContext)

  const stepResult = cucumberQuery.getWorstTestStepResult(
    cucumberQuery.getTestStepResults(step.id)
  )

  const hook = cucumberQuery.getHook(step.hookId)
  const attachments = cucumberQuery.getTestStepsAttachments([step.id])

  if (
    stepResult.status === messages.TestStepFinished.TestStepResult.Status.FAILED
  ) {
    const location = hook.sourceReference.location
      ? hook.sourceReference.uri + ':' + hook.sourceReference.location.line
      : hook.sourceReference.javaMethod
      ? hook.sourceReference.javaMethod.className +
        '.' +
        hook.sourceReference.javaMethod.methodName
      : 'Unknown location'
    return (
      <StepContainer status={stepResult.status}>
        <h3>
          Hook failed: {location}
        </h3>
        {stepResult.message && <ErrorMessage message={stepResult.message} />}
        {attachments.map((attachment, i) => (
          <Attachment key={i} attachment={attachment} />
        ))}
      </StepContainer>
    )
  }

  if (attachments) {
    return (
      <li className="cucumber-step">
        {attachments.map((attachment, i) => (
          <Attachment key={i} attachment={attachment} />
        ))}
      </li>
    )
  }
}

export default HookStep
{'fraction_non_alphanumeric': 0.12021213906894519, 'fraction_numerical': 0.0011785503830288745, 'mean_word_length': 3.24375, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '5904454', 'n_tokens_mistral': 984, 'n_tokens_neox': 975, 'n_words': 181}