mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[SIEM][Lists] Adds circular dependency checker for lists plugin
## Summary * Added dependency checker for the public and common folders for lists
This commit is contained in:
parent
7f2e32475a
commit
957915b7e5
3 changed files with 59 additions and 0 deletions
|
@ -21,6 +21,12 @@ if [[ -z "$CODE_COVERAGE" ]] ; then
|
|||
echo ""
|
||||
echo ""
|
||||
|
||||
echo " -> Running List cyclic dependency test"
|
||||
cd "$XPACK_DIR"
|
||||
checks-reporter-with-killswitch "X-Pack List cyclic dependency test" node plugins/lists/scripts/check_circular_deps
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
# echo " -> Running jest integration tests"
|
||||
# cd "$XPACK_DIR"
|
||||
# node scripts/jest_integration --ci --verbose
|
||||
|
|
8
x-pack/plugins/lists/scripts/check_circular_deps.js
Normal file
8
x-pack/plugins/lists/scripts/check_circular_deps.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
require('../../../../src/setup_node_env');
|
||||
require('./check_circular_deps/run_check_circular_deps_cli');
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { resolve } from 'path';
|
||||
|
||||
// @ts-ignore
|
||||
import madge from 'madge';
|
||||
import { createFailError, run } from '@kbn/dev-utils';
|
||||
|
||||
run(
|
||||
async ({ log }) => {
|
||||
const result = await madge(
|
||||
[resolve(__dirname, '../../public'), resolve(__dirname, '../../common')],
|
||||
{
|
||||
excludeRegExp: [
|
||||
'test.ts$',
|
||||
'test.tsx$',
|
||||
'src/core/server/types.ts$',
|
||||
'src/core/server/saved_objects/types.ts$',
|
||||
'src/core/public/chrome/chrome_service.tsx$',
|
||||
'src/core/public/overlays/banners/banners_service.tsx$',
|
||||
'src/core/public/saved_objects/saved_objects_client.ts$',
|
||||
'src/plugins/data/public',
|
||||
'src/plugins/ui_actions/public',
|
||||
],
|
||||
fileExtensions: ['ts', 'js', 'tsx'],
|
||||
}
|
||||
);
|
||||
|
||||
const circularFound = result.circular();
|
||||
if (circularFound.length !== 0) {
|
||||
throw createFailError(
|
||||
`Lists circular dependencies of imports has been found:\n - ${circularFound.join('\n - ')}`
|
||||
);
|
||||
} else {
|
||||
log.success('No circular deps 👍');
|
||||
}
|
||||
},
|
||||
{
|
||||
description: 'Check the Lists plugin for circular deps',
|
||||
}
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue