[6.x] Check filename casing in CI (#19282) (#19414)

Backports the following commits to 6.x:
 - Check filename casing in CI  (#19282)
This commit is contained in:
Spencer 2018-05-24 23:09:30 -07:00 committed by GitHub
parent f84eba79d9
commit 068b6652c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 108 additions and 25 deletions

View file

@ -261,7 +261,7 @@
"expect.js": "0.3.1",
"faker": "1.1.0",
"getopts": "2.0.0",
"globby": "^8.0.0",
"globby": "^8.0.1",
"grunt": "1.0.1",
"grunt-cli": "0.1.13",
"grunt-contrib-watch": "^1.0.0",

View file

@ -0,0 +1,2 @@
require('../src/babel-register');
require('../src/dev/run_check_file_casing');

View file

@ -1,23 +0,0 @@
import glob from 'glob';
import { run } from './run';
import { File } from './file';
import { REPO_ROOT } from './constants';
import { checkFileCasing } from './precommit_hook/check_file_casing';
run(async ({ log }) => {
const paths = glob.sync('**/*', {
cwd: REPO_ROOT,
nodir: true,
ignore: [
'**/node_modules/**/*',
'optimize/**/*',
'.es/**/*',
'data/**/*',
]
});
const files = paths.map(path => new File(path));
await checkFileCasing(log, files);
});

View file

@ -19,7 +19,11 @@ export const IGNORE_FILE_GLOBS = [
'x-pack/plugins/apm/**/*',
'**/.*',
'**/{webpackShims,__mocks__}/**/*',
'x-pack/docs/**/*',
'src/dev/tslint/rules/*',
// filename must match language code which requires capital letters
'src/ui/ui_i18n/__tests__/fixtures/translations/test_plugin_1/es-ES.json',
];
@ -223,4 +227,66 @@ export const TEMPORARILY_IGNORED_PATHS = [
'x-pack/server/lib/elasticsearch-shield-js/test/client.js',
'x-pack/server/lib/elasticsearch-shield-js/test/read.js',
'x-pack/test/api_integration/apis/monitoring/elasticsearch/nodes-listing.js',
'x-pack/plugins/ml/public/jobs/new_job/simple/components/watcher/email-influencers.html',
'x-pack/plugins/ml/public/styles/ui-select.less',
'x-pack/plugins/ml/server/models/data_recognizer/modules/apache2/kibana/dashboard/ML-Apache2-Access-Remote-IP-Count-Explorer.json',
'x-pack/plugins/ml/server/models/data_recognizer/modules/apache2/kibana/dashboard/ML-Apache2-Remote-IP-URL-Explorer.json',
'x-pack/plugins/ml/server/models/data_recognizer/modules/apache2/kibana/search/ML-Filebeat-Apache2-Access.json',
'x-pack/plugins/ml/server/models/data_recognizer/modules/apache2/kibana/visualization/ML-Apache2-Access-Map.json',
'x-pack/plugins/ml/server/models/data_recognizer/modules/apache2/kibana/visualization/ML-Apache2-Access-Remote-IP-Timechart.json',
'x-pack/plugins/ml/server/models/data_recognizer/modules/apache2/kibana/visualization/ML-Apache2-Access-Response-Code-Timechart.json',
'x-pack/plugins/ml/server/models/data_recognizer/modules/apache2/kibana/visualization/ML-Apache2-Access-Top-Remote-IPs-Table.json',
'x-pack/plugins/ml/server/models/data_recognizer/modules/apache2/kibana/visualization/ML-Apache2-Access-Top-URLs-Table.json',
'x-pack/plugins/ml/server/models/data_recognizer/modules/apache2/kibana/visualization/ML-Apache2-Access-Unique-Count-URL-Timechart.json',
'x-pack/plugins/ml/server/models/data_recognizer/modules/nginx/kibana/dashboard/ML-Nginx-Access-Remote-IP-Count-Explorer.json',
'x-pack/plugins/ml/server/models/data_recognizer/modules/nginx/kibana/dashboard/ML-Nginx-Remote-IP-URL-Explorer.json',
'x-pack/plugins/ml/server/models/data_recognizer/modules/nginx/kibana/search/ML-Filebeat-Nginx-Access.json',
'x-pack/plugins/ml/server/models/data_recognizer/modules/nginx/kibana/visualization/ML-Nginx-Access-Map.json',
'x-pack/plugins/ml/server/models/data_recognizer/modules/nginx/kibana/visualization/ML-Nginx-Access-Remote-IP-Timechart.json',
'x-pack/plugins/ml/server/models/data_recognizer/modules/nginx/kibana/visualization/ML-Nginx-Access-Response-Code-Timechart.json',
'x-pack/plugins/ml/server/models/data_recognizer/modules/nginx/kibana/visualization/ML-Nginx-Access-Top-Remote-IPs-Table.json',
'x-pack/plugins/ml/server/models/data_recognizer/modules/nginx/kibana/visualization/ML-Nginx-Access-Top-URLs-Table.json',
'x-pack/plugins/ml/server/models/data_recognizer/modules/nginx/kibana/visualization/ML-Nginx-Access-Unique-Count-URL-Timechart.json',
'x-pack/plugins/monitoring/public/icons/alert-blue.svg',
'x-pack/plugins/monitoring/public/icons/health-gray.svg',
'x-pack/plugins/monitoring/public/icons/health-green.svg',
'x-pack/plugins/monitoring/public/icons/health-red.svg',
'x-pack/plugins/monitoring/public/icons/health-yellow.svg',
'x-pack/plugins/reporting/export_types/printable_pdf/server/lib/pdf/assets/fonts/noto/NotoSansCJKtc-Medium.ttf',
'x-pack/plugins/reporting/export_types/printable_pdf/server/lib/pdf/assets/fonts/noto/NotoSansCJKtc-Regular.ttf',
'x-pack/plugins/reporting/export_types/printable_pdf/server/lib/pdf/assets/fonts/roboto/Roboto-Italic.ttf',
'x-pack/plugins/reporting/export_types/printable_pdf/server/lib/pdf/assets/fonts/roboto/Roboto-Medium.ttf',
'x-pack/plugins/reporting/export_types/printable_pdf/server/lib/pdf/assets/fonts/roboto/Roboto-Regular.ttf',
'x-pack/plugins/reporting/export_types/printable_pdf/server/lib/pdf/assets/img/logo-grey.png',
'x-pack/plugins/reporting/server/browsers/chromium/driver/screenshot_stitcher/fixtures/2x1-checkerboard.png',
'x-pack/plugins/reporting/server/browsers/chromium/driver/screenshot_stitcher/fixtures/2x2-black.png',
'x-pack/plugins/reporting/server/browsers/chromium/driver/screenshot_stitcher/fixtures/2x2-checkerboard.png',
'x-pack/plugins/reporting/server/browsers/chromium/driver/screenshot_stitcher/fixtures/2x2-white.png',
'x-pack/plugins/reporting/server/browsers/chromium/driver/screenshot_stitcher/fixtures/4x4-checkerboard.png',
'x-pack/plugins/reporting/server/browsers/chromium/driver/screenshot_stitcher/fixtures/single-black-pixel.png',
'x-pack/plugins/reporting/server/browsers/chromium/driver/screenshot_stitcher/fixtures/single-white-pixel.png',
'x-pack/test/functional/es_archives/monitoring/beats-with-restarted-instance/data.json.gz',
'x-pack/test/functional/es_archives/monitoring/beats-with-restarted-instance/mappings.json',
'x-pack/test/functional/es_archives/monitoring/logstash-pipelines/data.json.gz',
'x-pack/test/functional/es_archives/monitoring/logstash-pipelines/mappings.json',
'x-pack/test/functional/es_archives/monitoring/multi-basic/data.json.gz',
'x-pack/test/functional/es_archives/monitoring/multi-basic/mappings.json',
'x-pack/test/functional/es_archives/monitoring/singlecluster-basic-beats/data.json.gz',
'x-pack/test/functional/es_archives/monitoring/singlecluster-basic-beats/mappings.json',
'x-pack/test/functional/es_archives/monitoring/singlecluster-green-gold/data.json.gz',
'x-pack/test/functional/es_archives/monitoring/singlecluster-green-gold/mappings.json',
'x-pack/test/functional/es_archives/monitoring/singlecluster-green-platinum/data.json.gz',
'x-pack/test/functional/es_archives/monitoring/singlecluster-green-platinum/mappings.json',
'x-pack/test/functional/es_archives/monitoring/singlecluster-green-trial-two-nodes-one-cgrouped/data.json.gz',
'x-pack/test/functional/es_archives/monitoring/singlecluster-green-trial-two-nodes-one-cgrouped/mappings.json',
'x-pack/test/functional/es_archives/monitoring/singlecluster-red-platinum/data.json.gz',
'x-pack/test/functional/es_archives/monitoring/singlecluster-red-platinum/mappings.json',
'x-pack/test/functional/es_archives/monitoring/singlecluster-three-nodes-shard-relocation/data.json.gz',
'x-pack/test/functional/es_archives/monitoring/singlecluster-three-nodes-shard-relocation/mappings.json',
'x-pack/test/functional/es_archives/monitoring/singlecluster-yellow-basic/data.json.gz',
'x-pack/test/functional/es_archives/monitoring/singlecluster-yellow-basic/mappings.json',
'x-pack/test/functional/es_archives/monitoring/singlecluster-yellow-platinum--with-10-alerts/data.json.gz',
'x-pack/test/functional/es_archives/monitoring/singlecluster-yellow-platinum--with-10-alerts/mappings.json',
'x-pack/test/functional/es_archives/monitoring/singlecluster-yellow-platinum/data.json.gz',
'x-pack/test/functional/es_archives/monitoring/singlecluster-yellow-platinum/mappings.json',
];

View file

@ -0,0 +1,26 @@
import globby from 'globby';
import { run } from './run';
import { File } from './file';
import { REPO_ROOT } from './constants';
import { checkFileCasing } from './precommit_hook/check_file_casing';
run(async ({ log }) => {
const paths = await globby('**/*', {
cwd: REPO_ROOT,
nodir: true,
gitignore: true,
ignore: [
// the gitignore: true option makes sure that we don't
// include files from node_modules in the result, but it still
// loads all of the files from node_modules before filtering
// so it's still super slow. This prevents loading the files
// and still relies on gitignore to to final ignores
'**/node_modules',
]
});
const files = paths.map(path => new File(path));
await checkFileCasing(log, files);
});

View file

@ -73,6 +73,16 @@ module.exports = function (grunt) {
]
},
// used by the test tasks
// runs the check_file_casing script to ensure filenames use correct casing
checkFileCasing: {
cmd: process.execPath,
args: [
require.resolve('../../scripts/check_file_casing'),
'--quiet' // only log errors, not warnings
]
},
// used by the test and jenkins:unit tasks
// runs the tslint script to check for Typescript linting errors
tslint: {

View file

@ -6,6 +6,7 @@ module.exports = function (grunt) {
grunt.registerTask('jenkins:unit', [
'run:eslint',
'run:tslint',
'run:checkFileCasing',
'licenses',
'verifyDependencyVersions',
'run:verifyNotice',

View file

@ -101,6 +101,7 @@ module.exports = function (grunt) {
grunt.task.run(_.compact([
!grunt.option('quick') && 'run:eslint',
!grunt.option('quick') && 'run:tslint',
'run:checkFileCasing',
'licenses',
'test:quick',
'verifyTranslations',

View file

@ -5446,7 +5446,7 @@ globby@^6.1.0:
pify "^2.0.0"
pinkie-promise "^2.0.0"
globby@^8.0.0:
globby@^8.0.1:
version "8.0.1"
resolved "https://registry.yarnpkg.com/globby/-/globby-8.0.1.tgz#b5ad48b8aa80b35b814fc1281ecc851f1d2b5b50"
dependencies: