<commit_before>'use strict';

/**
 * Module dependencies.
 */

const Linter = require('eslint/lib/cli-engine');
const path = require('path');

/**
 * Tests for `eslint-config-seegno`.
 */

describe('eslint-config-seegno', () => {
  const linter = new Linter({ configFile: path.join(__dirname, '..', 'src', 'index.js') });

  it('should not generate any violation for correct code', () => {
    const source = path.join(__dirname, 'fixtures', 'correct.js');

    linter.executeOnFiles([source]).errorCount.should.equal(0);
  });

  it('should generate violations for environment-specific rules', () => {
    const source = path.join(__dirname, 'fixtures', 'environment.js');

    Array.from(new Set(linter.executeOnFiles([source]).results[0].messages.map(violation => violation.ruleId))).should.eql([
      'linebreak-style',
      'eol-last'
    ]);
  });

  it('should generate violations for incorrect code', () => {
    const source = path.join(__dirname, 'fixtures', 'incorrect.js');

    Array.from(new Set(linter.executeOnFiles([source]).results[0].messages.map(violation => violation.ruleId))).should.eql([
      'array-bracket-spacing',
      'arrow-parens',
      'brace-style',
      'capitalized-comments',
      'comma-dangle',
      'comma-spacing',
      'comma-style',
      'consistent-this',
      'curly',
      'dot-notation',
      'generator-star-spacing',
      'id-match',
      'indent',
      'key-spacing',
      'keyword-spacing',
      'mocha/no-exclusive-tests',
      'no-new',
      'new-cap',
      'newline-after-var',
      'newline-before-return',
      'no-class-assign',
      'no-const-assign',
      'no-constant-condition',
      'no-dupe-class-members',
      'no-empty',
      'no-labels',
      'no-multi-spaces',
      'no-multi-str',
      'no-multiple-empty-lines',
      'no-spaced-func',
      'no-this-before-super',
      'no-undef',
      'no-underscore-dangle',
      'no-unused-vars',
      'object-curly-spacing',
      'one-var',
      'one-var-declaration-per-line',
      'operator-linebreak',
      'padded-blocks',
      'quote-props',
      'quotes',
      'semi',
      'semi-spacing',
      'sort-imports-es6/sort-imports-es6',
      'sort-keys',
      'space-before-blocks',
      'space-before-function-paren',
      'space-in-parens',
      'space-infix-ops',
      'space-unary-ops',
      'spaced-comment',
      'sql-template/no-unsafe-query',
      'template-curly-spacing',
      'wrap-iife',
      'yoda'
    ]);
  });
});<commit_msg>Improve incorrect code test<commit_after>'use strict';

/**
 * Module dependencies.
 */

const Linter = require('eslint/lib/cli-engine');
const path = require('path');

/**
 * Tests for `eslint-config-seegno`.
 */

describe('eslint-config-seegno', () => {
  const linter = new Linter({ configFile: path.join(__dirname, '..', 'src', 'index.js') });

  it('should not generate any violation for correct code', () => {
    const source = path.join(__dirname, 'fixtures', 'correct.js');

    linter.executeOnFiles([source]).errorCount.should.equal(0);
  });

  it('should generate violations for environment-specific rules', () => {
    const source = path.join(__dirname, 'fixtures', 'environment.js');

    Array.from(linter.executeOnFiles([source]).results[0].messages.map(violation => violation.ruleId)).should.eql([
      'linebreak-style',
      'linebreak-style',
      'linebreak-style',
      'linebreak-style',
      'eol-last'
    ]);
  });

  it('should generate violations for incorrect code', () => {
    const source = path.join(__dirname, 'fixtures', 'incorrect.js');

    Array.from(linter.executeOnFiles([source]).results[0].messages.map(violation => violation.ruleId)).should.eql([
      'array-bracket-spacing',
      'arrow-parens',
      'brace-style',
      'capitalized-comments',
      'comma-dangle',
      'comma-spacing',
      'comma-style',
      'consistent-this',
      'curly',
      'dot-notation',
      'generator-star-spacing',
      'generator-star-spacing',
      'generator-star-spacing',
      'generator-star-spacing',
      'generator-star-spacing',
      'id-match',
      'indent',
      'key-spacing',
      'keyword-spacing',
      'mocha/no-exclusive-tests',
      'no-new',
      'new-cap',
      'newline-after-var',
      'newline-before-return',
      'no-class-assign',
      'no-const-assign',
      'no-constant-condition',
      'no-dupe-class-members',
      'no-empty',
      'no-labels',
      'no-labels',
      'no-multi-spaces',
      'no-multi-str',
      'no-multiple-empty-lines',
      'no-spaced-func',
      'no-this-before-super',
      'no-undef',
      'no-underscore-dangle',
      'no-unused-vars',
      'object-curly-spacing',
      'object-curly-spacing',
      'one-var',
      'one-var-declaration-per-line',
      'operator-linebreak',
      'padded-blocks',
      'padded-blocks',
      'padded-blocks',
      'padded-blocks',
      'padded-blocks',
      'padded-blocks',
      'quote-props',
      'quote-props',
      'quote-props',
      'quote-props',
      'quotes',
      'semi',
      'semi-spacing',
      'semi-spacing',
      'sort-imports-es6/sort-imports-es6',
      'sort-keys',
      'space-before-blocks',
      'space-before-function-paren',
      'space-in-parens',
      'space-in-parens',
      'space-infix-ops',
      'space-unary-ops',
      'spaced-comment',
      'sql-template/no-unsafe-query',
      'template-curly-spacing',
      'template-curly-spacing',
      'wrap-iife',
      'yoda'
    ]);
  });
});
{'fraction_non_alphanumeric': 0.18621940163191297, 'fraction_numerical': 0.001813236627379873, 'mean_word_length': 2.561007101355713, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '53635', 'n_tokens_mistral': 1893, 'n_tokens_neox': 1832, 'n_words': 263}