isml-linter 5.38.5 → 5.39.0

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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.39.0] - 2021-09-17
4
+
5
+ ### Added
6
+ - [Issue #31][issue#31] - "verbose" global configuration option;
7
+
3
8
  ## [5.38.5] - 2021-09-12
4
9
 
5
10
  ### Fixed
@@ -967,6 +972,7 @@
967
972
  ### Added
968
973
  - Linter is published;
969
974
 
975
+ [5.39.0]: https://github.com/FabiowQuixada/isml-linter/compare/v5.38.5...v5.39.0
970
976
  [5.38.5]: https://github.com/FabiowQuixada/isml-linter/compare/v5.38.4...v5.38.5
971
977
  [5.38.4]: https://github.com/FabiowQuixada/isml-linter/compare/v5.38.3...v5.38.4
972
978
  [5.38.3]: https://github.com/FabiowQuixada/isml-linter/compare/v5.38.2...v5.38.3
@@ -1111,6 +1117,7 @@
1111
1117
  [issue#26]: https://github.com/FabiowQuixada/isml-linter/issues/26
1112
1118
  [issue#29]: https://github.com/FabiowQuixada/isml-linter/issues/29
1113
1119
  [issue#30]: https://github.com/FabiowQuixada/isml-linter/issues/30
1120
+ [issue#31]: https://github.com/FabiowQuixada/isml-linter/issues/31
1114
1121
 
1115
1122
  [cli-docs]: <docs/cli.md>
1116
1123
  [api-docs]: <docs/api.md>
package/README.md CHANGED
@@ -61,7 +61,8 @@ You can disable any rule by removing it from the config file. You may also find
61
61
  | eslintConfig | Path to a eslint configuration file, to be applied within `<isscript>` tags. Default: _.eslintrc.json_ |
62
62
  | enableCache | <span style="color:orange">[Deprecated]</span> Please check [cache docs][cache-docs]. Default: **false** |
63
63
  | autoFix | Applies fixes for enabled rules. Default: **false** |
64
- | printPartialResults | Prints partial results. Useful to get overall picture in case of many errors. Default: **false** |
64
+ | printPartialResults | Limits issues or rule occurrences listed in the console to up to 30 items. Useful to get overall picture in case of many errors. Default: **false** |
65
+ | verbose | Provides additional details of the linting process in the console. Default: **false** |
65
66
  | disableTreeParse | Enables only rules that do not depend on building an ISML tree. Check below when this might be useful. Default: **false** |
66
67
  | rules | Defines which rules to check. See available rules below |
67
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isml-linter",
3
- "version": "5.38.5",
3
+ "version": "5.39.0",
4
4
  "author": "Fabiow Quixadá <ftquixada@gmail.com>",
5
5
  "license": "MIT",
6
6
  "main": "src/publicApi.js",
@@ -303,11 +303,25 @@ const getInfoData = lintResult => {
303
303
  };
304
304
  };
305
305
 
306
+ const displayVerboseMessage = (message, depth = 0) => {
307
+ const config = ConfigUtils.load();
308
+ let indentation = '';
309
+
310
+ for (let i = 0; i < depth; i++) {
311
+ indentation += ' ';
312
+ }
313
+
314
+ if (config.verbose) {
315
+ console.log(indentation + message);
316
+ }
317
+ };
318
+
306
319
  module.exports = {
307
320
  displayOccurrenceList,
308
321
  displayConfigError,
309
322
  displayEslintConfigError,
310
323
  displayInvalidTemplatesPaths,
311
324
  displayInvalidCommandError,
312
- printExceptionMsg
325
+ printExceptionMsg,
326
+ displayVerboseMessage
313
327
  };
@@ -7,6 +7,7 @@ const lowercaseFilenameRule = require('../rules/line_by_line/lowercase-filename'
7
7
  const CustomTagContainer = require('./CustomTagContainer');
8
8
  const CustomModulesRule = require('../rules/tree/custom-tags');
9
9
  const GeneralUtils = require('./GeneralUtils');
10
+ const ConsoleUtils = require('./ConsoleUtils');
10
11
  const ExceptionUtils = require('./ExceptionUtils');
11
12
 
12
13
  const lineByLineRules = [];
@@ -90,6 +91,7 @@ const applyRuleOnTemplate = (ruleArray, templatePath, root, config, data) => {
90
91
  const rule = ruleArray[i];
91
92
  if (!rule.shouldIgnore(templatePath)) {
92
93
  try {
94
+ ConsoleUtils.displayVerboseMessage(`Applying "${rule.id}" rule`, 1);
93
95
  const ruleResults = rule.check(root, templateResults.data);
94
96
  applyRuleResult(config, ruleResults, templatePath, templateResults, rule);
95
97
 
@@ -169,6 +171,7 @@ const checkFileName = (filename, templateContent) => {
169
171
 
170
172
  const checkTreeRules = (templatePath, templateContent, config, data) => {
171
173
  if (!config.disableTreeParse) {
174
+ ConsoleUtils.displayVerboseMessage(`Building tree for "${templatePath}"`, 1);
172
175
  const tree = TreeBuilder.build(templatePath, templateContent);
173
176
 
174
177
  if (!tree.rootNode) {
@@ -219,6 +222,7 @@ const checkCustomModules = () => {
219
222
  };
220
223
 
221
224
  const checkTemplate = (templatePath, data, content = '', templateName = '') => {
225
+ ConsoleUtils.displayVerboseMessage(`\nChecking "${templatePath}" template`);
222
226
  const config = ConfigUtils.load();
223
227
  const templateContent = GeneralUtils.toLF(content || fs.readFileSync(templatePath, 'utf-8'));
224
228
  const lineResults = checkLineByLineRules(templatePath, templateContent, config, data);