<commit_before>import * as Lint from 'tslint';
import * as ts from 'typescript';
import { NgWalker } from './angular/ngWalker';
import * as ast from '@angular/compiler';
import { BasicTemplateAstVisitor } from './angular/templates/basicTemplateAstVisitor';
import { ExpTypes } from './angular/expressionTypes';
import { Config } from './angular/config';
import { RecursiveAngularExpressionVisitor } from './angular/templates/recursiveAngularExpressionVisitor';

const getSemicolonReplacements = (
  text: ast.BoundDirectivePropertyAst,
  absolutePosition: number
) => {
  return [new Lint.Replacement(absolutePosition, 1, '; ')];
};

type Option = 'check-id' | 'check-text';

interface ConfigurableVisitor {
  getOption(): Option;
}

/* Interpolation visitors */

class I18NAttrVisitor extends BasicTemplateAstVisitor
  implements ConfigurableVisitor {
  visitAttr(attr: ast.AttrAst, context: BasicTemplateAstVisitor) {
    if (attr.name === 'i18n' && attr.value) {
      const parts = attr.value.split('@@');
      if (parts.length <= 1 || parts[1].length === 0) {
	const span = attr.sourceSpan;
	context.addFailure(
	  context.createFailure(
	    span.start.offset,
	    span.end.offset - span.start.offset,
	    'Missing custom message identifier. For more information visit https://angular.io/guide/i18n'
	  )
	);
      }
    }
    super.visitAttr(attr, context);
  }
  getOption(): Option {
    return 'check-id';
  }
}

class I18NTextVisitor extends BasicTemplateAstVisitor
  implements ConfigurableVisitor {
  private hasI18n = false;
  private nestedElements = [];
  private visited = new Set<ast.TextAst>();<commit_msg>refactor: drop useless comment<commit_after>import * as Lint from 'tslint';
import * as ts from 'typescript';
import { NgWalker } from './angular/ngWalker';
import * as ast from '@angular/compiler';
import { BasicTemplateAstVisitor } from './angular/templates/basicTemplateAstVisitor';
import { ExpTypes } from './angular/expressionTypes';
import { Config } from './angular/config';
import { RecursiveAngularExpressionVisitor } from './angular/templates/recursiveAngularExpressionVisitor';

const getSemicolonReplacements = (
  text: ast.BoundDirectivePropertyAst,
  absolutePosition: number
) => {
  return [new Lint.Replacement(absolutePosition, 1, '; ')];
};

type Option = 'check-id' | 'check-text';

interface ConfigurableVisitor {
  getOption(): Option;
}

class I18NAttrVisitor extends BasicTemplateAstVisitor
  implements ConfigurableVisitor {
  visitAttr(attr: ast.AttrAst, context: BasicTemplateAstVisitor) {
    if (attr.name === 'i18n' && attr.value) {
      const parts = attr.value.split('@@');
      if (parts.length <= 1 || parts[1].length === 0) {
	const span = attr.sourceSpan;
	context.addFailure(
	  context.createFailure(
	    span.start.offset,
	    span.end.offset - span.start.offset,
	    'Missing custom message identifier. For more information visit https://angular.io/guide/i18n'
	  )
	);
      }
    }
    super.visitAttr(attr, context);
  }
  getOption(): Option {
    return 'check-id';
  }
}

class I18NTextVisitor extends BasicTemplateAstVisitor
  implements ConfigurableVisitor {
  private hasI18n = false;
  private nestedElements = [];
  private visited = new Set<ast.TextAst>();
{'fraction_non_alphanumeric': 0.12550107924761023, 'fraction_numerical': 0.008633980881899476, 'mean_word_length': 4.3267651888341545, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '6462191', 'n_tokens_mistral': 991, 'n_tokens_neox': 949, 'n_words': 230}