@appland/scanner 1.61.0 → 1.62.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/built/cli/appmapDirFromConfig.js +29 -0
- package/built/cli/ci/command.js +7 -6
- package/built/cli/handleWorkingDirectory.js +8 -0
- package/built/cli/scan/command.js +5 -2
- package/built/cli/scanArgs.js +5 -1
- package/built/cli/upload/command.js +16 -2
- package/built/rules/jobNotCancelled.js +8 -5
- package/built/rules/lib/util.js +1 -27
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
# [@appland/scanner-v1.62.2](https://github.com/applandinc/appmap-js/compare/@appland/scanner-v1.62.1...@appland/scanner-v1.62.2) (2022-07-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Return proper result for job-not-cancelled ([f7ee5da](https://github.com/applandinc/appmap-js/commit/f7ee5da073849881c3c553f08fc2dd82bb8c7965))
|
|
7
|
+
|
|
8
|
+
# [@appland/scanner-v1.62.1](https://github.com/applandinc/appmap-js/compare/@appland/scanner-v1.62.0...@appland/scanner-v1.62.1) (2022-07-13)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* More reliable detection of appmap changes by scanner watch ([b0cc14d](https://github.com/applandinc/appmap-js/commit/b0cc14d61b7e27248975c35022a8cd4da070337b))
|
|
14
|
+
|
|
15
|
+
# [@appland/scanner-v1.62.0](https://github.com/applandinc/appmap-js/compare/@appland/scanner-v1.61.0...@appland/scanner-v1.62.0) (2022-07-12)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* Support working directory -d arg ([2bd280f](https://github.com/applandinc/appmap-js/commit/2bd280fa2e6bb2d13c6bc1c578b1b78c3a62492a))
|
|
21
|
+
* upload command uses appmap_dir from config ([801b75b](https://github.com/applandinc/appmap-js/commit/801b75bf008b6188d4aacd143a1992149aafebd3))
|
|
22
|
+
|
|
1
23
|
# [@appland/scanner-v1.61.0](https://github.com/applandinc/appmap-js/compare/@appland/scanner-v1.60.0...@appland/scanner-v1.61.0) (2022-07-11)
|
|
2
24
|
|
|
3
25
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.appmapDirFromConfig = void 0;
|
|
13
|
+
const fs_1 = require("fs");
|
|
14
|
+
const promises_1 = require("fs/promises");
|
|
15
|
+
const js_yaml_1 = require("js-yaml");
|
|
16
|
+
const util_1 = require("util");
|
|
17
|
+
function appmapDirFromConfig() {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const appMapConfigExists = yield (0, util_1.promisify)(fs_1.exists)('appmap.yml');
|
|
20
|
+
if (appMapConfigExists) {
|
|
21
|
+
const appMapConfigData = (0, js_yaml_1.load)((yield (0, promises_1.readFile)('appmap.yml')).toString());
|
|
22
|
+
if (appMapConfigData && typeof appMapConfigData === 'object') {
|
|
23
|
+
const configData = appMapConfigData;
|
|
24
|
+
return configData['appmap_dir'];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.appmapDirFromConfig = appmapDirFromConfig;
|
package/built/cli/ci/command.js
CHANGED
|
@@ -18,6 +18,7 @@ const util_1 = require("util");
|
|
|
18
18
|
const configurationProvider_1 = require("../../configuration/configurationProvider");
|
|
19
19
|
const errors_1 = require("../../errors");
|
|
20
20
|
const util_2 = require("../../rules/lib/util");
|
|
21
|
+
const appmapDirFromConfig_1 = require("../appmapDirFromConfig");
|
|
21
22
|
const findings_1 = require("../../findings");
|
|
22
23
|
const findingsReport_1 = __importDefault(require("../../report/findingsReport"));
|
|
23
24
|
const summaryReport_1 = __importDefault(require("../../report/summaryReport"));
|
|
@@ -30,6 +31,7 @@ const updateCommitStatus_1 = __importDefault(require("../updateCommitStatus"));
|
|
|
30
31
|
const reportUploadURL_1 = __importDefault(require("../reportUploadURL"));
|
|
31
32
|
const fail_1 = __importDefault(require("../fail"));
|
|
32
33
|
const codeVersionArgs_1 = __importDefault(require("../codeVersionArgs"));
|
|
34
|
+
const handleWorkingDirectory_1 = require("../handleWorkingDirectory");
|
|
33
35
|
exports.default = {
|
|
34
36
|
command: 'ci',
|
|
35
37
|
describe: 'Scan AppMaps, report findings to AppMap Server, and update SCM status',
|
|
@@ -59,17 +61,16 @@ exports.default = {
|
|
|
59
61
|
handler(options) {
|
|
60
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
63
|
let { appmapDir } = options;
|
|
62
|
-
const { config, verbose: isVerbose, fail: failOption, app: appIdArg, reportFile, upload: doUpload, updateCommitStatus: updateCommitStatusOption, mergeKey, commit, branch, environment, } = options;
|
|
64
|
+
const { config, verbose: isVerbose, fail: failOption, app: appIdArg, directory, reportFile, upload: doUpload, updateCommitStatus: updateCommitStatusOption, mergeKey, commit, branch, environment, } = options;
|
|
63
65
|
if (isVerbose) {
|
|
64
66
|
(0, util_2.verbose)(true);
|
|
65
67
|
}
|
|
68
|
+
(0, handleWorkingDirectory_1.handleWorkingDirectory)(directory);
|
|
66
69
|
if (!appmapDir) {
|
|
67
|
-
appmapDir = yield (0,
|
|
68
|
-
}
|
|
69
|
-
if (!appmapDir) {
|
|
70
|
-
appmapDir = yield (0, util_2.appmapDirFromConfig)();
|
|
71
|
-
throw new errors_1.ValidationError('--appmap-dir is required');
|
|
70
|
+
appmapDir = yield (0, appmapDirFromConfig_1.appmapDirFromConfig)();
|
|
72
71
|
}
|
|
72
|
+
if (!appmapDir)
|
|
73
|
+
throw new errors_1.ValidationError('appmapDir must be provided as a command option, or available in appmap.yml');
|
|
73
74
|
yield (0, validateFile_1.default)('directory', appmapDir);
|
|
74
75
|
const appId = yield (0, resolveAppId_1.default)(appIdArg, appmapDir);
|
|
75
76
|
const glob = (0, util_1.promisify)(glob_1.glob);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleWorkingDirectory = void 0;
|
|
4
|
+
function handleWorkingDirectory(directory) {
|
|
5
|
+
if (directory)
|
|
6
|
+
process.chdir(directory);
|
|
7
|
+
}
|
|
8
|
+
exports.handleWorkingDirectory = handleWorkingDirectory;
|
|
@@ -14,12 +14,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const errors_1 = require("../../errors");
|
|
16
16
|
const util_1 = require("../../rules/lib/util");
|
|
17
|
+
const appmapDirFromConfig_1 = require("../appmapDirFromConfig");
|
|
17
18
|
const validateFile_1 = __importDefault(require("../validateFile"));
|
|
18
19
|
const scanArgs_1 = __importDefault(require("../scanArgs"));
|
|
19
20
|
const resolveAppId_1 = __importDefault(require("../resolveAppId"));
|
|
20
21
|
const singleScan_1 = __importDefault(require("./singleScan"));
|
|
21
22
|
const watchScan_1 = __importDefault(require("./watchScan"));
|
|
22
23
|
const configurationProvider_1 = require("../../configuration/configurationProvider");
|
|
24
|
+
const handleWorkingDirectory_1 = require("../handleWorkingDirectory");
|
|
23
25
|
exports.default = {
|
|
24
26
|
command: 'scan',
|
|
25
27
|
describe: 'Scan AppMaps for code behavior findings',
|
|
@@ -48,10 +50,11 @@ exports.default = {
|
|
|
48
50
|
handler(options) {
|
|
49
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
52
|
let { appmapDir } = options;
|
|
51
|
-
const { appmapFile, config, verbose: isVerbose, all: reportAllFindings, watch, app: appIdArg, apiKey, ide, reportFile, } = options;
|
|
53
|
+
const { appmapFile, config, directory, verbose: isVerbose, all: reportAllFindings, watch, app: appIdArg, apiKey, ide, reportFile, } = options;
|
|
52
54
|
if (isVerbose) {
|
|
53
55
|
(0, util_1.verbose)(true);
|
|
54
56
|
}
|
|
57
|
+
(0, handleWorkingDirectory_1.handleWorkingDirectory)(directory);
|
|
55
58
|
if (apiKey) {
|
|
56
59
|
process.env.APPLAND_API_KEY = apiKey;
|
|
57
60
|
}
|
|
@@ -65,7 +68,7 @@ exports.default = {
|
|
|
65
68
|
throw new errors_1.ValidationError(`Don't use --app with --watch, because in watch mode all findings are reported`);
|
|
66
69
|
}
|
|
67
70
|
if (!appmapFile && !appmapDir) {
|
|
68
|
-
appmapDir = (yield (0,
|
|
71
|
+
appmapDir = (yield (0, appmapDirFromConfig_1.appmapDirFromConfig)()) || '.';
|
|
69
72
|
}
|
|
70
73
|
if (appmapDir)
|
|
71
74
|
yield (0, validateFile_1.default)('directory', appmapDir);
|
package/built/cli/scanArgs.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
function default_1(args) {
|
|
4
|
+
args.option('directory', {
|
|
5
|
+
describe: 'program working directory',
|
|
6
|
+
type: 'string',
|
|
7
|
+
alias: 'd',
|
|
8
|
+
});
|
|
4
9
|
args.option('appmap-dir', {
|
|
5
10
|
describe: 'directory to recursively inspect for AppMaps',
|
|
6
|
-
alias: 'd',
|
|
7
11
|
});
|
|
8
12
|
args.option('config', {
|
|
9
13
|
describe: 'path to assertions config file (TypeScript or YAML, check docs for configuration format)',
|
|
@@ -14,19 +14,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const promises_1 = require("fs/promises");
|
|
16
16
|
const util_1 = require("../../rules/lib/util");
|
|
17
|
+
const appmapDirFromConfig_1 = require("../appmapDirFromConfig");
|
|
17
18
|
const validateFile_1 = __importDefault(require("../validateFile"));
|
|
18
19
|
const resolveAppId_1 = __importDefault(require("../resolveAppId"));
|
|
19
20
|
const reportUploadURL_1 = __importDefault(require("../reportUploadURL"));
|
|
20
21
|
const upload_1 = __importDefault(require("../upload"));
|
|
21
22
|
const codeVersionArgs_1 = __importDefault(require("../codeVersionArgs"));
|
|
23
|
+
const errors_1 = require("../../errors");
|
|
24
|
+
const handleWorkingDirectory_1 = require("../handleWorkingDirectory");
|
|
22
25
|
exports.default = {
|
|
23
26
|
command: 'upload',
|
|
24
27
|
describe: 'Upload Findings to the AppMap Server',
|
|
25
28
|
builder(args) {
|
|
26
29
|
(0, codeVersionArgs_1.default)(args);
|
|
30
|
+
args.option('directory', {
|
|
31
|
+
describe: 'program working directory',
|
|
32
|
+
type: 'string',
|
|
33
|
+
alias: 'd',
|
|
34
|
+
});
|
|
27
35
|
args.option('appmap-dir', {
|
|
28
36
|
describe: 'base directory of AppMaps',
|
|
29
|
-
alias: 'd',
|
|
30
37
|
});
|
|
31
38
|
args.option('report-file', {
|
|
32
39
|
describe: 'file containing the findings report',
|
|
@@ -42,10 +49,17 @@ exports.default = {
|
|
|
42
49
|
},
|
|
43
50
|
handler(options) {
|
|
44
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
|
|
52
|
+
let { appmapDir } = options;
|
|
53
|
+
const { verbose: isVerbose, directory, reportFile, app: appIdArg, mergeKey, branch, commit, environment, } = options;
|
|
46
54
|
if (isVerbose) {
|
|
47
55
|
(0, util_1.verbose)(true);
|
|
48
56
|
}
|
|
57
|
+
(0, handleWorkingDirectory_1.handleWorkingDirectory)(directory);
|
|
58
|
+
if (!appmapDir) {
|
|
59
|
+
appmapDir = yield (0, appmapDirFromConfig_1.appmapDirFromConfig)();
|
|
60
|
+
}
|
|
61
|
+
if (!appmapDir)
|
|
62
|
+
throw new errors_1.ValidationError('appmapDir must be provided as a command option, or available in appmap.yml');
|
|
49
63
|
yield (0, validateFile_1.default)('directory', appmapDir);
|
|
50
64
|
const appId = yield (0, resolveAppId_1.default)(appIdArg, appmapDir);
|
|
51
65
|
const scanResults = JSON.parse((yield (0, promises_1.readFile)(reportFile)).toString());
|
|
@@ -18,11 +18,14 @@ function build() {
|
|
|
18
18
|
const missing = creationEvents.length - cancellationEvents.length;
|
|
19
19
|
if (missing === 0)
|
|
20
20
|
return;
|
|
21
|
-
|
|
22
|
-
event:
|
|
23
|
-
message:
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
const result = {
|
|
22
|
+
event: event,
|
|
23
|
+
message: `${missing} jobs are scheduled but not cancelled in a rolled back transaction`,
|
|
24
|
+
// if there's a mismatch and there are cancellations we can't tell
|
|
25
|
+
// for sure which creations they match, so return everything
|
|
26
|
+
relatedEvents: [...creationEvents, ...cancellationEvents],
|
|
27
|
+
};
|
|
28
|
+
return [result];
|
|
26
29
|
}
|
|
27
30
|
return {
|
|
28
31
|
matcher,
|
package/built/rules/lib/util.js
CHANGED
|
@@ -1,33 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.verbose = exports.toRegExpArray = exports.responseContentType = exports.toRegExp = exports.providesAuthentication = exports.pluralize = exports.dasherize = exports.camelize = exports.parseValue = exports.isRoot = exports.ideLink = exports.isTruthy = exports.isFalsey = exports.emptyValue = exports.capitalize = exports.appMapDir =
|
|
13
|
-
const fs_1 = require("fs");
|
|
14
|
-
const promises_1 = require("fs/promises");
|
|
15
|
-
const js_yaml_1 = require("js-yaml");
|
|
3
|
+
exports.verbose = exports.toRegExpArray = exports.responseContentType = exports.toRegExp = exports.providesAuthentication = exports.pluralize = exports.dasherize = exports.camelize = exports.parseValue = exports.isRoot = exports.ideLink = exports.isTruthy = exports.isFalsey = exports.emptyValue = exports.capitalize = exports.appMapDir = void 0;
|
|
16
4
|
const path_1 = require("path");
|
|
17
|
-
const util_1 = require("util");
|
|
18
|
-
function appmapDirFromConfig() {
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const appMapConfigExists = yield (0, util_1.promisify)(fs_1.exists)('appmap.yml');
|
|
21
|
-
if (appMapConfigExists) {
|
|
22
|
-
const appMapConfigData = (0, js_yaml_1.load)((yield (0, promises_1.readFile)('appmap.yml')).toString());
|
|
23
|
-
if (appMapConfigData && typeof appMapConfigData === 'object') {
|
|
24
|
-
const configData = appMapConfigData;
|
|
25
|
-
return configData['appmap_dir'];
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
exports.appmapDirFromConfig = appmapDirFromConfig;
|
|
31
5
|
let isVerbose = false;
|
|
32
6
|
function verbose(v = null) {
|
|
33
7
|
if (v === true || v === false) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appland/scanner",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.62.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"bin": "built/cli.js",
|
|
6
6
|
"files": [
|
|
@@ -65,11 +65,11 @@
|
|
|
65
65
|
"applicationinsights": "^2.1.4",
|
|
66
66
|
"async": "^3.2.3",
|
|
67
67
|
"chalk": "^4.1.2",
|
|
68
|
-
"chokidar": "
|
|
68
|
+
"chokidar": "applandinc/chokidar#fix/new-file-new-directory-race-on-linux",
|
|
69
69
|
"cli-progress": "^3.11.0",
|
|
70
70
|
"conf": "^10.0.2",
|
|
71
71
|
"form-data": "^4.0.0",
|
|
72
|
-
"glob": "
|
|
72
|
+
"glob": "7.2.3",
|
|
73
73
|
"js-yaml": "^4.1.0",
|
|
74
74
|
"lru-cache": "^6.0.0",
|
|
75
75
|
"minimatch": "^3.0.4",
|