-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chplcheck: allow ignoring parent/child incorrect indentation using `@…
…chplcheck.ignore` (#25800) This RP allows for disabling the `IncorrectIndentation` warning for statements that are incorrectly indented relatively to their parent: ```Chapel @chplcheck.ignore("IncorrectIndentation") module M { proc foo() { // would warn; silenced by attribute writeln("Hi"); writeln("There"); // still warns; attribute doesn't globally disable warnings } } ``` This helps the case in which a previously-implicit module is converted into an explicit module. This code: ```Chapel proc foo() { writeln("Hi"); writeln("There"); } ``` Becomes: ```Chapel module NewMod { proc foo() { // would warn; silenced by attribute writeln("Hi"); writeln("There"); // still warns; attribute doesn't globally disable warnings } } ``` Now, `foo` is incorrectly indented. To fix this, the entire file would need to be indented by two spaces, which creates a big diff and may be undesirable. By adding the ability to ignore an individual parent/child indentation violation using `@chplcheck.ignore`, this PR makes it possible to silence the warnings from explicitly defining `NewMod`, while preserving all other indentation warnings that had existed in the code previously (or would appear in the code in the future). This PR also adds the `chplcheck` attribute to a list of well-known tools by the compiler, in preparation of using this attribute with the standard library. Reviewed by @jabraham17 -- thanks! ## Testing - [x] `test/chplcheck`
- Loading branch information
Showing
8 changed files
with
432 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
--using-attribute-toolname chplcheck --stop-after-pass=parseAndConvertUast | ||
--stop-after-pass=parseAndConvertUast |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.