@eagleoutice/flowr 2.16.3 → 2.16.4

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.
Files changed (91) hide show
  1. package/README.md +14 -14
  2. package/dataflow/environments/query-fn-props.js +2 -1
  3. package/dataflow/eval/resolve/resolve.js +2 -6
  4. package/documentation/doc-util/doc-query.d.ts +1 -1
  5. package/documentation/doc-util/doc-query.js +3 -1
  6. package/documentation/doc-util/doc-timings.js +3 -2
  7. package/documentation/wiki-create-linting-rules.js +1 -1
  8. package/documentation/wiki-linter.d.ts +14 -0
  9. package/documentation/wiki-linter.js +341 -126
  10. package/linter/linter-rules.d.ts +47 -47
  11. package/linter/rules/absolute-path.d.ts +1 -1
  12. package/linter/rules/absolute-path.js +6 -4
  13. package/linter/rules/cmd-check/call-arguments.d.ts +1 -1
  14. package/linter/rules/cmd-check/call-arguments.js +10 -5
  15. package/linter/rules/cmd-check/compiled-code.d.ts +1 -1
  16. package/linter/rules/cmd-check/compiled-code.js +1 -1
  17. package/linter/rules/cmd-check/conformance.d.ts +5 -1
  18. package/linter/rules/cmd-check/conformance.js +64 -64
  19. package/linter/rules/cmd-check/description-metadata.d.ts +1 -1
  20. package/linter/rules/cmd-check/description-metadata.js +1 -1
  21. package/linter/rules/cmd-check/documentation-mismatch.d.ts +6 -0
  22. package/linter/rules/cmd-check/foreign-function-calls.d.ts +1 -1
  23. package/linter/rules/cmd-check/foreign-function-calls.js +1 -1
  24. package/linter/rules/cmd-check/namespace-tampering.d.ts +1 -1
  25. package/linter/rules/cmd-check/namespace-tampering.js +1 -1
  26. package/linter/rules/cmd-check/non-ascii-code.d.ts +1 -1
  27. package/linter/rules/cmd-check/non-ascii-code.js +1 -1
  28. package/linter/rules/cmd-check/package-data.d.ts +3 -1
  29. package/linter/rules/cmd-check/package-data.js +1 -1
  30. package/linter/rules/cmd-check/package-hooks.d.ts +2 -2
  31. package/linter/rules/cmd-check/package-hooks.js +13 -5
  32. package/linter/rules/cmd-check/package-metafiles.d.ts +1 -1
  33. package/linter/rules/cmd-check/package-metafiles.js +1 -1
  34. package/linter/rules/cmd-check/package-structure.d.ts +1 -1
  35. package/linter/rules/cmd-check/package-structure.js +1 -1
  36. package/linter/rules/cmd-check/rd-files.d.ts +17 -1
  37. package/linter/rules/cmd-check/rd-files.js +1 -1
  38. package/linter/rules/cmd-check/true-false-abbreviation.d.ts +1 -1
  39. package/linter/rules/cmd-check/true-false-abbreviation.js +1 -1
  40. package/linter/rules/dataframe-access-validation.d.ts +1 -1
  41. package/linter/rules/dataframe-access-validation.js +1 -1
  42. package/linter/rules/dead-code.d.ts +4 -4
  43. package/linter/rules/dead-code.js +19 -4
  44. package/linter/rules/deprecated-functions.d.ts +1 -1
  45. package/linter/rules/deprecated-functions.js +1 -1
  46. package/linter/rules/file-path-validity.d.ts +6 -2
  47. package/linter/rules/file-path-validity.js +7 -3
  48. package/linter/rules/namespace-access.d.ts +3 -3
  49. package/linter/rules/namespace-access.js +12 -3
  50. package/linter/rules/naming-convention.d.ts +1 -1
  51. package/linter/rules/naming-convention.js +1 -1
  52. package/linter/rules/network-functions.d.ts +1 -1
  53. package/linter/rules/network-functions.js +1 -1
  54. package/linter/rules/no-leaked-credentials.d.ts +1 -1
  55. package/linter/rules/no-leaked-credentials.js +1 -1
  56. package/linter/rules/problematic-inputs.d.ts +2 -2
  57. package/linter/rules/problematic-inputs.js +2 -2
  58. package/linter/rules/roxygen-arguments.d.ts +2 -2
  59. package/linter/rules/roxygen-arguments.js +2 -2
  60. package/linter/rules/seeded-randomness.d.ts +2 -2
  61. package/linter/rules/seeded-randomness.js +2 -2
  62. package/linter/rules/software-has-license.d.ts +2 -2
  63. package/linter/rules/software-has-license.js +2 -2
  64. package/linter/rules/software-has-tests.d.ts +2 -2
  65. package/linter/rules/software-has-tests.js +2 -2
  66. package/linter/rules/stop-with-call-arg.d.ts +3 -3
  67. package/linter/rules/stop-with-call-arg.js +21 -4
  68. package/linter/rules/syntactically-valid.d.ts +1 -1
  69. package/linter/rules/syntactically-valid.js +1 -1
  70. package/linter/rules/unclosed-connection.d.ts +2 -2
  71. package/linter/rules/unclosed-connection.js +2 -2
  72. package/linter/rules/undefined-symbol.d.ts +1 -1
  73. package/linter/rules/undefined-symbol.js +1 -1
  74. package/linter/rules/unescaped-arguments.d.ts +1 -1
  75. package/linter/rules/unescaped-arguments.js +1 -1
  76. package/linter/rules/unused-definition.d.ts +1 -1
  77. package/linter/rules/unused-definition.js +1 -1
  78. package/linter/rules/unused-import.d.ts +1 -1
  79. package/linter/rules/unused-import.js +1 -1
  80. package/linter/rules/useless-loop.d.ts +1 -1
  81. package/linter/rules/useless-loop.js +1 -1
  82. package/package.json +1 -1
  83. package/project/context/flowr-analyzer-environment-context.d.ts +1 -1
  84. package/project/context/flowr-analyzer-environment-context.js +2 -1
  85. package/project/context/flowr-analyzer-files-context.js +12 -11
  86. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +1 -1
  87. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +1 -1
  88. package/queries/catalog/dependencies-query/data-flow.d.ts +2 -0
  89. package/queries/catalog/dependencies-query/data-flow.js +6 -0
  90. package/queries/catalog/dependencies-query/implicit-echo.js +3 -1
  91. package/util/version.js +2 -2
