@mitre/inspec-objects 0.0.27 → 0.0.30

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.
@@ -60,7 +60,13 @@ function processXCCDF(xml, removeNewlines = false, useRuleId, ovalDefinitions) {
60
60
  extractedDescription = (0, pretty_1.default)(lodash_1.default.get(rule.description, '[0].p'));
61
61
  }
62
62
  else {
63
- extractedDescription = JSON.stringify(rule.description);
63
+ if (Array.isArray(lodash_1.default.get(rule.description, '[0].p'))) {
64
+ const joinedDescriptions = lodash_1.default.get(rule.description, '[0].p');
65
+ extractedDescription = (0, pretty_1.default)(joinedDescriptions.join('\n\n'));
66
+ }
67
+ else {
68
+ extractedDescription = JSON.stringify(rule.description);
69
+ }
64
70
  }
65
71
  }
66
72
  }
@@ -41,6 +41,7 @@ function getExistingDescribeFromControl(control) {
41
41
  let inQuoteBlock = false;
42
42
  let inMetadataValueOverride = false;
43
43
  let indentedMetadataOverride = false;
44
+ let inDescribeBlock = false;
44
45
  let mostSpacesSeen = 0;
45
46
  control.code.split('\n').forEach((line) => {
46
47
  const wordSplit = line.trim().split(' ');
@@ -52,11 +53,12 @@ function getExistingDescribeFromControl(control) {
52
53
  mostSpacesSeen = spaces;
53
54
  indentedMetadataOverride = false;
54
55
  }
55
- if (!inQuoteBlock && !inMetadataValueOverride && !indentedMetadataOverride) {
56
+ if ((!inQuoteBlock && !inMetadataValueOverride && !indentedMetadataOverride) || inDescribeBlock) {
56
57
  // Get the number of spaces at the beggining of the current line
57
58
  if (spaces >= 2) {
58
59
  const firstWord = wordSplit[0];
59
- if (knownInSpecKeywords.indexOf(firstWord.toLowerCase()) === -1 || (knownInSpecKeywords.indexOf(firstWord.toLowerCase()) !== -1 && spaces > 2)) {
60
+ if (knownInSpecKeywords.indexOf(firstWord.toLowerCase()) === -1 || (knownInSpecKeywords.indexOf(firstWord.toLowerCase()) !== -1 && spaces > 2) || inDescribeBlock) {
61
+ inDescribeBlock = true;
60
62
  existingDescribeBlock += line + '\n';
61
63
  }
62
64
  }
@@ -82,10 +84,6 @@ function getExistingDescribeFromControl(control) {
82
84
  }
83
85
  });
84
86
  });
85
- if (control.id === 'SV-204392') {
86
- console.log(line);
87
- console.log(inQuoteBlock);
88
- }
89
87
  });
90
88
  return existingDescribeBlock;
91
89
  }