
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
gulp-solemn
Advanced tools
A gulp plugin to detect inappropriate language in your code.
The plugin prints violation messages to the console when it encounters inappropriate language in your JS or CSS files. Each word is associated to one or more violation categories. For example, you might associate the word "beefcake" with the violation category "sexist". You can add your own custom dictionaries to specify words that cause violations.
Each custom dictionary is a JSON file with the following format:
{
"word1": ["category1", "category3"],
"word2": ["category2"],
"word3": ["category1"]
"word4": ["category2", "category3", "category4"]
}
Every word must have at least one violation category. If multiple dictionaries are specified, words and their categories are merged.
var gulp = require('gulp');
var solemn = require('gulp-solemn');
// simple example
var simpleSolemnOptions = {
printViolationMessages: true, // whether to print the violations to the console
includeDefaultDictionary: true, // whether to include the default dictionary as well
};
gulp.src(['**/*.css', '**/*.js'])
.pipe(solemn(simpleSolemnOptions))
// custom reporter example
var simpleSolemnOptions = {
printViolationMessages: true,
reporter: function(violationMessage) {
console.log(violationMessage);
}
};
gulp.src(['**/*.css', '**/*.js'])
.pipe(solemn(simpleSolemnOptions))
// load a custom custom dictionary and
// do something with each file's set of violation objects
var perFileSolemnOptions = {
fileViolationsCallback: function(fileName, violations, violationMessages) {
// the violations and corresponding violation messages for a particular file
console.log(fileName);
violations.forEach(function(violation) {
console.log(violation.file);
console.log(violation.issues);
});
},
dictionaries: ['test/fixtures/dictionary1.json', 'test/fixtures/dictionary2.json'],
includeDefaultDictionary: false,
printViolationMessages: false,
};
gulp.src(['**/*.css', '**/*.js'])
.pipe(solemn(perFileSolemnOptions))
// load a custom custom dictionary and
// do something with each file's set of violation objects
var allFilesSolemnOptions = {
allViolationsCallback: function(violations, violationMessages) {
// the violations and corresponding violation messages for all files after they have been processed
violations.forEach(function(violation) {
console.log(violation.file);
console.log(violation.type);
console.log(violation.issues);
console.log(violation.line);
console.log(violation.column);
console.log(violation.text);
});
// already formatted violation messages
// same as what is printed when printViolationMessages === true
violationMessages.forEach(function(vm) {
console.log(vm);
})
},
dictionaries: ['test/fixtures/dictionary1.json', 'test/fixtures/dictionary2.json'],
includeDefaultDictionary: false,
printViolationMessages: false,
};
gulp.src(['**/*.css', '**/*.js'])
.pipe(solemn(perFileSolemnOptions))
To test the module, run the follow from the command line:
npm test
FAQs
A gulp plugin for detecting inappropriate language in your code.
The npm package gulp-solemn receives a total of 0 weekly downloads. As such, gulp-solemn popularity was classified as not popular.
We found that gulp-solemn demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.