Global

Type Definitions

AppraisalData

Properties:
Properties
Name Type Default Description
err Error | null null

A Error object or null.

score number 0

The sum of all values in the breakdown collection.

url string null

The location of the README that was evaluated.

breakdown object

A collection of README file quality measures.

Name Type Default Description
cumulativeCodeBlockLength number 0

Amount of code.

  • Value of each: 0.0009475244447271192
  • Maximum allowed total: 10
hasLists number 0

Total count of lists.

  • Value per list: 10
lowCodeBlockPenalty number 0

Penalty for lack of code blocks.

  • Metric: code-block count
  • Rule: if there are fewer than three code blocks, deduct 10 points.
numberOfCodeBlocks number 0

The total count of source code examples on the README.md document.

  • Value per code block: 5
  • Maximum allowed total: 40
numberOfGifs number 0

Number of GIF images.

  • Value per code block: 5
  • Maximum allowed total: 15
numberOfImages number 0

Number of images.

  • Value per code block: 5
  • Maximum allowed total: 15
numberOfNonCodeSections number 0

The total count of sections in the README that do not contain source code.

  • Value per section: 5
  • Maximum allowed total: 30
Source:
Type:
  • object
Examples
// Successfully appraise a high-quality README.

const {ReadmeAppraisal} = require('readme-inspector')
const readmeAppraisal = new ReadmeAppraisal()
const appraisal = readmeAppraisal.for('commonality/readme-inspector')

const WHITESPACE = 2
console.log(JSON.stringify(appraisal, null, WHITESPACE))
// =>
{
  "breakdown": {
    "cumulativeCodeBlockLength": 10,
    "hasLists": 10,
    "lowCodeBlockPenalty": 0,
    "numberOfCodeBlocks": 40,
    "numberOfGifs": 0,
    "numberOfImages": 15,
    "numberOfNonCodeSections": 30
  },
  "error": null,
  "score": 100,
  "url": "commonality/readme-inspector"
}
// Return a `NullAppraisal` for a repository that doesn't
// have a README.

const readmeInspector = require('readme-inspector')
const appraisal =
  await readmeInspector.getAppraisal('https://github.com/gregswindle/no-readme')

const WHITESPACE = 2
console.log(JSON.stringify(appraisal, null, WHITESPACE))
// =>
{
  "breakdown": {
    "cumulativeCodeBlockLength": 0,
    "hasLists": 0,
    "lowCodeBlockPenalty": 0,
    "numberOfCodeBlocks": 0,
    "numberOfGifs": 0,
    "numberOfImages": 0,
    "numberOfNonCodeSections": 0
  },
  "error": "Could not determine score for https://github.com/gregswindle/no-readme",
  "score": 0,
  "url": null
}

ReadmeInfo

Properties:
Name Type Default Description
appraisal AppraisalData

Represents the quantifiable quality of a README file.

err Error null

Provides Error information in case of exceptions.

isPresent boolean

Declares whether a README document was found.

value external:Contents

A README Contents instance.

Source:
Type:
  • object
Example
{
  "appraisal":{
    "breakdown":{
      "cumulativeCodeBlockLength":10,
      "hasLists":10,
      "lowCodeBlockPenalty":0,
      "numberOfCodeBlocks":40,
      "numberOfGifs":0,
      "numberOfImages":15,
      "numberOfNonCodeSections":30
    },
    "error":null,
    "score":100,
    "url":null
  },
  "err":null,
  "isPresent":true,
  "value":{
    "name":"README.md",
    "path":"README.md",
    "sha":"7a4be917e2f73fe701170753ef31f278936a7499",
    "size":37410,
    "url":"https://api.github.com/repos/commonality/readme-inspector/contents/README.md?ref=master",
    "html_url":"https://github.com/commonality/readme-inspector/blob/master/README.md",
    "git_url":"https://api.github.com/repos/commonality/readme-inspector/git/blobs/7a4be917e2f73fe701170753ef31f278936a7499",
    "download_url":"https://raw.githubusercontent.com/commonality/readme-inspector/master/README.md",
    "type":"file",
    "content":"...",
    "encoding":"base64",
    "_links":{
      "self":"https://api.github.com/repos/commonality/readme-inspector/contents/README.md?ref=master",
      "git":"https://api.github.com/repos/commonality/readme-inspector/git/blobs/7a4be917e2f73fe701170753ef31f278936a7499",
      "html":"https://github.com/commonality/readme-inspector/blob/master/README.md"
    }
  }
}