<commit_before>import React      from 'react'
import ReactDOM   from 'react-dom/server'
import rules      from './src/rules'
import fs         from 'fs'
import path       from 'path'


Object.keys(rules).forEach(function (rule) {
  const {
    'default': defn
  , pass = []
  , fail = []
  , description = ''
  } = require('./src/rules/' + rule)

  let res = `# ${rule}`
  const line = str => res += '\n' + str

  line(description || "**no description**")
  line('## Passes')
  line('These elements are passed by this rule')
  line('```js')
  line(pass.map(function (ok) {
    return `// no problem when ${ok.when}\n`
      + ReactDOM.renderToStaticMarkup(ok.render(React))
  }).join('\n\n'))
  line('```')

  line('## Fails')
  line('These elements are *not* passed by this rule')
  line('```js')
  line(fail.map(function (bad) {
    return `// warns when ${bad.when}\n`
      + ReactDOM.renderToStaticMarkup(bad.render(React))
  }).join('\n\n'))
  line('```')
  const file = path.resolve('.', 'docs', 'rules', `${rule}.md`)

  fs.writeFile(file, res, function (err) {
    if ( err ) {
      console.log(err)
      process.exit(1)
    } else {
      console.log(`written ${file}`)
    }
  })
})<commit_msg>add w bit more whitespace to eventual docs<commit_after>import React      from 'react'
import ReactDOM   from 'react-dom/server'
import rules      from './src/rules'
import fs         from 'fs'
import path       from 'path'


Object.keys(rules).forEach(function (rule) {
  const {
    'default': defn
  , pass = []
  , fail = []
  , description = ''
  } = require('./src/rules/' + rule)

  let res = `# ${rule}`
  const line = str => res += '\n' + (str || "")

  line()
  line(description || "**no description**")
  line()
  line('## Passes')
  line()
  line('These elements are passed by this rule')
  line('```js')
  line(pass.map(function (ok) {
    return `// no problem when ${ok.when}\n`
      + ReactDOM.renderToStaticMarkup(ok.render(React))
  }).join('\n\n'))
  line('```')

  line()
  line('## Fails')
  line()
  line('These elements are *not* passed by this rule')
  line('```js')
  line(fail.map(function (bad) {
    return `// warns when ${bad.when}\n`
      + ReactDOM.renderToStaticMarkup(bad.render(React))
  }).join('\n\n'))
  line('```')
  const file = path.resolve('.', 'docs', 'rules', `${rule}.md`)

  fs.writeFile(file, res, function (err) {
    if ( err ) {
      console.log(err)
      process.exit(1)
    } else {
      console.log(`written ${file}`)
    }
  })
})
{'fraction_non_alphanumeric': 0.20192307692307693, 'fraction_numerical': 0.0008012820512820513, 'mean_word_length': 2.9199372056514914, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2292682', 'n_tokens_mistral': 872, 'n_tokens_neox': 863, 'n_words': 210}