diff --git a/Makefile b/Makefile index 6bb7432d5118..8efa1fafce9e 100644 --- a/Makefile +++ b/Makefile @@ -208,6 +208,7 @@ lint-standard-modules: chplcheck FORCE --internal-prefix "_" \ --internal-prefix "chpl_" \ --disable-rule "ControlFlowParentheses" \ + --disable-rule "UnusedFormal" \ $(MODULES_TO_LINT) compile-util-python: FORCE diff --git a/doc/rst/tools/chplcheck/chplcheck.rst b/doc/rst/tools/chplcheck/chplcheck.rst index 1790c4c03f5d..9dcc80f38566 100644 --- a/doc/rst/tools/chplcheck/chplcheck.rst +++ b/doc/rst/tools/chplcheck/chplcheck.rst @@ -202,7 +202,7 @@ checking for unused formals. .. code-block:: python - @driver.advanced_rule(default=False) + @driver.advanced_rule def UnusedFormal(context, root): formals = dict() uses = set() diff --git a/test/chplcheck/PREDIFF b/test/chplcheck/PREDIFF index 840c87cb4996..9c56b6a32419 100755 --- a/test/chplcheck/PREDIFF +++ b/test/chplcheck/PREDIFF @@ -3,7 +3,6 @@ FLAGS="--enable-rule ConsecutiveDecls"\ " --enable-rule BoolLitInCondStatement"\ " --enable-rule UseExplicitModules"\ -" --enable-rule UnusedFormal"\ " --enable-rule CamelOrPascalCaseVariables"\ " --enable-rule NestedCoforalls"\ " --internal-prefix myprefix_ --internal-prefix _"\ diff --git a/test/chplcheck/Unused.chpl b/test/chplcheck/Unused.chpl index 0d05d78c2237..c399432cfa29 100644 --- a/test/chplcheck/Unused.chpl +++ b/test/chplcheck/Unused.chpl @@ -33,4 +33,9 @@ module Unused { myProc(1,2); myProcIgnored(1,2); + + var Outer: [1..10] int; + proc foo(Outer) { + Outer[1] = 2; + } } diff --git a/test/chplcheck/allrules.good b/test/chplcheck/allrules.good index 4f8de174077a..c51c4923bae6 100644 --- a/test/chplcheck/allrules.good +++ b/test/chplcheck/allrules.good @@ -17,7 +17,7 @@ Available rules (default rules marked with *): * PascalCaseClasses Warn for classes that are not 'PascalCase'. * PascalCaseModules Warn for modules that are not 'PascalCase'. * SimpleDomainAsRange Warn for simple domains in loops that can be ranges. - UnusedFormal Warn for unused formals in functions. + * UnusedFormal Warn for unused formals in functions. * UnusedLoopIndex Warn for unused index variables in loops. * UnusedTupleUnpack Warn for unused tuple unpacking, such as '(_, _)'. UseExplicitModules Warn for code that relies on auto-inserted implicit modules. diff --git a/test/chplcheck/fixit-interactive/PREDIFF b/test/chplcheck/fixit-interactive/PREDIFF index 1bf12649cb98..dfaa0d86065d 100755 --- a/test/chplcheck/fixit-interactive/PREDIFF +++ b/test/chplcheck/fixit-interactive/PREDIFF @@ -3,7 +3,6 @@ $CHPL_HOME/tools/chplcheck/chplcheck --enable-rule ConsecutiveDecls \ --enable-rule BoolLitInCondStatement \ --enable-rule UseExplicitModules \ - --enable-rule UnusedFormal \ --enable-rule CamelOrPascalCaseVariables \ --enable-rule NestedCoforalls \ --internal-prefix "myprefix_" --internal-prefix "_" \ diff --git a/tools/chplcheck/src/rules.py b/tools/chplcheck/src/rules.py index 7ff472f6e080..9f585aeb5406 100644 --- a/tools/chplcheck/src/rules.py +++ b/tools/chplcheck/src/rules.py @@ -586,7 +586,7 @@ def FixMisleadingIndentation(context: Context, result: AdvancedRuleResult): fixit = Fixit.build(Edit(loc.path(), line_start, loc.end(), text)) return [fixit] if fixit else [] - @driver.advanced_rule(default=False) + @driver.advanced_rule def UnusedFormal(context: Context, root: AstNode): """ Warn for unused formals in functions.