Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
numberOfEventsPerType,
eventNamesPerFunction,
},
general: {
userId,
context,
invocationId,
timestamp: new Date().getTime(),
timezone: new Date().toString().match(/([A-Z]+[+-][0-9]+)/)[1],
operatingSystem: process.platform,
userAgent: process.env.SERVERLESS_DASHBOARD ? 'dashboard' : 'cli',
serverlessVersion: serverless.version,
nodeJsVersion: process.version,
isDockerContainer: isDockerContainer(),
isCISystem: ci.isCI,
ciSystem: ci.name,
isStandaloneExecutable: serverless.isStandaloneExecutable,
},
},
};
if (config.userId && data.properties && data.properties.general) {
// add platformId to segment call
data.properties.general.platformId = config.userId;
}
if (provider && provider.name && provider.name.toUpperCase() === 'AWS' && data.properties) {
data.properties.aws = {
hasIAMAuthorizer,
hasCustomAuthorizer,
hasCognitoAuthorizer,
};
async function getVisitor(returnFakeIfMissingConfig = false) {
if (!visitor) {
const profile = await getProfileFromFile();
// use fake if it is in a ci environment or has never been configured
if (_.isEmpty(profile)) {
if (detectMocha()) {
return fakeMocha;
}
if (ci.isCI) {
real.pageview(`/downloaded/ci/${ci.name}`).send();
}
return fake;
}
if (profile.report === undefined) {
if (returnFakeIfMissingConfig) { return fake; }
if (detectMocha()) {
return fakeMocha;
}
visitor = real;
}
if (profile.report === true) {
'use strict';
const inGFW = require('in-gfw');
const axios = require('axios');
const ci = require('ci-info');
const locale = require('./locale');
const isInGFW = ci.isCI && ci.name ? Promise.resolve(locale === 'zh_CN') : inGFW('goo.gl', 't.cn');
const shorturlCache = isInGFW.then(inGFW => {
return require(inGFW ? './shorturl_cn.json' : './shorturl.json');
});
function shortDocUrl (error) {
if (!error.doc) {
return error;
}
return shortUrl(error.doc).catch(ex => {
//
}).then(shortUrl => {
if (shortUrl) {
error.docShort = shortUrl;
}
return error;
'use strict';
const checkstyleFormatter = require('checkstyle-formatter');
const reportBuilder = require('junit-report-builder');
const yaml = require('js-yaml');
const fs = require('fs-extra');
const axios = require('axios');
const ci = require('ci-info');
const path = require('path');
const url = require('url');
const os = require('os');
const icons = require('./icons');
const privatePrefix = ci.isCI && ci.name && ci.name.replace(/\s*CI$/i, '').toUpperCase() + '_';
const reportPath = path.join.bind(
path,
getEnv('REPORTS', 'REPORT_PATH', 'TEST_REPORTS') || circleReportPath() || 'lint-reports'
);
let appveyorApiUrl;
const category = {
warn: 'Warning',
info: 'Information',
error: 'Error',
};
const severity = {
warn: 'warning',
info: 'information',
};
function sendDownloaded() {
real.pageview('/downloaded').send();
if (ci.isCI) {
real.pageview(`/downloaded/ci/${ci.name}`).send();
}
}