@@ -28,114 +28,114 @@ exports.CmdCheckConformance = [
28
28
  {
29
29
  area: 'The package as a whole',
30
30
  entries: [
31
- { check: "for file 'DESCRIPTION'", line: 6706, book: 'description', rules: ['description-metadata'], level: Full, note: 'without a DESCRIPTION, flowR does not see a package' },
32
- { check: 'whether tarball can be unpacked', line: 7820, book: 'package-structure', rules: ['package-structure'], level: Static, note: 'a source folder needs no unpacking, the path rules of tarballs are checked' },
31
+ { check: "for file 'DESCRIPTION'", line: 6706, book: 'description', rules: ['description-metadata'], level: Full, adds: 'reports every problem instead of stopping at the first' },
32
+ { check: 'whether tarball can be unpacked', line: 7820, book: 'package-structure', rules: ['package-structure'], level: Static, note: 'only the path rules of tarballs' },
33
33
  { check: 'package directory', line: 508, book: 'package-structure', rules: ['package-structure'], level: Full },
34
- { check: 'if this is a source package', line: 7005, book: 'package-structure', rules: ['package-runtime'], level: Full },
34
+ { check: 'if this is a source package', line: 7005, book: 'package-structure', rules: ['package-runtime'], level: Full, note: 'the Built field and object files in src are not checked' },
35
35
  { check: 'extension type', line: 6755, book: 'description', rules: ['package-runtime'], level: Full },
36
- { check: 'package bundle', line: 6765, book: 'description', rules: ['description-metadata'], level: Partial, note: 'bundles are defunct since R 2.11' },
36
+ { check: 'package bundle', line: 6765, book: 'description', rules: ['description-metadata'], level: Partial },
37
37
  { check: 'if there is a namespace', line: 7971, book: 'namespace', rules: ['package-runtime'], level: Full, note: 'needs the package on disk' }
38
38
  ]
39
39
  },
40
40
  {
41
41
  area: 'Package structure and files',
42
42
  entries: [
43
- { check: 'for portable file names', line: 776, book: 'package-structure', rules: ['package-structure'], level: Full },
43
+ { check: 'for portable file names', line: 776, book: 'package-structure', rules: ['package-structure'], level: Full, options: ['package-structure.maxPathLength'] },
44
44
  { check: 'for sufficient/correct file permissions', line: 928, book: 'package-structure', rules: ['package-structure'], level: Full, note: 'needs the package on disk' },
45
- { check: 'for executable files', line: 5798, book: 'package-structure', rules: ['package-structure'], level: Full, note: 'needs the package on disk' },
46
- { check: 'for hidden files and directories', line: 5874, book: 'package-structure', rules: ['package-structure'], level: Full },
45
+ { check: 'for executable files', line: 5798, book: 'package-structure', rules: ['package-structure'], level: Full, note: 'needs the package on disk, detects ELF, PE, and Mach-O binaries' },
46
+ { check: 'for hidden files and directories', line: 5874, book: 'package-structure', rules: ['package-structure'], level: Full, options: ['package-structure.hiddenAllowed', 'package-structure.cranKnownHidden', 'package-structure.cranPack'] },
47
47
  { check: 'for .dll and .exe files', line: 5840, book: 'package-structure', rules: ['package-structure'], level: Full },
48
- { check: 'for future file timestamps', line: 525, book: 'package-structure', rules: ['package-structure'], level: Full, note: 'needs the package on disk' },
49
- { check: 'top-level files', line: 1371, book: 'package-structure', rules: ['package-structure'], level: Full },
48
+ { check: 'for future file timestamps', line: 525, book: 'package-structure', rules: ['package-structure'], level: Full, note: 'needs the package on disk', options: ['package-structure.checkFutureTimestamps'] },
49
+ { check: 'top-level files', line: 1371, book: 'package-structure', rules: ['package-structure'], level: Full, note: 'checkbashisms and autoreconf are not run', options: ['package-structure.checkTopLevel', 'package-structure.standardTopLevel', 'package-structure.checkBashisms'] },
50
50
  { check: 'for left-over files', line: 1733, book: 'r-code', rules: ['package-structure'], level: Full },
51
- { check: 'package subdirectories', line: 1796, book: 'package-structure', rules: ['package-structure'], level: Full },
51
+ { check: 'package subdirectories', line: 1796, book: 'package-structure', rules: ['package-structure'], level: Full, options: ['package-structure.reservedInstDirs'] },
52
52
  { check: "'build' directory", line: 1325, book: 'package-structure', rules: ['package-structure'], level: Full },
53
- { check: 'installed package size', line: 6672, book: 'r-code', rules: ['package-structure'], level: Static, note: 'estimated from the files that would be installed' },
54
- { check: "sizes of PDF files under 'inst/doc'", line: 3356, book: 'vignettes', rules: ['package-structure'], level: Static, note: 'reports large PDFs, cannot compact them' },
53
+ { check: 'installed package size', line: 6672, book: 'r-code', rules: ['package-structure'], level: Static, note: 'estimated from the files that would be installed', options: ['package-structure.maxInstalledSizeMb'] },
54
+ { check: "sizes of PDF files under 'inst/doc'", line: 3356, book: 'vignettes', rules: ['package-structure'], level: Static, note: 'reports large PDFs, cannot compact them', options: ['package-structure.maxPdfBytes'] },
55
55
  { check: 'line endings in shell scripts', line: 3414, book: 'package-structure', rules: ['package-structure', 'compiled-code'], level: Full },
56
- { check: "files in 'vignettes'", line: 3204, book: 'vignettes', rules: ['package-structure'], level: Full },
56
+ { check: "files in 'vignettes'", line: 3204, book: 'vignettes', rules: ['package-structure'], level: Full, options: ['package-structure.builtPackage', 'package-structure.leftoverExtensions'] },
57
57
  { check: 'for left-overs from vignette generation', line: 696, book: 'vignettes', rules: ['package-structure'], level: Full },
58
- { check: "installed files from 'inst/doc'", line: 3106, book: 'vignettes', rules: ['package-structure'], level: Static },
59
- { check: 'for code which exercises the package', line: 8103, book: 'tests', rules: ['software-has-tests'], level: Full }
58
+ { check: "installed files from 'inst/doc'", line: 3106, book: 'vignettes', rules: ['package-structure'], level: Static, options: ['package-structure.leftoverExtensions', 'package-structure.docDirsNotInstalled'] },
59
+ { check: 'for code which exercises the package', line: 8103, book: 'tests', rules: ['software-has-tests'], level: Full, note: 'only tests count, examples and vignettes do not', options: ['software-has-tests.additionalTestFunctions'] }
60
60
  ]
61
61
  },
62
62
  {
63
63
  area: 'DESCRIPTION and dependencies',
64
64
  entries: [
65
- { check: 'DESCRIPTION meta-information', line: 1008, book: 'description', rules: ['description-metadata', 'software-has-license'], level: Full },
66
- { check: 'CRAN incoming feasibility', line: 6786, book: 'description', rules: ['description-metadata'], level: Partial, note: 'the DESCRIPTION based notes; repository queries are left out' },
67
- { check: 'package dependencies', line: 6949, book: 'description', rules: ['dependency-declaration', 'description-metadata'], level: Static, note: 'availability and versions asked of the signature database instead of the repositories' },
68
- { check: 'dependencies in R code', line: 2169, book: 'description', rules: ['dependency-declaration', 'namespace-access'], level: Full, note: 'resolves package names through variables, knows the loaders of other packages' },
69
- { check: 'for unstated dependencies in tests', line: 4779, book: 'tests', rules: ['dependency-declaration'], level: Full },
70
- { check: 'for unstated dependencies in examples', line: 2865, book: 'documentation', rules: ['dependency-declaration'], level: Full },
71
- { check: 'for unstated dependencies in vignettes', line: 4954, book: 'vignettes', rules: ['dependency-declaration'], level: Full, note: 'including \\VignetteDepends, \\VignetteEngine, VignetteBuilder' },
65
+ { check: 'DESCRIPTION meta-information', line: 1008, book: 'description', rules: ['description-metadata', 'software-has-license'], level: Full, options: ['software-has-license.checkDescriptionFile', 'description-metadata.cranIncoming'] },
66
+ { check: 'CRAN incoming feasibility', line: 6786, book: 'description', rules: ['description-metadata'], level: Partial, note: 'the DESCRIPTION based notes, repository queries are left out', options: ['description-metadata.cranIncoming'] },
67
+ { check: 'package dependencies', line: 6949, book: 'description', rules: ['dependency-declaration', 'description-metadata'], level: Static, note: 'availability and versions asked of the signature database instead of the repositories', options: ['description-metadata.maxDepends', 'description-metadata.maxImports', 'dependency-declaration.checkAvailability', 'dependency-declaration.headerOnlyPackages'] },
68
+ { check: 'dependencies in R code', line: 2169, book: 'description', rules: ['dependency-declaration', 'namespace-access'], level: Full, adds: 'resolves package names through variables and knows the loaders of other packages', options: ['dependency-declaration.reportLibraryCalls', 'dependency-declaration.reportDependsNotImported', 'dependency-declaration.ignoreWithin'] },
69
+ { check: 'for unstated dependencies in tests', line: 4779, book: 'tests', rules: ['dependency-declaration'], level: Full, options: ['dependency-declaration.checkOtherCode'] },
70
+ { check: 'for unstated dependencies in examples', line: 2865, book: 'documentation', rules: ['dependency-declaration'], level: Full, options: ['dependency-declaration.checkOtherCode'] },
71
+ { check: 'for unstated dependencies in vignettes', line: 4954, book: 'vignettes', rules: ['dependency-declaration'], level: Full, adds: 'packages named in \\VignetteEngine', options: ['dependency-declaration.checkOtherCode'] },
72
72
  { check: 'whether the package can be loaded with stated dependencies', line: 4173, book: 'description', rules: ['dependency-declaration'], level: Static },
73
73
  { check: 'whether the namespace can be loaded with stated dependencies', line: 4210, book: 'description', rules: ['dependency-declaration', 'package-runtime'], level: Static },
74
- { check: 'LazyData', line: 3037, book: 'data', rules: ['package-data'], level: Full }
74
+ { check: 'LazyData', line: 3037, book: 'data', rules: ['package-data'], level: Full, note: 'the size of the installed LazyData database is not checked' }
75
75
  ]
76
76
  },
77
77
  {
78
78
  area: 'R code',
79
79
  entries: [
80
- { check: 'R files for syntax errors', line: 2154, book: 'r-code', rules: ['syntactically-valid'], level: Full },
81
- { check: 'code files for non-ASCII characters', line: 2133, book: 'r-code', rules: ['non-ascii-code'], level: Full, note: 'reports each token, escapes strings as a quick fix' },
82
- { check: 'R code for possible problems', line: 2302, book: 'r-code', rules: ['undefined-symbol', 'call-arguments', 'global-environment-modification', 'class-string-comparison', 'bogus-return', 'package-hooks', 'namespace-tampering', 'deprecated-functions', 'true-false-abbreviation'], level: Full, note: 'codetools usage checks and the tools:::.check_package_code_* notes; resolves calls through the dataflow graph' },
83
- { check: 'S3 generic/method consistency', line: 2198, book: 'r-code', rules: ['s3-method-consistency'], level: Full },
84
- { check: 'replacement functions', line: 2235, book: 'r-code', rules: ['s3-method-consistency'], level: Full },
85
- { check: 'foreign function calls', line: 2262, book: 'r-code', rules: ['foreign-function-calls'], level: Static, note: 'the routine registration needs the installed package' },
86
- { check: 'use of S3 registration', line: 4333, book: 'r-code', rules: ['s3-method-consistency'], level: Static },
87
- { check: 'whether startup messages can be suppressed', line: 4306, book: 'r-code', rules: ['package-hooks'], level: Static, note: 'output in package hooks not sent through packageStartupMessage' },
88
- { check: 'whether the namespace can be unloaded cleanly', line: 4258, book: 'r-code', rules: ['package-hooks'], level: Static },
80
+ { check: 'R files for syntax errors', line: 2154, book: 'r-code', rules: ['syntactically-valid'], level: Full, adds: 'quick fixes repairing the syntax error', options: ['syntactically-valid.disabledFixes', 'syntactically-valid.preferFix'] },
81
+ { check: 'code files for non-ASCII characters', line: 2133, book: 'r-code', rules: ['non-ascii-code'], level: Full, adds: 'reports each token instead of each file, escapes strings as a quick fix', options: ['non-ascii-code.checkStrings', 'non-ascii-code.checkSymbols'] },
82
+ { check: 'R code for possible problems', line: 2302, book: 'r-code', rules: ['undefined-symbol', 'call-arguments', 'global-environment-modification', 'class-string-comparison', 'bogus-return', 'package-hooks', 'namespace-tampering', 'deprecated-functions', 'true-false-abbreviation'], level: Full, adds: 'quick fixes, deprecated arguments, environments resolved through variables, hooks followed into callees', options: ['call-arguments.reportPartialMatches', 'call-arguments.checkPackageFunctions', 'class-string-comparison.checkWhile', 'class-string-comparison.resolveStrings', 'global-environment-modification.checkSuperAssignments', 'global-environment-modification.allowedGlobals', 'namespace-tampering.checkInternal', 'true-false-abbreviation.reportRedefinitions', 'undefined-symbol.checkFunctions', 'undefined-symbol.checkVariables', 'undefined-symbol.checkSubscripts', 'deprecated-functions.always', 'deprecated-functions.conditionally', 'package-hooks.startupMessageFunctions', 'package-hooks.allowedOutput', 'package-hooks.unsafeCalls', 'package-hooks.followCalls'] },
83
+ { check: 'S3 generic/method consistency', line: 2198, book: 'r-code', rules: ['s3-method-consistency'], level: Full, adds: 'apparent and unregistered methods without setting an environment variable', options: ['s3-method-consistency.checkMethods', 's3-method-consistency.checkApparentMethods'] },
84
+ { check: 'replacement functions', line: 2235, book: 'r-code', rules: ['s3-method-consistency'], level: Full, adds: 'apparent replacement methods', options: ['s3-method-consistency.checkReplacementValues'] },
85
+ { check: 'foreign function calls', line: 2262, book: 'r-code', rules: ['foreign-function-calls'], level: Static, note: 'routine registration needs the installed package', adds: 'resolves PACKAGE arguments through variables', options: ['foreign-function-calls.resolveValues'] },
86
+ { check: 'use of S3 registration', line: 4333, book: 'r-code', rules: ['s3-method-consistency'], level: Static, note: 'overwriting registered methods of standard packages is not checked', options: ['s3-method-consistency.checkUnregistered'] },
87
+ { check: 'whether startup messages can be suppressed', line: 4306, book: 'r-code', rules: ['package-hooks'], level: Static, note: 'output in package hooks not sent through packageStartupMessage', adds: 'follows the hooks into the package functions they call', options: ['package-hooks.startupMessageFunctions', 'package-hooks.allowedOutput', 'package-hooks.followCalls'] },
88
+ { check: 'whether the namespace can be unloaded cleanly', line: 4258, book: 'r-code', rules: ['package-hooks'], level: Static, note: 'only hook arguments and misplaced library.dynam.unload calls' },
89
89
  { check: 'package namespace information', line: 6863, book: 'namespace', rules: ['documentation-mismatch', 'non-ascii-code', 'package-hooks'], level: Partial }
90
90
  ]
91
91
  },
92
92
  {
93
93
  area: 'Documentation',
94
94
  entries: [
95
- { check: 'Rd files', line: 2514, book: 'documentation', rules: ['rd-files'], level: Full },
96
- { check: 'Rd metadata', line: 2570, book: 'documentation', rules: ['rd-files'], level: Full },
97
- { check: 'Rd cross-references', line: 2615, book: 'documentation', rules: ['rd-files'], level: Static, note: 'targets in other packages are asked of the signature database' },
98
- { check: 'for missing documentation entries', line: 2694, book: 'documentation', rules: ['documentation-mismatch', 'package-data'], level: Full },
99
- { check: 'for code/documentation mismatches', line: 2737, book: 'documentation', rules: ['documentation-mismatch'], level: Full },
100
- { check: 'Rd \\usage sections', line: 2788, book: 'documentation', rules: ['documentation-mismatch', 'rd-files'], level: Full },
101
- { check: 'Rd contents', line: 2849, book: 'documentation', rules: ['rd-files'], level: Full },
102
- { check: 'Rd line widths', line: 2594, book: 'documentation', rules: ['rd-files'], level: Full },
103
- { check: 'examples', line: 4656, book: 'documentation', rules: ['rd-files', 'dependency-declaration'], level: Static, note: 'parses the examples and checks what they call, without running them' },
95
+ { check: 'Rd files', line: 2514, book: 'documentation', rules: ['rd-files'], level: Full, note: '\\Sexpr macros are not evaluated', options: ['rd-files.parse', 'rd-files.minLevel', 'rd-files.extraMacros', 'rd-files.bibentries', 'rd-files.standardKeywords', 'rd-files.keywords'] },
96
+ { check: 'Rd metadata', line: 2570, book: 'documentation', rules: ['rd-files'], level: Full, adds: 'Rd names that differ only by case', options: ['rd-files.metadata'] },
97
+ { check: 'Rd cross-references', line: 2615, book: 'documentation', rules: ['rd-files'], level: Static, note: 'targets in other packages are asked of the signature database', options: ['rd-files.crossReferences', 'rd-files.uncertainLinks'] },
98
+ { check: 'for missing documentation entries', line: 2694, book: 'documentation', rules: ['documentation-mismatch', 'package-data'], level: Full, note: 'S4 classes and methods are not checked', options: ['documentation-mismatch.checkUndocumented', 'documentation-mismatch.requireDocumentation', 'package-data.checkUndocumented'] },
99
+ { check: 'for code/documentation mismatches', line: 2737, book: 'documentation', rules: ['documentation-mismatch'], level: Full, note: 'data sets and S4 classes are not compared', options: ['documentation-mismatch.checkCodoc', 'documentation-mismatch.checkDefaults'] },
100
+ { check: 'Rd \\usage sections', line: 2788, book: 'documentation', rules: ['documentation-mismatch', 'rd-files'], level: Full, options: ['documentation-mismatch.checkUsage', 'documentation-mismatch.checkInternalUsage', 'rd-files.docStyle'] },
101
+ { check: 'Rd contents', line: 2849, book: 'documentation', rules: ['rd-files'], level: Full, options: ['rd-files.contents', 'rd-files.requireValue'] },
102
+ { check: 'Rd line widths', line: 2594, book: 'documentation', rules: ['rd-files'], level: Full, options: ['rd-files.lineWidths', 'rd-files.usageWidth', 'rd-files.examplesWidth'] },
103
+ { check: 'examples', line: 4656, book: 'documentation', rules: ['rd-files', 'dependency-declaration'], level: Static, note: 'parses the examples and checks what they call, without running them', adds: 'T and F in the examples', options: ['rd-files.examples'] },
104
104
  { check: 'PDF version of manual', line: 5540, book: 'documentation', rules: ['rd-files'], level: Static, note: 'the Rd constructs that break the LaTeX rendering' },
105
- { check: 'PDF version of manual without index', line: 5579, book: 'documentation', rules: ['rd-files'], level: Static },
106
- { check: 'index information', line: 1752, book: 'documentation', rules: ['package-metafiles'], level: Full },
107
- { check: 'demos', line: 4793, book: 'demos', rules: ['package-metafiles', 'package-structure'], level: Static, note: 'the demo index and file names, the demos are not run' },
108
- { check: 'package subdirectories (CITATION)', line: 1796, book: 'documentation', rules: ['package-metafiles'], level: Full },
109
- { check: 'relative paths in package URLs', line: 4402, book: 'documentation', rules: ['package-metafiles'], level: Static }
105
+ { check: 'PDF version of manual without index', line: 5579, book: 'documentation', rules: ['rd-files'], level: Static, note: 'the Rd constructs that break the LaTeX rendering' },
106
+ { check: 'index information', line: 1752, book: 'documentation', rules: ['package-metafiles'], level: Full, note: 'the vignette index of inst/doc is not checked', options: ['package-metafiles.index'] },
107
+ { check: 'demos', line: 4793, book: 'demos', rules: ['package-metafiles', 'package-structure'], level: Static, note: 'the demo index and file names, the demos are not run', options: ['package-metafiles.index'] },
108
+ { check: 'package subdirectories (CITATION)', line: 1796, book: 'documentation', rules: ['package-metafiles'], level: Full, note: 'the CITATION file is parsed, not evaluated', adds: 'the superseded citEntry and personList', options: ['package-metafiles.citation', 'package-metafiles.superseded'] },
109
+ { check: 'relative paths in package URLs', line: 4402, book: 'documentation', rules: ['package-metafiles'], level: Static, note: 'relative URLs in Rd files are not checked', adds: 'links in README and NEWS', options: ['package-metafiles.relativeLinks'] }
110
110
  ]
111
111
  },
112
112
  {
113
113
  area: 'Data',
114
114
  entries: [
115
- { check: "contents of 'data' directory", line: 2891, book: 'data', rules: ['package-data'], level: Full },
116
- { check: 'data for ASCII and uncompressed saves', line: 3077, book: 'data', rules: ['package-data'], level: Full },
117
- { check: 'R/sysdata.rda', line: 3090, book: 'data', rules: ['package-data'], level: Full },
118
- { check: 'serialization versions', line: 988, book: 'data', rules: ['package-data'], level: Full },
115
+ { check: "contents of 'data' directory", line: 2891, book: 'data', rules: ['package-data'], level: Full, note: 'data sets are not loaded' },
116
+ { check: 'data for ASCII and uncompressed saves', line: 3077, book: 'data', rules: ['package-data'], level: Full, note: 'no recompression to estimate the savings', options: ['package-data.maxUncompressedSize', 'package-data.checkCompaction'] },
117
+ { check: 'R/sysdata.rda', line: 3090, book: 'data', rules: ['package-data'], level: Full, note: 'no recompression to estimate the savings', options: ['package-data.maxUncompressedSize', 'package-data.checkCompaction'] },
118
+ { check: 'serialization versions', line: 988, book: 'data', rules: ['package-data'], level: Full, note: '.rds files and xz compressed saves are not read' },
119
119
  { check: 'data for non-ASCII characters', line: 3002, book: 'data', rules: ['package-data'], level: Partial, note: 'the encodings of saved strings are not read' }
120
120
  ]
121
121
  },
122
122
  {
123
123
  area: 'Compiled code',
124
124
  entries: [
125
- { check: 'compilation flags in Makevars', line: 3501, book: 'compiled-code', rules: ['compiled-code'], level: Full },
125
+ { check: 'compilation flags in Makevars', line: 3501, book: 'compiled-code', rules: ['compiled-code'], level: Full, options: ['compiled-code.nonPortableFlags', 'compiled-code.allowedFlags'] },
126
126
  { check: 'use of PKG_*FLAGS in Makefiles', line: 3611, book: 'compiled-code', rules: ['compiled-code'], level: Full },
127
- { check: 'use of SHLIB_OPENMP_*FLAGS in Makefiles', line: 3643, book: 'compiled-code', rules: ['compiled-code'], level: Full },
127
+ { check: 'use of SHLIB_OPENMP_*FLAGS in Makefiles', line: 3643, book: 'compiled-code', rules: ['compiled-code'], level: Full, adds: 'runs without setting an environment variable' },
128
128
  { check: 'for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS)', line: 3559, book: 'compiled-code', rules: ['compiled-code'], level: Full },
129
129
  { check: 'for GNU extensions in Makefiles', line: 3514, book: 'compiled-code', rules: ['compiled-code'], level: Full },
130
130
  { check: 'include directives in Makefiles', line: 3848, book: 'compiled-code', rules: ['compiled-code'], level: Full },
131
131
  { check: 'line endings in Makefiles', line: 3479, book: 'compiled-code', rules: ['compiled-code'], level: Full },
132
132
  { check: 'line endings in C/C++/Fortran sources/headers', line: 3436, book: 'compiled-code', rules: ['compiled-code'], level: Full },
133
- { check: 'pragmas in C/C++ headers and code', line: 3882, book: 'compiled-code', rules: ['compiled-code'], level: Full },
134
- { check: 'usage of KIND in Fortran files', line: 656, book: 'compiled-code', rules: ['compiled-code'], level: Full },
135
- { check: 'C++ specification', line: 6642, book: 'compiled-code', rules: ['compiled-code'], level: Full },
136
- { check: 'compiled code', line: 4010, book: 'compiled-code', rules: ['compiled-code'], level: Static, note: 'the calls the shared object would import, read off the sources' },
137
- { check: 'whether package can be installed', line: 5961, book: 'r-code', rules: ['compiled-code', 'dependency-declaration', 'package-runtime'], level: Static, note: 'useDynLib and src/ in agreement, headers from LinkingTo, undefined exports' },
138
- { check: 'compilation flags used', line: 3934, book: 'compiled-code', rules: ['compiled-code'], level: Static, note: 'the flags the Makevars state, not the ones the toolchain was called with' },
133
+ { check: 'pragmas in C/C++ headers and code', line: 3882, book: 'compiled-code', rules: ['compiled-code'], level: Full, adds: 'runs without setting an environment variable' },
134
+ { check: 'usage of KIND in Fortran files', line: 656, book: 'compiled-code', rules: ['compiled-code'], level: Full, adds: 'byte count declarations like real*8', options: ['compiled-code.flagStarKinds'] },
135
+ { check: 'C++ specification', line: 6642, book: 'compiled-code', rules: ['compiled-code'], level: Full, options: ['compiled-code.knownCxxStandards', 'compiled-code.obsoleteCxxStandards'] },
136
+ { check: 'compiled code', line: 4010, book: 'compiled-code', rules: ['compiled-code'], level: Static, note: 'the calls the shared object would import, read off the sources', options: ['compiled-code.unportableCalls', 'compiled-code.unportableObjects', 'compiled-code.unportableFortran', 'compiled-code.checkNonApi', 'compiled-code.extraNonApiEntryPoints', 'compiled-code.checkRegistration'] },
137
+ { check: 'whether package can be installed', line: 5961, book: 'r-code', rules: ['compiled-code', 'dependency-declaration', 'package-runtime'], level: Static, note: 'useDynLib and src/ in agreement, headers from LinkingTo, undefined exports', adds: 'compiled code never loaded for lack of useDynLib', options: ['compiled-code.headerPackages'] },
138
+ { check: 'compilation flags used', line: 3934, book: 'compiled-code', rules: ['compiled-code'], level: Static, note: 'the flags the Makevars state, not the ones the toolchain was called with', options: ['compiled-code.nonPortableFlags', 'compiled-code.allowedFlags'] },
139
139
  { check: 'Rust compilation', line: 4120, book: 'compiled-code', rules: ['package-runtime'], level: Static, note: 'Rust sources need Cargo and rustc in SystemRequirements' }
140
140
  ]
141
141
  },
@@ -144,14 +144,14 @@ exports.CmdCheckConformance = [
144
144
  entries: [
145
145
  { check: 'whether the package can be loaded', line: 4144, book: 'r-code', rules: ['package-runtime'], level: Static, note: 'S3 methods registered without a function, imports of unexported names' },
146
146
  { check: 'loading without being on the library search path', line: 4282, book: 'r-code', rules: ['package-runtime'], level: Static, note: 'the package attaching itself' },
147
- { check: 'whether the package can be unloaded cleanly', line: 4189, book: 'r-code', rules: ['package-hooks'], level: Static },
148
- { check: 'tests', line: 4797, book: 'tests', rules: ['package-runtime', 'dependency-declaration'], level: Static, note: 'tests that never run, run another package, or do not parse' },
149
- { check: 'for differences from example reference output', line: 4639, book: 'tests', rules: ['package-runtime'], level: Static, note: 'reference output without its test' },
147
+ { check: 'whether the package can be unloaded cleanly', line: 4189, book: 'r-code', rules: ['package-hooks'], level: Static, note: 'only hook arguments and misplaced library.dynam.unload calls' },
148
+ { check: 'tests', line: 4797, book: 'tests', rules: ['package-runtime', 'dependency-declaration'], level: Static, note: 'tests are not run, only checked for runners and syntax', adds: 'testthat tests without a runner, runners testing another package' },
149
+ { check: 'for differences from example reference output', line: 4639, book: 'tests', rules: ['package-runtime'], level: Static, note: 'example output is not compared with its reference', adds: 'reference output without its test' },
150
150
  { check: 'running R code from vignettes', line: 5255, book: 'vignettes', rules: ['package-runtime', 'dependency-declaration'], level: Static, note: 'vignette code that does not parse' },
151
151
  { check: 're-building of vignette outputs', line: 5400, book: 'vignettes', rules: ['package-runtime'], level: Static, note: 'vignettes without index entry or engine' },
152
- { check: 'package vignettes', line: 4944, book: 'vignettes', rules: ['package-runtime', 'package-structure'], level: Static },
153
- { check: 'examples with --run-donttest', line: 4738, book: 'documentation', rules: ['rd-files', 'dependency-declaration'], level: Static, note: 'the \\donttest code is checked like all examples' },
154
- { check: 'for non-standard things in the check directory', line: 8110, book: 'package-structure', rules: ['package-runtime', 'rd-files'], level: Static, note: 'files tests, vignettes, and examples write into the working directory' },
152
+ { check: 'package vignettes', line: 4944, book: 'vignettes', rules: ['package-runtime', 'package-structure'], level: Static, note: 'non-ASCII vignettes without declared encoding are not reported' },
153
+ { check: 'examples with --run-donttest', line: 4738, book: 'documentation', rules: ['rd-files', 'dependency-declaration'], level: Static, note: 'the \\donttest code is checked like all examples', adds: 'T and F in the examples', options: ['rd-files.examples'] },
154
+ { check: 'for non-standard things in the check directory', line: 8110, book: 'package-structure', rules: ['package-runtime', 'rd-files'], level: Static, note: 'files tests, vignettes, and examples write into the working directory', options: ['package-runtime.checkWrites'] },
155
155
  { check: 'for detritus in the temp directory', line: 8151, book: 'package-structure', rules: ['package-runtime', 'rd-files'], level: Partial, note: 'only the files written by name' },
156
156
  { check: 'for new files in some other directories', line: 8173, book: 'package-structure', rules: ['package-runtime', 'rd-files'], level: Partial, note: 'only the files written by name' },
157
157
  { check: 'HTML version of manual', line: 5641, book: 'documentation', rules: ['rd-files'], level: Static, note: 'the Rd files that would not render' }
@@ -53,7 +53,7 @@ export declare const DESCRIPTION_METADATA: {
53
53
  readonly name: "Description Metadata";
54
54
  readonly tags: readonly [LintingRuleTag.CmdCheck];
55
55
  readonly certainty: LintingRuleCertainty.BestEffort;
56
- readonly description: "Checks the DESCRIPTION: required fields, package name, version, maintainer, dependency fields, license, Authors@R, encoding, and the Title and Description style CRAN asks for.";
56
+ readonly description: "Finds problems in the DESCRIPTION: required fields, package name, version, maintainer, dependency fields, license, Authors@R, encoding, and the Title and Description style CRAN asks for.";
57
57
  readonly defaultConfig: () => {
58
58
  cranIncoming: true;
59
59
  maxDepends: number;
@@ -382,7 +382,7 @@ exports.DESCRIPTION_METADATA = {
382
382
  name: 'Description Metadata',
383
383
  tags: [linter_tags_1.LintingRuleTag.CmdCheck],
384
384
  certainty: linter_format_1.LintingRuleCertainty.BestEffort,
385
- description: 'Checks the DESCRIPTION: required fields, package name, version, maintainer, dependency fields, license, Authors@R, encoding, and the Title and Description style CRAN asks for.',
385
+ description: 'Finds problems in the DESCRIPTION: required fields, package name, version, maintainer, dependency fields, license, Authors@R, encoding, and the Title and Description style CRAN asks for.',
386
386
  defaultConfig: () => ({
387
387
  cranIncoming: true,
388
388
  maxDepends: 5,
@@ -12,11 +12,17 @@ export interface DocumentationMismatchResult extends CmdCheckResult {
12
12
  readonly function?: string;
13
13
  }
14
14
  export interface DocumentationMismatchConfig extends MergeableRecord {
15
+ /** report exported objects no Rd page documents */
15
16
  readonly checkUndocumented: boolean;
17
+ /** report functions whose formals differ from their `\usage` */
16
18
  readonly checkCodoc: boolean;
19
+ /** also report default values that differ between the code and its `\usage` */
17
20
  readonly checkDefaults: boolean;
21
+ /** report arguments of a `\usage` that its `\arguments` do not document, and documented arguments no `\usage` has */
18
22
  readonly checkUsage: boolean;
23
+ /** also check the `\usage` of pages with the keyword `internal` */
19
24
  readonly checkInternalUsage: boolean;
25
+ /** report undocumented objects even when the package has no Rd pages at all */
20
26
  readonly requireDocumentation: boolean;
21
27
  }
22
28
  export interface DocumentationMismatchMetadata extends MergeableRecord {
@@ -46,7 +46,7 @@ export declare const FOREIGN_FUNCTION_CALLS: {
46
46
  readonly name: "Foreign Function Calls";
47
47
  readonly tags: readonly [LintingRuleTag.CmdCheck, LintingRuleTag.Bug, LintingRuleTag.Robustness];
48
48
  readonly certainty: LintingRuleCertainty.BestEffort;
49
- readonly description: "Checks `.Call`, `.C`, `.External`, and `.Fortran` calls: a missing or empty `PACKAGE`, calls into base or other packages, and undeclared packages. Routine and package names are resolved through variables.";
49
+ readonly description: "Finds problems in `.Call`, `.C`, `.External`, and `.Fortran` calls: a missing or empty `PACKAGE`, calls into base or other packages, and undeclared packages. Routine and package names are resolved through variables.";
50
50
  readonly defaultConfig: () => {
51
51
  resolveValues: true;
52
52
  };
@@ -106,7 +106,7 @@ exports.FOREIGN_FUNCTION_CALLS = {
106
106
  name: 'Foreign Function Calls',
107
107
  tags: [linter_tags_1.LintingRuleTag.CmdCheck, linter_tags_1.LintingRuleTag.Bug, linter_tags_1.LintingRuleTag.Robustness],
108
108
  certainty: linter_format_1.LintingRuleCertainty.BestEffort,
109
- description: 'Checks `.Call`, `.C`, `.External`, and `.Fortran` calls: a missing or empty `PACKAGE`, calls into base or other packages, and undeclared packages. Routine and package names are resolved through variables.',
109
+ description: 'Finds problems in `.Call`, `.C`, `.External`, and `.Fortran` calls: a missing or empty `PACKAGE`, calls into base or other packages, and undeclared packages. Routine and package names are resolved through variables.',
110
110
  defaultConfig: () => ({
111
111
  resolveValues: true
112
112
  })
@@ -42,7 +42,7 @@ export declare const NAMESPACE_TAMPERING: {
42
42
  };
43
43
  readonly info: {
44
44
  readonly name: "Namespace Tampering";
45
- readonly tags: readonly [LintingRuleTag.CmdCheck, LintingRuleTag.Robustness, LintingRuleTag.Security];
45
+ readonly tags: readonly [LintingRuleTag.Smell, LintingRuleTag.CmdCheck, LintingRuleTag.Robustness, LintingRuleTag.Security];
46
46
  readonly certainty: LintingRuleCertainty.BestEffort;
47
47
  readonly description: "Finds `unlockBinding()` and `assignInNamespace()` on other namespaces, `.Internal()` calls, and `library.dynam()` given a file extension.";
48
48
  readonly defaultConfig: () => {
@@ -151,7 +151,7 @@ exports.NAMESPACE_TAMPERING = {
151
151
  prettyPrint: (0, cmd_check_util_1.printer)(r => `${r.kind}${r.namespace ? ` of ${r.namespace}` : ''}`),
152
152
  info: {
153
153
  name: 'Namespace Tampering',
154
- tags: [linter_tags_1.LintingRuleTag.CmdCheck, linter_tags_1.LintingRuleTag.Robustness, linter_tags_1.LintingRuleTag.Security],
154
+ tags: [linter_tags_1.LintingRuleTag.Smell, linter_tags_1.LintingRuleTag.CmdCheck, linter_tags_1.LintingRuleTag.Robustness, linter_tags_1.LintingRuleTag.Security],
155
155
  certainty: linter_format_1.LintingRuleCertainty.BestEffort,
156
156
  description: 'Finds `unlockBinding()` and `assignInNamespace()` on other namespaces, `.Internal()` calls, and `library.dynam()` given a file extension.',
157
157
  defaultConfig: () => ({
@@ -40,7 +40,7 @@ export declare const NON_ASCII_CODE: {
40
40
  };
41
41
  readonly info: {
42
42
  readonly name: "Non-ASCII Code";
43
- readonly tags: readonly [LintingRuleTag.CmdCheck, LintingRuleTag.QuickFix];
43
+ readonly tags: readonly [LintingRuleTag.Smell, LintingRuleTag.CmdCheck, LintingRuleTag.QuickFix];
44
44
  readonly certainty: LintingRuleCertainty.BestEffort;
45
45
  readonly description: "Finds non-ASCII characters in R code and the NAMESPACE outside of comments. Offers `\\u` escapes for strings as a quick fix.";
46
46
  readonly defaultConfig: () => {
@@ -100,7 +100,7 @@ exports.NON_ASCII_CODE = {
100
100
  prettyPrint: (0, cmd_check_util_1.printer)(r => `non-ASCII ${r.kind} ${JSON.stringify(r.characters)}`),
101
101
  info: {
102
102
  name: 'Non-ASCII Code',
103
- tags: [linter_tags_1.LintingRuleTag.CmdCheck, linter_tags_1.LintingRuleTag.QuickFix],
103
+ tags: [linter_tags_1.LintingRuleTag.Smell, linter_tags_1.LintingRuleTag.CmdCheck, linter_tags_1.LintingRuleTag.QuickFix],
104
104
  certainty: linter_format_1.LintingRuleCertainty.BestEffort,
105
105
  description: 'Finds non-ASCII characters in R code and the NAMESPACE outside of comments. Offers `\\u` escapes for strings as a quick fix.',
106
106
  defaultConfig: () => ({
@@ -7,7 +7,9 @@ export type PackageDataResult = FileResult<PackageDataKind>;
7
7
  export interface PackageDataConfig extends MergeableRecord {
8
8
  /** an uncompressed or ASCII save above this many bytes is flagged */
9
9
  readonly maxUncompressedSize: number;
10
+ /** report saves that a stronger compression would make much smaller */
10
11
  readonly checkCompaction: boolean;
12
+ /** report data sets no Rd page documents */
11
13
  readonly checkUndocumented: boolean;
12
14
  }
13
15
  export interface PackageDataMetadata extends MergeableRecord {
@@ -39,7 +41,7 @@ export declare const PACKAGE_DATA: {
39
41
  readonly name: "Package Data";
40
42
  readonly tags: readonly [LintingRuleTag.CmdCheck];
41
43
  readonly certainty: LintingRuleCertainty.BestEffort;
42
- readonly description: "Checks `data/` and `R/sysdata.rda`: allowed file types, LazyData, compression, the serialization version R needs, and undocumented data sets.";
44
+ readonly description: "Finds problems in `data/` and `R/sysdata.rda`: allowed file types, LazyData, compression, the serialization version R needs, and undocumented data sets.";
43
45
  readonly defaultConfig: () => {
44
46
  maxUncompressedSize: number;
45
47
  checkCompaction: true;
@@ -174,7 +174,7 @@ exports.PACKAGE_DATA = {
174
174
  name: 'Package Data',
175
175
  tags: [linter_tags_1.LintingRuleTag.CmdCheck],
176
176
  certainty: linter_format_1.LintingRuleCertainty.BestEffort,
177
- description: 'Checks `data/` and `R/sysdata.rda`: allowed file types, LazyData, compression, the serialization version R needs, and undocumented data sets.',
177
+ description: 'Finds problems in `data/` and `R/sysdata.rda`: allowed file types, LazyData, compression, the serialization version R needs, and undocumented data sets.',
178
178
  defaultConfig: () => ({ maxUncompressedSize: 100_000, checkCompaction: true, checkUndocumented: true })
179
179
  }
180
180
  };
@@ -44,9 +44,9 @@ export declare const PACKAGE_HOOKS: {
44
44
  };
45
45
  readonly info: {
46
46
  readonly name: "Package Hooks";
47
- readonly tags: readonly [LintingRuleTag.CmdCheck, LintingRuleTag.Bug, LintingRuleTag.Usability];
47
+ readonly tags: readonly [LintingRuleTag.CmdCheck, LintingRuleTag.Bug, LintingRuleTag.Usability, LintingRuleTag.QuickFix];
48
48
  readonly certainty: LintingRuleCertainty.BestEffort;
49
- readonly description: "Checks `.onLoad`, `.onAttach`, `.onDetach`, and `.Last.lib`: argument lists, attaching packages, output other than `packageStartupMessage()`, `installed.packages()`, misplaced `library.dynam()` calls, and the obsolete `.First.lib`. Follows calls into the package's own functions.";
49
+ readonly description: "Finds problems in `.onLoad`, `.onAttach`, `.onDetach`, and `.Last.lib`: argument lists, attaching packages, output other than `packageStartupMessage()`, `installed.packages()`, misplaced `library.dynam()` calls, and the obsolete `.First.lib`. Follows calls into the package's own functions.";
50
50
  readonly defaultConfig: () => {
51
51
  startupMessageFunctions: string[];
52
52
  allowedOutput: string[];
@@ -83,6 +83,13 @@ function hasNamedArgument(id, df, name) {
83
83
  const vertex = df.graph.getVertex(id);
84
84
  return vertex_1.DfgVertex.isFunctionCall(vertex) && vertex.args.some(a => a !== r_function_call_1.EmptyArgument && a.name === name);
85
85
  }
86
+ /** `message()` called in a hook as the startup message function, which takes the same arguments */
87
+ function asStartupMessage(call, startup) {
88
+ const own = r_function_call_1.RFunctionCall.isNamed(call) ? range_1.SourceRange.ownFromNode(call.functionName) : undefined;
89
+ const loc = own === undefined ? undefined : range_1.SourceLocation.from(own, call?.info.file);
90
+ return startup === undefined || loc === undefined || !r_function_call_1.RFunctionCall.isNamed(call) || identifier_1.Identifier.getName(call.functionName.content) !== 'message'
91
+ ? undefined : [{ type: 'replace', loc, description: `Use \`${startup}\``, replacement: startup }];
92
+ }
86
93
  /**
87
94
  * Port of the `R CMD check` notes on package hooks (`checking R code for possible problems`, from
88
95
  * `tools:::.check_package_code_startup_functions` and `tools:::.check_package_code_unload_functions`).
@@ -101,12 +108,13 @@ exports.PACKAGE_HOOKS = {
101
108
  const allowedOutput = new Set(config.allowedOutput);
102
109
  const unsafe = new Set(config.unsafeCalls);
103
110
  for (const { name: hook, def } of hooks) {
104
- const report = (issue, message, id = def.info.id, call, certain = true) => results.push({
111
+ const report = (issue, message, id = def.info.id, call, certain = true, quickFix) => results.push({
105
112
  ...(0, cmd_check_util_1.at)(idMap.get(id) ?? def, certain),
106
113
  hook,
107
114
  issue,
108
115
  ...(call ? { call } : {}),
109
- message
116
+ message,
117
+ ...(quickFix ? { quickFix } : {})
110
118
  });
111
119
  if (hook === '.First.lib') {
112
120
  report('obsolete', '.First.lib is obsolete and will not be used in R >= 3.0.0, use .onLoad or .onAttach instead');
@@ -142,7 +150,7 @@ exports.PACKAGE_HOOKS = {
142
150
  else if (startupMessages.has(name) ? hook === '.onLoad' : built_in_props_1.CallProps.hasAny(props, built_in_props_1.SemanticCallTag.Prints) && !allowedOutput.has(name) && !writesToResource(id, df, props?.sig)) {
143
151
  report('output', hook === '.onLoad' && startupMessages.has(name)
144
152
  ? `.onLoad should not print startup messages with ${name}, use .onAttach instead${through}`
145
- : `Package startup functions should use ${config.startupMessageFunctions[0] ?? 'packageStartupMessage'} to generate messages, but ${hook} calls ${name}${through}`, at, name, via === undefined);
153
+ : `Package startup functions should use ${config.startupMessageFunctions[0] ?? 'packageStartupMessage'} to generate messages, but ${hook} calls ${name}${through}`, at, name, via === undefined, via === undefined && hook !== '.onLoad' ? asStartupMessage(idMap.get(id), config.startupMessageFunctions[0]) : undefined);
146
154
  }
147
155
  }
148
156
  }
@@ -151,9 +159,9 @@ exports.PACKAGE_HOOKS = {
151
159
  prettyPrint: (0, cmd_check_util_1.printer)(r => `${r.hook}: ${r.issue}${r.call ? ` (${r.call})` : ''}`),
152
160
  info: {
153
161
  name: 'Package Hooks',
154
- tags: [linter_tags_1.LintingRuleTag.CmdCheck, linter_tags_1.LintingRuleTag.Bug, linter_tags_1.LintingRuleTag.Usability],
162
+ tags: [linter_tags_1.LintingRuleTag.CmdCheck, linter_tags_1.LintingRuleTag.Bug, linter_tags_1.LintingRuleTag.Usability, linter_tags_1.LintingRuleTag.QuickFix],
155
163
  certainty: linter_format_1.LintingRuleCertainty.BestEffort,
156
- description: 'Checks `.onLoad`, `.onAttach`, `.onDetach`, and `.Last.lib`: argument lists, attaching packages, output other than `packageStartupMessage()`, `installed.packages()`, misplaced `library.dynam()` calls, and the obsolete `.First.lib`. Follows calls into the package\'s own functions.',
164
+ description: 'Finds problems in `.onLoad`, `.onAttach`, `.onDetach`, and `.Last.lib`: argument lists, attaching packages, output other than `packageStartupMessage()`, `installed.packages()`, misplaced `library.dynam()` calls, and the obsolete `.First.lib`. Follows calls into the package\'s own functions.',
157
165
  defaultConfig: () => ({
158
166
  startupMessageFunctions: ['packageStartupMessage'],
159
167
  allowedOutput: ['warning'],
@@ -38,7 +38,7 @@ export declare const PACKAGE_METAFILES: {
38
38
  readonly name: "Package Metafiles";
39
39
  readonly tags: readonly [LintingRuleTag.CmdCheck, LintingRuleTag.Robustness];
40
40
  readonly certainty: LintingRuleCertainty.BestEffort;
41
- readonly description: "Checks the demo index, `INDEX`, `inst/CITATION`, and relative links in README, NEWS, and vignettes.";
41
+ readonly description: "Finds problems in the demo index, `INDEX`, `inst/CITATION`, and relative links in README, NEWS, and vignettes.";
42
42
  readonly defaultConfig: () => {
43
43
  index: true;
44
44
  citation: true;
@@ -280,7 +280,7 @@ exports.PACKAGE_METAFILES = {
280
280
  name: 'Package Metafiles',
281
281
  tags: [linter_tags_1.LintingRuleTag.CmdCheck, linter_tags_1.LintingRuleTag.Robustness],
282
282
  certainty: linter_format_1.LintingRuleCertainty.BestEffort,
283
- description: 'Checks the demo index, `INDEX`, `inst/CITATION`, and relative links in README, NEWS, and vignettes.',
283
+ description: 'Finds problems in the demo index, `INDEX`, `inst/CITATION`, and relative links in README, NEWS, and vignettes.',
284
284
  defaultConfig: () => ({
285
285
  index: true,
286
286
  citation: true,
@@ -64,7 +64,7 @@ export declare const PACKAGE_STRUCTURE: {
64
64
  readonly name: "Package Structure";
65
65
  readonly tags: readonly [LintingRuleTag.CmdCheck];
66
66
  readonly certainty: LintingRuleCertainty.BestEffort;
67
- readonly description: "Checks the package files: portable names, hidden files, top-level files, subdirectories, permissions, executables, timestamps, sizes, line endings of scripts, and vignette leftovers.";
67
+ readonly description: "Finds problems in the package files: portable names, hidden files, top-level files, subdirectories, permissions, executables, timestamps, sizes, line endings of scripts, and vignette leftovers.";
68
68
  readonly defaultConfig: () => {
69
69
  maxPathLength: number;
70
70
  hiddenAllowed: string[];
@@ -298,7 +298,7 @@ exports.PACKAGE_STRUCTURE = {
298
298
  info: {
299
299
  name: 'Package Structure',
300
300
  tags: [linter_tags_1.LintingRuleTag.CmdCheck], certainty: linter_format_1.LintingRuleCertainty.BestEffort,
301
- description: 'Checks the package files: portable names, hidden files, top-level files, subdirectories, permissions, executables, timestamps, sizes, line endings of scripts, and vignette leftovers.',
301
+ description: 'Finds problems in the package files: portable names, hidden files, top-level files, subdirectories, permissions, executables, timestamps, sizes, line endings of scripts, and vignette leftovers.',
302
302
  defaultConfig: () => ({
303
303
  maxPathLength: 100,
304
304
  hiddenAllowed: ['.Rbuildignore', '.Rinstignore', 'vignettes/.install_extras', '.aspell'],
@@ -7,21 +7,37 @@ import { type FileResult } from './file-checks';
7
7
  export type RdFilesKind = 'rd-syntax' | 'rd-unknown-macro' | 'rd-structure' | 'rd-empty-section' | 'rd-encoding' | 'rd-markup' | 'rd-lost-braces' | 'rd-duplicate-name' | 'rd-duplicate-alias' | 'rd-missing-alias' | 'rd-package-alias' | 'rd-name-case' | 'rd-missing-link' | 'rd-undeclared-package' | 'rd-line-width' | 'rd-missing-description' | 'rd-undocumented-argument' | 'rd-boilerplate' | 'rd-missing-value' | 'rd-keyword' | 'rd-s3-method-name' | 'rd-bibentry' | 'rd-example-syntax' | 'rd-example-abbreviation' | 'rd-example-quit' | 'rd-example-setwd' | 'rd-example-file';
8
8
  export type RdFilesResult = FileResult<RdFilesKind>;
9
9
  export interface RdFilesConfig extends MergeableRecord {
10
+ /** report what the Rd parser of R reports: syntax errors, unknown macros, and unexpected sections */
10
11
  readonly parse: boolean;
12
+ /** drop parser diagnostics below this `checkRd` level, the messages of `prepare_Rd` are always kept */
11
13
  readonly minLevel: number;
14
+ /** report duplicate names and aliases, names that differ only by case, and pages without any alias */
12
15
  readonly metadata: boolean;
16
+ /** report links to topics no page or package provides */
13
17
  readonly crossReferences: boolean;
18
+ /** also report links whose target flowR cannot decide */
14
19
  readonly uncertainLinks: boolean;
20
+ /** report lines in `\usage` and `\examples` wider than {@link RdFilesConfig#usageWidth} and {@link RdFilesConfig#examplesWidth} */
15
21
  readonly lineWidths: boolean;
22
+ /** the widest line a `\usage` section may have */
16
23
  readonly usageWidth: number;
24
+ /** the widest line an `\examples` section may have */
17
25
  readonly examplesWidth: number;
26
+ /** report missing descriptions and values, argument items without text, and generated boilerplate */
18
27
  readonly contents: boolean;
28
+ /** report functions documented without a `\value` section */
19
29
  readonly requireValue: boolean;
30
+ /** report keywords that are neither standard nor in {@link RdFilesConfig#keywords} */
20
31
  readonly standardKeywords: boolean;
32
+ /** the keywords besides the standard ones a page may use */
21
33
  readonly keywords: readonly string[];
34
+ /** report S3 methods a `\usage` calls by their full name instead of with `\method` */
22
35
  readonly docStyle: boolean;
36
+ /** report bibentries a page cites but does not show */
23
37
  readonly bibentries: boolean;
38
+ /** parse the examples and report their syntax errors, undefined calls, `T` and `F`, `q()`, and the files they write */
24
39
  readonly examples: boolean;
40
+ /** Rd macro files to load besides those of the package */
25
41
  readonly extraMacros: readonly string[];
26
42
  }
27
43
  export interface RdFilesMetadata extends MergeableRecord {
@@ -44,7 +60,7 @@ export declare const RD_FILES: {
44
60
  readonly name: "Rd Files";
45
61
  readonly tags: readonly [LintingRuleTag.CmdCheck, LintingRuleTag.Robustness];
46
62
  readonly certainty: LintingRuleCertainty.BestEffort;
47
- readonly description: "Checks the Rd files: syntax, unknown macros, required and duplicated sections, metadata, cross-references, line widths, contents, and the example code.";
63
+ readonly description: "Finds problems in the Rd files: syntax, unknown macros, required and duplicated sections, metadata, cross-references, line widths, contents, and the example code.";
48
64
  readonly defaultConfig: () => {
49
65
  parse: true;
50
66
  minLevel: number;
@@ -614,7 +614,7 @@ exports.RD_FILES = {
614
614
  name: 'Rd Files',
615
615
  tags: [linter_tags_1.LintingRuleTag.CmdCheck, linter_tags_1.LintingRuleTag.Robustness],
616
616
  certainty: linter_format_1.LintingRuleCertainty.BestEffort,
617
- description: 'Checks the Rd files: syntax, unknown macros, required and duplicated sections, metadata, cross-references, line widths, contents, and the example code.',
617
+ description: 'Finds problems in the Rd files: syntax, unknown macros, required and duplicated sections, metadata, cross-references, line widths, contents, and the example code.',
618
618
  defaultConfig: () => ({ parse: true, minLevel: -1, metadata: true, crossReferences: true, uncertainLinks: true, lineWidths: true, usageWidth: 90, examplesWidth: 100, contents: true, requireValue: false, standardKeywords: false, keywords: StandardKeywords, docStyle: true, bibentries: true, examples: true, extraMacros: [] })
619
619
  }
620
620
  };
@@ -34,7 +34,7 @@ export declare const TRUE_FALSE_ABBREVIATION: {
34
34
  };
35
35
  readonly info: {
36
36
  readonly name: "TRUE/FALSE Abbreviation";
37
- readonly tags: readonly [LintingRuleTag.CmdCheck, LintingRuleTag.Robustness, LintingRuleTag.Readability, LintingRuleTag.QuickFix];
37
+ readonly tags: readonly [LintingRuleTag.Smell, LintingRuleTag.CmdCheck, LintingRuleTag.Robustness, LintingRuleTag.Readability, LintingRuleTag.QuickFix];
38
38
  readonly certainty: LintingRuleCertainty.Exact;
39
39
  readonly activeByDefault: false;
40
40
  readonly description: "Finds `T` and `F` used for `TRUE` and `FALSE`, and top-level definitions of `T` or `F`. Off by default, as R only checks this for packages without a NAMESPACE.";
@@ -108,7 +108,7 @@ exports.TRUE_FALSE_ABBREVIATION = {
108
108
  prettyPrint: (0, cmd_check_util_1.printer)(r => `${r.kind === 'use' ? 'Use' : 'Redefinition'} of \`${r.name}\``),
109
109
  info: {
110
110
  name: 'TRUE/FALSE Abbreviation',
111
- tags: [linter_tags_1.LintingRuleTag.CmdCheck, linter_tags_1.LintingRuleTag.Robustness, linter_tags_1.LintingRuleTag.Readability, linter_tags_1.LintingRuleTag.QuickFix],
111
+ tags: [linter_tags_1.LintingRuleTag.Smell, linter_tags_1.LintingRuleTag.CmdCheck, linter_tags_1.LintingRuleTag.Robustness, linter_tags_1.LintingRuleTag.Readability, linter_tags_1.LintingRuleTag.QuickFix],
112
112
  certainty: linter_format_1.LintingRuleCertainty.Exact,
113
113
  /* R CMD check only runs `checkTnF` for a package without a NAMESPACE, which no current package is */
114
114
  activeByDefault: false,
@@ -39,7 +39,7 @@ export declare const DATA_FRAME_ACCESS_VALIDATION: {
39
39
  readonly name: "Dataframe Access Validation";
40
40
  readonly tags: readonly [LintingRuleTag.Bug, LintingRuleTag.Usability, LintingRuleTag.Reproducibility];
41
41
  readonly certainty: LintingRuleCertainty.BestEffort;
42
- readonly description: "Validates the existence of accessed columns and rows of dataframes.";
42
+ readonly description: "Finds accesses to columns and rows a data frame does not have.";
43
43
  readonly defaultConfig: () => {
44
44
  readLoadedData: false;
45
45
  };
@@ -91,7 +91,7 @@ exports.DATA_FRAME_ACCESS_VALIDATION = {
91
91
  tags: [linter_tags_1.LintingRuleTag.Bug, linter_tags_1.LintingRuleTag.Usability, linter_tags_1.LintingRuleTag.Reproducibility],
92
92
  // this rule is unable to detect all cases of dataframe access, but sufficiently ensures returned results are valid
93
93
  certainty: linter_format_1.LintingRuleCertainty.BestEffort,
94
- description: 'Validates the existence of accessed columns and rows of dataframes.',
94
+ description: 'Finds accesses to columns and rows a data frame does not have.',
95
95
  defaultConfig: () => ({ readLoadedData: false })
96
96
  }
97
97
  };