Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const checkFirstLine = (line) => {
const ALLOWED_TAGS = [
'Fix:',
'Breaking:',
'Build:',
'Chore:',
'Docs:',
'New:',
'Update:',
'Upgrade:'
];
let issues = [];
if (ucs2.decode(line).length > 72) {
issues.push('[Line 1] Has over 72 characters.');
}
const tag = ALLOWED_TAGS.filter((allowedTag) => {
return line.startsWith(allowedTag);
})[0];
if (!tag) {
issues.push(`[Line 1] Does not start with one of the following tags: \n\n ${ALLOWED_TAGS.join('\n ')}\n`);
}
const afterTag = tag ? line.split(tag)[1] : line;
if (!afterTag) {
issues.push(`[Line 1] No summary.`);
const getUnicode = (emoji) => {
return ucs2.decode(emoji)
.map(code => 'U+' + Number(code).toString(16).toUpperCase())
.join(' ');
};
const checkLine = (line, lineNumber) => {
const chars = ucs2.decode(line);
let issues = [];
/*
* If the line has more then 72 characters, and the part just before
* and after the 72 limit contains spaces (i.e. it's not something
* like a long URL), suggest splitting the line into multiple lines.
*/
if ((chars.length > 72) &&
(chars.slice(60, chars.length).includes(32))) {
issues.push(`[Line ${lineNumber}] Has over 72 characters, and should be split into multiple lines.`);
}
issues = [...issues, ...checkWording(line, lineNumber)];
return issues;
const getUnicode = (emoji) => {
return ucs2.decode(emoji)
.map(code => 'U+' + Number(code).toString(16).toUpperCase())
.join(' ');
};
const checkIfPropertyValueIsUnderLimit = (resource: string, content: string | undefined, propertyName: string, shortNameLengthLimit: number, getLocation: JSONLocationFunction) => {
if (content && (ucs2.decode(content).length > shortNameLengthLimit)) {
const message = getMessage('shouldHavePropertyShort', context.language, [propertyName, shortNameLengthLimit.toString()]);
const location = getLocation(propertyName, { at: 'value' });
context.report(resource, message, { location, severity: Severity.warning });
return false;
}
return true;
};
glyph.unicode.forEach((unicode, i) => {
const unicodeStr = ucs2
.decode(unicode)
.map(point => '&#x' + point.toString(16).toUpperCase() + ';')
.join('');
const d = glyphPath.round(this._options.round).encode();
this.push(
'