<commit_before>import React from 'react';
import UpArrow from 'interface/icons/UpArrow';

import ISSUE_IMPORTANCE from 'parser/core/ISSUE_IMPORTANCE';
import { Issue } from 'parser/core/ParseResults';
import Icon from 'common/Icon';

function getIssueImportance(importance: string) {
  switch (importance) {
    case ISSUE_IMPORTANCE.MAJOR:
      return <>Major <UpArrow /></>;
    case ISSUE_IMPORTANCE.REGULAR:
      return 'Average';
    case ISSUE_IMPORTANCE.MINOR:
      return <>Minor <UpArrow style={{ transform: 'rotate(180deg) translateZ(0)' }} /></>;
    default:
      return '';
  }
}

class Suggestion extends React.PureComponent<Issue, { expanded: boolean }> {

  constructor(props: Issue) {
    super(props);
    this.state = {
      expanded: false,
    };
    this.handleClick = this.handleClick.bind(this);
  }

  handleClick() {
    this.setState({
      expanded: !this.state.expanded,
    });
  }

  render() {
    const { icon, issue, stat, importance, details } = this.props;

    return (
      <>
        <li className={`item ${importance || ''} ${details ? 'clickable' : ''}`} onClick={details && this.handleClick}>
          <div className="icon">
            <Icon icon={icon} alt="Icon" />
          </div>
          <div className="suggestion">
            {issue}
            {stat && (
              <small>{stat}</small>
            )}
          </div>
          <div className="importance">
            {/* element needed for vertical alignment */}
            <div>
              {getIssueImportance(importance)}
            </div>
          </div>
        </li>
        {this.state.expanded && details && (
          <li>
            {details()}
          </li>
        )}
      </>
    );
  }
}

export default Suggestion;
<commit_msg>change function param type to new enum<commit_after>import React from 'react';
import UpArrow from 'interface/icons/UpArrow';
import ISSUE_IMPORTANCE from 'parser/core/ISSUE_IMPORTANCE';
import { Issue } from 'parser/core/ParseResults';
import Icon from 'common/Icon';

function getIssueImportance(importance: ISSUE_IMPORTANCE) {
  switch (importance) {
    case ISSUE_IMPORTANCE.MAJOR:
      return <>Major <UpArrow /></>;
    case ISSUE_IMPORTANCE.REGULAR:
      return 'Average';
    case ISSUE_IMPORTANCE.MINOR:
      return <>Minor <UpArrow style={{ transform: 'rotate(180deg) translateZ(0)' }} /></>;
    default:
      return '';
  }
}

class Suggestion extends React.PureComponent<Issue, { expanded: boolean }> {

  constructor(props: Issue) {
    super(props);
    this.state = {
      expanded: false,
    };
    this.handleClick = this.handleClick.bind(this);
  }

  handleClick() {
    this.setState({
      expanded: !this.state.expanded,
    });
  }

  render() {
    const { icon, issue, stat, importance, details } = this.props;

    return (
      <>
        <li className={`item ${importance || ''} ${details ? 'clickable' : ''}`} onClick={details && this.handleClick}>
          <div className="icon">
            <Icon icon={icon} alt="Icon" />
          </div>
          <div className="suggestion">
            {issue}
            {stat && (
              <small>{stat}</small>
            )}
          </div>
          <div className="importance">
            {/* element needed for vertical alignment */}
            <div>
              {getIssueImportance(importance)}
            </div>
          </div>
        </li>
        {this.state.expanded && details && (
          <li>
            {details()}
          </li>
        )}
      </>
    );
  }
}

export default Suggestion;

{'fraction_non_alphanumeric': 0.14589155953046395, 'fraction_numerical': 0.0022358859698155395, 'mean_word_length': 2.201252236135957, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 51, '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': '2560584', 'n_tokens_mistral': 1095, 'n_tokens_neox': 1076, 'n_words': 228}