41 Commits

Author SHA1 Message Date
Marco Borgeaud
b16a5e7ee9
Add minimal config for Codespaces (#4406)
Make it easier to use Codespace to develop rspec-tools by reusing the Dockerfile for the CI.
2024-10-11 09:22:09 +02:00
Fred Tingaud
3e3f54d821
Merge all rule validation scripts under a single task (#4255)
We shouldn't clone the whole repository three times to run three scripts that each take a few seconds.
2024-09-10 11:15:30 +02:00
Marco Borgeaud
e035587614 Improve validate_metadata.sh
Address shellcheck issues and visually separate outputs
2024-08-22 09:59:26 +02:00
Marco Borgeaud
997bd49f75 Improve cirrus-cache.sh
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.
2024-08-22 09:59:26 +02:00
Marcin Stachniuk
cf24e2eb6d
Fix builds of frontend_tests & tooling_tests (#3803) 2024-03-22 09:36:54 +01:00
Arseniy Zaostrovnykh
3535e4a89f
Use NodeJS 16 to run Sonar analysis 2023-12-07 16:14:58 +01:00
Fred Tingaud
d3cfe19d7e
Fix broken or dangerous backquotes
Co-authored-by: Marco Borgeaud <89914223+marco-antognini-sonarsource@users.noreply.github.com>
2023-10-30 10:33:56 +01:00
Marco Borgeaud
cd424756a0
Validate asciidoc ifdef/endif (#3311)
Fix kotlin:S6511
2023-10-18 09:43:40 +00:00
Cristian Ambrosini
ea83931eb0
Add CI task to validate file extension (#3196)
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).
2023-10-09 10:37:38 +02:00
Marco Borgeaud
915ef808a2
RULEAPI-788 Turn diff-view validation on (#2883) 2023-09-14 12:03:01 +02:00
Marco Borgeaud
7f98f4246c
RULEAPI-788 Allow multiple compliant solutions (#3034)
See https://discuss.sonarsource.com/t/layc-diff-view-validation/15392/7
2023-09-12 13:16:52 +02:00
Marco Borgeaud
f57a9805b5
RULEAPI-788 Validate use of diff-id and diff-type (#2790)
The validation is not yet enabled on CI checks because there exist too many errors in existing rule descriptions at the moment.
2023-08-10 09:59:44 +02:00
Marco Borgeaud
6398acacd9
Add CI task to test CI tests (#2768)
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.
2023-08-03 17:21:40 +02:00
Marco Borgeaud
8c7e94cd08
Run include and cross-references validation on all files (#2685)
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/
2023-08-02 09:21:56 +02:00
Marco Borgeaud
02dae8e652
Clean ci/validate_asciidoc.sh
* 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.
2023-07-31 15:37:06 +02:00
Marco Borgeaud
f6a887100c
Revert "Clean ci/validate_asciidoc.sh (09a2902fe3b86)"
This reverts commit 09a2902fe3b8688ca6bc818c7c6055e2307e6235. It
introduced some regressions.
2023-07-31 13:11:14 +00:00
Marco Borgeaud
09a2902fe3
Clean ci/validate_asciidoc.sh (#2684)
* 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.
2023-07-31 14:41:51 +02:00
Fred Tingaud
dc89dd499c
Create a shared_content folder at root 2023-07-20 12:17:32 +02:00
Fred Tingaud
83c54f9795
Handle variables *inside* an include
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[]
```
2023-06-22 11:45:41 +02:00
Fred Tingaud
51369b610e
Make sure that includes are always surrounded by empty lines (#2270)
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.
2023-06-22 10:38:01 +02:00
Fred Tingaud
3c08bcb34b
Support inclusions through variables 2023-06-02 17:10:20 +00:00
Ilia Kebets
c80d7f3b4c
Add checks for education format (#1607) 2023-03-07 17:16:47 +01:00
Roberto Orlandi
dc83422098 SONARSEC-3040 Update checks and documentation to fit new rule format (#1004) 2023-03-02 18:07:54 +01:00
vlad-sonar
b57099ebe9 Update ci/frontend-tests-dockerfile
Co-authored-by: David Rautureau <david.rautureau@sonarsource.com>
2022-12-14 15:50:56 +01:00
Vladimír Kopčil
e6ca2653ca BUILD-2318: Migrate to CirrusCI on AWS 2022-12-14 15:50:56 +01:00
Arseniy Zaostrovnykh
6800da7e05
RULEAPI-762: Fix link-probing cache: cache on failure and success 2022-06-08 13:52:21 +02:00
Arseniy Zaostrovnykh
f7353489fc
Enable rules removal: do not validate deleted rules 2022-03-08 12:26:53 +00:00
Marco Antognini
02cae0ceb0
Fix SonarQube warning about missing reference for analysis (#796) 2022-03-08 10:31:27 +00:00
Fred Tingaud
fc959bf040
Fix CI failure when no rule was changed (#791) 2022-02-08 11:00:03 +01:00
Fred Tingaud
f21f23b986
Treat all asciidoc at once to accelerate their validation 2022-02-07 18:22:30 +01:00
Fred Tingaud
b4161466e6
RULEAPI-661: Add syntax coloring 2022-02-04 16:28:24 +00:00
Marco Antognini
0dc00de844
Reduce amount of debug output in validate_asciidoc.sh 2022-02-03 12:21:42 +00:00
Fred Tingaud
7d868d3f35
Use a more readable form to display parameters 2022-02-01 12:25:23 +00:00
Marco Antognini
65e429879f
Fix CI failure when no rules have changed
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
2022-01-28 13:37:57 +00:00
Marco Antognini
b2b116a8e2
RULEAPI-682: Index multiple types and rules with no languages
* 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.
2022-01-28 09:51:13 +01:00
Pierre-Loup
56832b65c6
Fix "pipenv install" invocation to avoid update of Pipfile.lock (#561) 2021-11-01 14:43:11 +01:00
Čaba Šagi
6d8404981c
RULEAPI-642: Validate the level of section headers in asciidoc: make sure there are no level-0 2021-09-30 11:52:56 +02:00
Arseniy Zaostrovnykh
1128d6bf84
Fix the asciidoc validation CI check (#377) 2021-09-21 11:30:38 +02:00
Arseniy Zaostrovnykh
2784140e8b
RULEAPI-646: Speed up the "validate_asciidoc" check by validating only the changed rules 2021-06-09 11:15:47 +02:00
Arseniy Zaostrovnykh
16ca5fafaf
RULEAPI-649: Add frontend tests to CI 2021-06-08 15:21:29 +02:00
Arseniy Zaostrovnykh
4ad44aee5b
RULEAPI-616: Stabilize the link validation CI check by preserving the probing results between runs 2021-06-03 16:04:36 +02:00