-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
linter.deprecated
option to silence deprecation warnings
- Loading branch information
Showing
13 changed files
with
57 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,3 @@ import Lean.Widget | |
import Lean.Log | ||
import Lean.Linter | ||
import Lean.SubExpr | ||
import Lean.Deprecated |
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,4 +1,5 @@ | ||
import Lean.Linter.Util | ||
import Lean.Linter.Builtin | ||
import Lean.Linter.Deprecated | ||
import Lean.Linter.UnusedVariables | ||
import Lean.Linter.MissingDocs |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Lean.Data.Options | ||
|
||
namespace Lean.Linter | ||
|
||
register_builtin_option linter.all : Bool := { | ||
defValue := false | ||
descr := "enable all linters" | ||
} | ||
|
||
def getLinterAll (o : Options) (defValue := linter.all.defValue) : Bool := o.get linter.all.name defValue | ||
|
||
def getLinterValue (opt : Lean.Option Bool) (o : Options) : Bool := o.get opt.name (getLinterAll o opt.defValue) |
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,4 +1,5 @@ | ||
import Lean.Linter.Util | ||
import Lean.Elab.Command | ||
|
||
namespace Lean.Linter | ||
|
||
|
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
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,10 +1,11 @@ | ||
deprecated.lean:9:6-9:7: warning: `f` has been deprecated, use `g` instead | ||
deprecated.lean:11:6-11:7: warning: `f` has been deprecated, use `g` instead | ||
2 | ||
deprecated.lean:11:6-11:7: warning: `h` has been deprecated | ||
deprecated.lean:13:6-13:7: warning: `h` has been deprecated | ||
1 | ||
deprecated.lean:13:13-13:15: error: unknown constant 'g1' | ||
deprecated.lean:21:13-21:15: error: unknown constant 'g1' | ||
deprecated.lean:28:6-28:8: warning: `f2` has been deprecated, use `Foo.g1` instead | ||
deprecated.lean:15:13-15:15: error: unknown constant 'g1' | ||
deprecated.lean:23:13-23:15: error: unknown constant 'g1' | ||
deprecated.lean:30:6-30:8: warning: `f2` has been deprecated, use `Foo.g1` instead | ||
2 | ||
deprecated.lean:29:6-29:8: warning: `f4` has been deprecated, use `Foo.g1` instead | ||
2 | ||
deprecated.lean:33:6-33:8: warning: `f4` has been deprecated, use `Foo.g1` instead | ||
2 |
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,3 +1,5 @@ | ||
set_option linter.deprecated true | ||
|
||
def f (x : Nat) := x + 1 | ||
|
||
@[deprecated f] | ||
|
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,5 +1,5 @@ | ||
warningAsError.lean:6:6-6:7: warning: `g` has been deprecated, use `f` instead | ||
warningAsError.lean:8:6-8:7: warning: `g` has been deprecated, use `f` instead | ||
1 | ||
warningAsError.lean:10:6-10:7: error: `g` has been deprecated, use `f` instead | ||
warningAsError.lean:12:6-12:7: error: `g` has been deprecated, use `f` instead | ||
1 | ||
warningAsError.lean:13:7-13:13: error: unused variable `unused` [linter.unusedVariables] | ||
warningAsError.lean:15:7-15:13: error: unused variable `unused` [linter.unusedVariables] |