Scrutinizer
Extract a git repository's metadata relying on open source conventions
Install / Use
/learn @balena-io-modules/ScrutinizerREADME
scrutinizer
Extract a git repository's metadata relying on open source conventions
Installation
Install scrutinizer by running:
npm install --save scrutinizer
Documentation
- scrutinizer
- .local(gitRepository, options) ⇒ <code>Promise</code>
- .remote(gitRepository, options) ⇒ <code>Promise</code>
<a name="module_scrutinizer.local"></a>
scrutinizer.local(gitRepository, options) ⇒ <code>Promise</code>
Kind: static method of <code>scrutinizer</code>
Summary: Examine a local git repository directory
Access: public
Fulfil: <code>Object</code> - examination results
| Param | Type | Description | | --- | --- | --- | | gitRepository | <code>String</code> | path to git repository | | options | <code>Object</code> | options | | options.reference | <code>String</code> | git reference to check | | [options.progress] | <code>function</code> | progress callback (state) | | [options.whitelistPlugins] | <code>Array.<String></code> | list of plugins to run. Matches all if empty |
Example
scrutinizer.local('./foo/bar/baz', {
reference: 'master',
progress: (state) => {
console.log(state.percentage)
}
}).then((results) => {
console.log(results)
})
<a name="module_scrutinizer.remote"></a>
scrutinizer.remote(gitRepository, options) ⇒ <code>Promise</code>
If $GITHUB_TOKEN is set, it will be used to authenticate with
GitHub to increase rate-limiting.
Kind: static method of <code>scrutinizer</code>
Summary: Examine a remote git repository url
Access: public
Fulfil: <code>Object</code> - examination results
| Param | Type | Description | | --- | --- | --- | | gitRepository | <code>String</code> | git repository url | | options | <code>Object</code> | options | | options.reference | <code>String</code> | git reference to check | | [options.progress] | <code>function</code> | progress callback (state) | | [options.whitelistPlugins] | <code>Array.<String></code> | list of plugins to run. Matches all if empty |
Example
scrutinizer.remote('git@github.com:foo/bar.git', {
reference: 'master',
progress: (state) => {
console.log(state.percentage)
}
}).then((results) => {
console.log(results)
})
Tests
Our test suite contains integration test cases that run this module against
real projects. For that reason, we maintain a set of git submodules in
test/repositories, where the actual test cases that assert their results live
in test/e2e.
- Fetch all git submodules
git submodule update --init --recursive
-
Set
$GITHUB_TOKEN, to increase rate-limiting -
Run the
testnpm script:
npm test
You may enable debug information by setting DEBUG=scrutinizer*.
Contribute
- Issue Tracker: github.com/resin-io-modules/scrutinizer/issues
- Source Code: github.com/resin-io-modules/scrutinizer
Before submitting a PR, please make sure that you include tests, and that the linter runs without any warning:
npm run lint
One of the most valuable things you can contribute to this project is implement or improve plugins, which are small functions whose duty is to extract a certain facet about the repository, like license information.
-
Create a new file in
lib/plugins, likemyplugin.js -
Export a function that takes a single argument,
backend, which contains every function you need to interact with a git repository, like reading a file
Make sure you use the backend object instead of falling back to fs or an
API call, so the plugin works fine in both local and remote modes.
You can do whatever you need here, including checking out other branches.
scrutinizer will make sure the project is properly reset before calling
another plugin.
-
Add the new plugin to
BUILTIN_PLUGINSinlib/index.js -
Update test cases in
test/e2e
Support
If you're having any problem, please raise an issue on GitHub.
License
This project is free software, and may be redistributed under the terms specified in the license.
Related Skills
apple-reminders
341.6kManage Apple Reminders via remindctl CLI (list, add, edit, complete, delete). Supports lists, date filters, and JSON/plain output.
gh-issues
341.6kFetch GitHub issues, spawn sub-agents to implement fixes and open PRs, then monitor and address PR review comments. Usage: /gh-issues [owner/repo] [--label bug] [--limit 5] [--milestone v1.0] [--assignee @me] [--fork user/repo] [--watch] [--interval 5] [--reviews-only] [--cron] [--dry-run] [--model glm-5] [--notify-channel -1002381931352]
healthcheck
341.6kHost security hardening and risk-tolerance configuration for OpenClaw deployments
node-connect
341.6kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
