npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

perf-checks

v0.1.0

Published

A headless framework for nested checks on Scripture content, mainly in PERF.

Downloads

3

Readme

perf-checks

A headless framework for nested checks on Scripture content, mainly in PERF.

Checks are performed using an instance of the perf-checks class. A checks specification is provided when the class is instantiated. Scripture content (typically PERF) can then be passed to the instance, via method calls. Those methods return a JSON report. That report can be localised and presented via any GUI.

Overview

Anatomy of a check

The following information is required for each check:

  • a short name that serves as an id to identify the check
  • a description that can be localised and presented to the end user
  • a level (one of info, trivial, minor, major, critical and fatal) at which processing will be halted
  • a source type (typically perf, but usfm, usx and usj may be useful for 'can we even parse this?'-type checks)
  • the code that performs the check

Checking code

Checks are functions written in Javascript and should take as arguments

  • the content to be checked
  • the format of that content

Checking functions should return a JSON report including

  • pass/fail flag
  • list of issues, with location, issue code and, optionally, data related to the issue that may be shown to the user

In general, each checking function should test one thing. This helps with reusability and with code testing.

Check groups

Checks may be grouped. Each group may be given a name and a description.

Checking hierarchy

Both individual checks and check groups may have child checks and/or check groups. perf-checks runs the top-level checks before running children, appending any issues to the report as it goes.

Processing ends in all cases on the first fatal issue. In other cases, all checks at the top level will be run. Child checks will be run, recursively, if no issue with a level at least equal to that of the perf-checks instance has been encountered.

For example, if the perf-checks instance level is major, child checks will be run if no major or critical issues are encountered at the current level. If the perf-checks instance level is minor, a minor, major or critical issue will prevent execution of child processes.

The checks hierarchy is a tree, so the processing of child checks depends on the state of the parent of that check. For example, depending on the checks specification, child checks for chapter/verse progression might be skipped, due to an issue in the most basic chapter/verse checks, but child checks for punctuation could still execute if no serious issues were found in the parent of those checks.

Child checks attached to a checks group will only run if no issue for any of the checks in the group reaches the level of the ``perf-checks` instance.

Localisation

The reports use ids and issue codes. A library of helper functions can convert these reports into somewhat readable English. For issues that return issue-specific data, the helper functions use a placeholder mechanism to construct that English. These helper functions may be localised for other languages, which may include reworking the placeholders to respect localised language word order.