Skip to content

Tool to ensure proper formatting in the PublicKB, APIDocs and Getting Started repos

License

Notifications You must be signed in to change notification settings

CenturyLinkCloud/KB-Commit-Analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Commit Analyzer

This project contains a number of parsers that run against each markdown file (*.md filename) in a project repository, creating a test suite of sorts.

The parsers validate that the following are true:

  • File's JSON front-matter parses correctly and contains the required fields (title, date, autor)
  • File's markdown successfully parses
  • All relative files (images and other markdown files) are valid links

Usage

  1. Add this project as a submodule into your repository. It is recommended to install this in the lib directory:
$ git submodule add [email protected]:CenturyLinkCloud/KB-Commit-Analyzer.git lib
  1. Then you'll be able to run the suite:
node lib/index.js

Note that the first time you wish to run the commit analyzer, you'll have to run npm install from the lib directory. This assumes you have Node.js installed.

The output will tell you if any file fails parsing. This script is also run as part of continuous integration with travis-ci.

Ignoring Files

If a file contains a link that the commit analyzer catches as being invalid (such as in a code sample), and you'd like the analyzer to ignore that file, you can add the filename to commit_analyzer_ignore.txt. (It isn't necessary to include the entire file path; just the filename will suffice.)

Writing Additional Parsers

A parser must contain a parse() method that accepts a file and a global failed boolean as arguments. For reference, see the file_parser.coffee file. It should parse a file as required (likely by converting it to markdown and splitting on a newline, passing each line into some sort of check) and return a boolean, which signifies whether or not there were any failures in parsing). It should be exported in the module.exports in the file and required in app.coffee. Finally, the name of the parser should be added to the parsers array in app.coffee.

About

Tool to ensure proper formatting in the PublicKB, APIDocs and Getting Started repos

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published