Socket
Socket
Sign inDemoInstall

core-validate-commit

Package Overview
Dependencies
Maintainers
7
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

core-validate-commit - npm Package Compare versions

Comparing version 3.20.0 to 4.0.0

lib/validator.js

36

bin/cmd.js
#!/usr/bin/env node
'use strict'
import { exec } from 'node:child_process'
import fs from 'node:fs'
import http from 'node:http'
import https from 'node:https'
import path from 'node:path'
import nopt from 'nopt'
import pretty from '../lib/format-pretty.js'
import formatTap from '../lib/format-tap.js'
import Validator from '../lib/validator.js'
import Tap from '../lib/tap.js'
import * as utils from '../lib/utils.js'
import subsystem from '../lib/rules/subsystem.js'
const exec = require('child_process').exec
const fs = require('fs')
const http = require('http')
const https = require('https')
const nopt = require('nopt')
const path = require('path')
const pretty = require('../lib/format-pretty')
const formatTap = require('../lib/format-tap')
const Validator = require('../lib')
const Tap = require('../lib/tap')
const utils = require('../lib/utils')
const subsystem = require('../lib/rules/subsystem')
const knownOpts = {

@@ -37,10 +36,15 @@ help: Boolean,

const parsed = nopt(knownOpts, shortHand)
const usage = require('help')()
if (parsed.help) {
usage()
const usagePath = path.join(new URL(import.meta.url).pathname, '../usage.txt')
const help = await fs.promises.readFile(usagePath, 'utf8')
console.log(help)
process.exit(0)
}
if (parsed.version) {
console.log('core-validate-commit', 'v' + require('../package').version)
const pkgJsonPath = path.join(new URL(import.meta.url).pathname, '../../package.json')
const pkgJson = await fs.promises.readFile(pkgJsonPath, 'utf8')
const { version } = JSON.parse(pkgJson)
console.log(`core-validate-commit v${version}`)
process.exit(0)

@@ -47,0 +51,0 @@ }

@@ -1,3 +0,3 @@

'use strict'
import Validator from './lib/validator.js'
module.exports = require('./lib')
export default Validator

@@ -1,9 +0,7 @@

'use strict'
import chalk from 'chalk'
import * as utils from './utils.js'
const chalk = require('chalk')
const utils = require('./utils')
const MAX_LINE_COL_LEN = 6
module.exports = function formatPretty (context, msgs, validator, opts) {
export default function formatPretty (context, msgs, validator, opts) {
opts = Object.assign({

@@ -10,0 +8,0 @@ detailed: false

@@ -1,4 +0,2 @@

'use strict'
module.exports = function formatTap (t, context, msgs, validator) {
export default function formatTap (t, context, msgs, validator) {
for (const m of msgs) {

@@ -5,0 +3,0 @@ switch (m.level) {

@@ -1,4 +0,2 @@

'use strict'
module.exports = class Rule {
export default class Rule {
constructor (opts) {

@@ -5,0 +3,0 @@ opts = Object.assign({

@@ -1,6 +0,4 @@

'use strict'
const id = 'co-authored-by-is-trailer'
module.exports = {
export default {
id,

@@ -7,0 +5,0 @@ meta: {

@@ -1,3 +0,1 @@

'use strict'
const id = 'fixes-url'

@@ -8,3 +6,3 @@ const github = new RegExp('^https://github\\.com/[\\w-]+/[\\w-]+/' +

module.exports = {
export default {
id,

@@ -11,0 +9,0 @@ meta: {

@@ -1,6 +0,4 @@

'use strict'
const id = 'line-after-title'
module.exports = {
export default {
id,

@@ -7,0 +5,0 @@ meta: {

@@ -1,6 +0,4 @@

'use strict'
const id = 'line-length'
module.exports = {
export default {
id,

@@ -7,0 +5,0 @@ meta: {

@@ -1,6 +0,4 @@

'use strict'
const id = 'metadata-end'
module.exports = {
export default {
id,

@@ -7,0 +5,0 @@ meta: {

@@ -1,7 +0,5 @@

'use strict'
const id = 'pr-url'
const prUrl = /^https:\/\/github\.com\/[\w-]+\/[\w-]+\/pull\/\d+$/
module.exports = {
export default {
id,

@@ -8,0 +6,0 @@ meta: {

@@ -1,6 +0,4 @@

'use strict'
const id = 'reviewers'
module.exports = {
export default {
id,

@@ -7,0 +5,0 @@ meta: {

@@ -1,3 +0,1 @@

'use strict'
const id = 'subsystem'

@@ -84,3 +82,3 @@

module.exports = {
export default {
id,

@@ -87,0 +85,0 @@ meta: {

@@ -1,6 +0,4 @@

'use strict'
const id = 'title-format'
module.exports = {
export default {
id,

@@ -7,0 +5,0 @@ meta: {

@@ -1,6 +0,4 @@

'use strict'
const id = 'title-length'
module.exports = {
export default {
id,

@@ -7,0 +5,0 @@ meta: {

@@ -1,5 +0,4 @@

'use strict'
import util from 'node:util'
import { Readable } from 'node:stream'
const util = require('util')
class Test {

@@ -52,5 +51,3 @@ constructor (tap, name) {

const Readable = require('stream').Readable
module.exports = class Tap extends Readable {
export default class Tap extends Readable {
constructor () {

@@ -57,0 +54,0 @@ super()

@@ -1,13 +0,8 @@

'use strict'
import chalk from 'chalk'
const chalk = require('chalk')
const CHECK = chalk.green('✔')
const X = chalk.red('✖')
const WARN = chalk.yellow('⚠')
export const CHECK = chalk.green('✔')
export const X = chalk.red('✖')
export const WARN = chalk.yellow('⚠')
exports.CHECK = CHECK
exports.X = X
exports.WARN = WARN
exports.rightPad = function rightPad (str, max) {
export function rightPad (str, max) {
const diff = max - str.length + 1

@@ -20,3 +15,3 @@ if (diff > 0) {

exports.leftPad = function leftPad (str, max) {
export function leftPad (str, max) {
const diff = max - str.length + 1

@@ -29,3 +24,3 @@ if (diff > 0) {

exports.header = (sha, status) => {
export function header (sha, status) {
switch (status) {

@@ -42,6 +37,6 @@ case 'skip':

exports.describeRule = function describeRule (rule, max = 20) {
export function describeRule (rule, max = 20) {
if (rule.meta && rule.meta.description) {
const desc = rule.meta.description
const title = exports.leftPad(rule.id, max)
const title = leftPad(rule.id, max)
console.log(' %s %s', chalk.red(title), chalk.dim(desc))

@@ -51,9 +46,9 @@ }

exports.describeSubsystem = function describeSubsystem (subsystems, max = 20) {
export function describeSubsystem (subsystems, max = 20) {
if (subsystems) {
for (let sub = 0; sub < subsystems.length; sub = sub + 3) {
console.log('%s %s %s',
chalk.green(exports.leftPad(subsystems[sub] || '', max)),
chalk.green(exports.leftPad(subsystems[sub + 1] || '', max)),
chalk.green(exports.leftPad(subsystems[sub + 2] || '', max))
chalk.green(leftPad(subsystems[sub] || '', max)),
chalk.green(leftPad(subsystems[sub + 1] || '', max)),
chalk.green(leftPad(subsystems[sub + 2] || '', max))
)

@@ -60,0 +55,0 @@ }

{
"name": "core-validate-commit",
"version": "3.20.0",
"version": "4.0.0",
"description": "Validate the commit message for a particular commit in node core",
"main": "index.js",
"type": "module",
"scripts": {

@@ -13,6 +14,5 @@ "pretest": "standard && check-pkg",

"dependencies": {
"chalk": "^4.1.2",
"chalk": "^5.2.0",
"gitlint-parser-node": "^1.1.0",
"help": "^3.0.2",
"nopt": "^6.0.0"
"nopt": "^7.0.0"
},

@@ -19,0 +19,0 @@ "devDependencies": {

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