Print md5 as part of cache scripts.
Address spellcheck issues (quote variables).
Remove dead variables.
Improve output in general and pipe errors to stderr.
Fully spell out curl options for better readability.
Always show error with curl.
The dotnet squad would like to improve the rule specification sprint
process requiring some UTs to be temporarily added under the rule folder
on RSPEC repository. These test case files (`.cs` and `.vb`) will be
copied to the sonar-dotnet repository during the initial phases of
implementation and will serve as an initial test bed.
However, before merging the PR on the RSPEC side we need to make sure
that these test case files are deleted and they don't end up on master.
The goal of this PR would be to add a check on the pipeline that will
fail if `.cs` or `.vb` files are detected (it's acceptable if it's red
until the implementation is done).
Extract the bits using the custom asciidoctor to a dedicated file.
This new script uses `set -e` to catch unexpected errors.
It is also covered with integration tests that get executed on the CI.
This serves as the groundwork to integrate more advanced validation
tests.
The previous validation code was taking about 3 minutes when running on
all rules, which is the case when modifying anything outside rules/,
including shared_content/.
The runtime was marginal when only the content specific to one rule was
modified, e.g. only rules/S100/cfamily/rule.adoc is modified.
The new validation code always takes about 30 seconds on the CI. This is
a slight increase for small PR but a large reduction for PR affecting
the whole system.
Furthermore, the new approach validates includes and cross-references
properly. An issue is now raised when:
* The last include to shared_content/lang/foo.adoc is removed.
* A shared_content doc includes a file from another rule, e.g.
rules/S100/lang/rule.adoc includes shared_content/lang/foo.adoc,
which includes rules/S200/bar.adoc.
This is achieved with proper Asciidoc extensions written in Ruby.
See https://docs.asciidoctor.org/asciidoctor/latest/extensions/
* Regroup read-only variable declaration. `declare -xr` is used for
an exported read-only variable.
* Use more accurate log messages.
* Use consistent indentation of 2 spaces.
* Fail fast if dependencies cannot be installed.
* Regroup HTML generation & its validation.
* Document the main validation points.
* Simplify some commands and address some ShellCheck warnings.
* Regroup readonly variable declaration. `declare -xr` is used for exported readonly variable.
* Use more accurate log messages.
* Use consistent indentation of 2 spaces.
* Fail fast if dependencies cannot be installed.
* Regroup HTML generation & its validation.
* Document the main validation points.
* Simplify some commands and address some ShellCheck warnings.
The point of this branch is the second commit that changes
validate_asciidoc.sh. The first one is taken from another PR and should
not be reviewed.
The previous version of the validation could handle the following case:
```asciidoc
:path: path/to/file.adoc
include::{path}[]
```
This new validation also adds support for the case of a variable inside
a path:
```asciidoc
:language: csharp
include::rules/S1000/{language}/file.adoc[]
```
When an include is not surrounded by empty lines, its content is inlined
on the same line as the adjacent content. That can lead to broken tags
and other display issues.
This PR fixes all such includes and introduces a validation step that
forbids introducing the same problem again.
Ensure array is correctly read.
Ensure errors in subprocesses are detected and abort the script.
`shopt -s lastpipe` is used to avoid the following complex pattern:
mapfile -t array < <(command-that-may-fail)
pid=$!
wait $pid || exit 1
* Generate description and metadata for rules with no language, so that they get indexed.
* Index rules with different types in language specializations.
* Improve validation to reject new rules with no language specialization (i.e. only a predefined set of such rules is allowed because they were imported from Jira and kept for historical purposes).
* Write smaller JSON files, reduce their size by 30%.
* Improve test coverage of CLI application.