Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gh-lint

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gh-lint - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

spec/fixtures/config-repos.yml

15

lib/cli/commands/check.js

@@ -5,2 +5,3 @@ 'use strict';

const path = require('path');
const yaml = require('js-yaml');
const execute = require('../../execute');

@@ -11,3 +12,3 @@ const options = require('./options');

execute (argv) {
const config = loadJson(argv.c || argv.config);
const config = loadConfig(argv.c || argv.config);
const opts = options.get(argv);

@@ -38,7 +39,11 @@ return execute.checkRules(config, opts).then(logErrors, console.error);

function loadJson(fileName){
function loadConfig(fileName){
const file = path.resolve(process.cwd(), fileName);
let json;
const ext = path.extname(fileName).toLowerCase();
let cfg;
try {
json = JSON.parse(fs.readFileSync(file, 'utf8'));
const fileStr = fs.readFileSync(file, 'utf8');
cfg = ext == '.yml' || ext == '.yaml'
? yaml.safeLoad(fileStr)
: JSON.parse(fileStr);
} catch(err) {

@@ -48,3 +53,3 @@ console.error('error: ' + err.message);

}
return json;
return cfg;
}

@@ -51,0 +56,0 @@

{
"name": "gh-lint",
"version": "0.1.0",
"version": "0.1.1",
"description": "Rule-based command-line tool for auditing GitHub repositories",

@@ -13,2 +13,3 @@ "main": "execute/index.js",

"co": "^4.6.0",
"js-yaml": "^3.8.1",
"minimist": "^1.2.0",

@@ -15,0 +16,0 @@ "request": "^2.79.0",

@@ -37,2 +37,13 @@ 'use strict';

it('should check repos with YAML config', () => {
githubMock.mock('/repos/MailOnline/videojs-vast-vpaid', '../fixtures/videojs-vast-vpaid-repo-meta');
githubMock.mock('/repos/milojs/milo', '../fixtures/milo-repo-meta');
return ok(run(['check', '-c', './spec/fixtures/config-repos.yml'], false))
.then(() => {
assert.equal(log, 'warning MailOnline/videojs-vast-vpaid: repo-homepage - not satisfied');
assert(nock.isDone());
});
});
it('should check repos in orgs', () => {

@@ -39,0 +50,0 @@ githubMock.repos.organization.MailOnline.list();

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc