mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
Task/checkfile length (#7959)
* add hygiene task to test file length * check for the filename length instead of the path * formatted the error message * added check for entire path including directories * error messaged fixed * check relative length for 150 as agreed upon * error message to include 150 * added file length filter * check the file length seperately * ffsdfsdf * remove the test file * move it to last * restore the filtered files for further checks * removed comment * test * test * remove the test file * test commit * remove the test file * restore fileLengthFilter * test * remove the testfile * revert * xfgdgdfg * huh * test file * revert. * add all to the filter
This commit is contained in:
@@ -249,6 +249,12 @@ const tslintHygieneFilter = [
|
||||
...tslintBaseFilter
|
||||
];
|
||||
|
||||
const fileLengthFilter = filter([
|
||||
'**',
|
||||
'!extensions/import/*.docx',
|
||||
'!extensions/admin-tool-ext-win/license/**'
|
||||
], {restore: true});
|
||||
|
||||
const copyrightHeaderLines = [
|
||||
'/*---------------------------------------------------------------------------------------------',
|
||||
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
||||
@@ -387,6 +393,23 @@ function hygiene(some) {
|
||||
});
|
||||
});
|
||||
|
||||
const filelength = es.through(function (file) {
|
||||
|
||||
const fileName = path.basename(file.relative);
|
||||
const fileDir = path.dirname(file.relative);
|
||||
//check the filename is < 50 characters (basename gets the filename with extension).
|
||||
if (fileName.length > 50) {
|
||||
console.error(`File name '${fileName}' under ${fileDir} is too long. Rename file to have less than 50 characters.`);
|
||||
errorCount++;
|
||||
}
|
||||
if (file.relative.length > 150) {
|
||||
console.error(`File path ${file.relative} exceeds acceptable file-length. Rename the path to have less than 150 characters.`);
|
||||
errorCount++;
|
||||
}
|
||||
|
||||
this.emit('data', file);
|
||||
});
|
||||
|
||||
const tslintConfiguration = tslint.Configuration.findConfiguration('tslint.json', '.');
|
||||
const tslintOptions = { fix: false, formatter: 'json' };
|
||||
const tsLinter = new tslint.Linter(tslintOptions);
|
||||
@@ -418,6 +441,9 @@ function hygiene(some) {
|
||||
const productJsonFilter = filter('product.json', { restore: true });
|
||||
|
||||
const result = input
|
||||
.pipe(fileLengthFilter)
|
||||
.pipe(filelength)
|
||||
.pipe(fileLengthFilter.restore)
|
||||
.pipe(filter(f => !f.stat.isDirectory()))
|
||||
.pipe(productJsonFilter)
|
||||
.pipe(process.env['BUILD_SOURCEVERSION'] ? es.through() : productJson)
|
||||
|
||||
Reference in New Issue
Block a user