MCPcopy Create free account
hub / github.com/plotly/plotly.js / assertTrailingNewLine

Function assertTrailingNewLine

tasks/test_syntax.js:220–256  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

218
219// check that all files have a trailing new line character
220function assertTrailingNewLine() {
221 var pattern = combineGlobs([
222 path.join(constants.pathToSrc, '**/*.glsl'),
223 path.join(constants.pathToRoot, 'test', 'image', 'mocks', '*')
224 ]);
225
226 var regexNewLine = /\r?\n$/;
227 var regexEmptyNewLine = /^\r?\n$/;
228 var promises = [];
229 var logs = [];
230
231 glob(pattern).then((files) => {
232 files.forEach(function(file) {
233 var promise = readLastLines.read(file, 1);
234
235 promises.push(promise);
236
237 promise.then(function(lines) {
238 if(!regexNewLine.test(lines)) {
239 logs.push([
240 file, ':',
241 'does not have a trailing new line character'
242 ].join(' '));
243 } else if(regexEmptyNewLine.test(lines)) {
244 logs.push([
245 file, ':',
246 'has more than one trailing new line'
247 ].join(' '));
248 }
249 });
250 });
251
252 Promise.all(promises).then(function() {
253 log('trailing new line character', logs);
254 });
255 });
256}
257
258// check circular dependencies
259function assertCircularDeps() {

Callers 1

test_syntax.jsFile · 0.85

Calls 3

combineGlobsFunction · 0.85
globFunction · 0.85
logFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…