Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// If the fallback has been explicitly disabled, don't modify the text itself.
if (options.fallback === false) {
return text;
}
return typeof options.fallback === 'function' ? options.fallback(text, url) : `${text} (\u200B${url}\u200B)`;
}
return ansiEscapes.link(text, url);
};
module.exports = (text, url, options = {}) => terminalLink(text, url, options);
module.exports.stderr = (text, url, options = {}) => terminalLink(text, url, {target: 'stderr', ...options});
module.exports.isSupported = supportsHyperlinks.stdout;
module.exports.stderr.isSupported = supportsHyperlinks.stderr;
function linkify (text, url) {
return supportsHyperlinks.stdout ? ansiEscapes.link(text, url) : `${text} (${url})`
}
const folderName = capitalizeFirstLetter(camelCase(basename(osProcess.cwd())))
const isTypeScript = checkForTypeScript()
const isBabel = checkForBabel()
const hasTravis = fs.existsSync(".travis.yml")
const hasCircle = fs.existsSync("circle.yml")
const ciType = hasTravis ? "travis" : hasCircle ? "circle" : "unknown"
const repoSlug = getRepoSlug()
const isGitHub = !!repoSlug
return {
isMac,
isWindows,
isTypeScript,
isBabel,
isAnOSSRepo: true,
supportsHLinks: supportsHyperlinks.stdout,
filename: isTypeScript ? "dangerfile.ts" : "dangerfile.js",
botName: folderName + "Bot",
hasSetUpAccount: false,
hasCreatedDangerfile: false,
hasSetUpAccountToken: false,
repoSlug,
ciType,
isGitHub,
}
}
export default function getHyperlinkText(theurl: string): string {
let thedata = ''
if (supportsHyperlinks.stdout) {
thedata = hyperlinker('点击查看详情', theurl)
} else {
thedata = theurl
}
return thedata
}
),
)}
)}
{warnings && warnings.length > 0 && onSubmitWarningsPrompt ? (
) : (
<>
Studio endpoint:
{supportsHyperlinks.stdout ? (
http://localhost:{this.props.studioPort}/
) : (
http://localhost:{this.props.studioPort}/
)}
{'─'.repeat(this.width)}
d:
diff
var prot = decodeURIComponent(unescape(href))
.replace(/[^\w:]/g, '')
.toLowerCase();
} catch (e) {
return '';
}
if (prot.indexOf('javascript:') === 0) {
return '';
}
}
var hasText = text && text !== href;
var out = '';
if (supportsHyperlinks.stdout) {
let link = ''
if(text){
link = this.o.href(this.emoji(text))
}else{
link = this.o.href(href)
}
out = ansiEscapes.link(link, href);
}else{
if (hasText) out += this.emoji(text) + ' (';
out += this.o.href(href);
if (hasText) out += ')';
}
return this.o.link(out);
};
if (options.fallback === false) {
return text;
}
return typeof options.fallback === 'function' ? options.fallback(text, url) : `${text} (\u200B${url}\u200B)`;
}
return ansiEscapes.link(text, url);
};
module.exports = (text, url, options = {}) => terminalLink(text, url, options);
module.exports.stderr = (text, url, options = {}) => terminalLink(text, url, {target: 'stderr', ...options});
module.exports.isSupported = supportsHyperlinks.stdout;
module.exports.stderr.isSupported = supportsHyperlinks.stderr;
try {
ruleUrl = data.rulesMeta[x.ruleId].docs.url;
} catch (_) {
try {
ruleUrl = getRuleDocs(x.ruleId).url;
} catch (_) {}
}
const line = [
'',
x.severity === 'warning' ? logSymbols.warning : logSymbols.error,
' '.repeat(maxLineWidth - x.lineWidth) + chalk.dim(x.line + chalk.gray(':') + x.column),
' '.repeat(maxColumnWidth - x.columnWidth) + x.message,
' '.repeat(maxMessageWidth - x.messageWidth) +
(ruleUrl && supportsHyperlink(process.stdout) ? ansiEscapes.link(chalk.dim(x.ruleId), ruleUrl) : chalk.dim(x.ruleId))
];
if (!showLineNumbers) {
line.splice(2, 1);
}
return line.join(' ');
}
return '';
}).join('\n') + '\n\n';