lean4 icon indicating copy to clipboard operation
lean4 copied to clipboard

Linters

Open leodemoura opened this issue 3 years ago • 2 comments

We need many different linters.

  • Style violations.
  • Common mistakes.
  • Bad idioms.
  • Potential performance problems.

The different linters can be developed independently of each other, and they are self-contained projects. Core developers will help with the API and integration.

leodemoura avatar Apr 14 '21 02:04 leodemoura

Do you want linters for the Lean or C++ code (or both)?

For the C++ code, it wouldn't be very difficult for me to add tools like clang-tidy and cppcheck to the build. They could be triggered to only run when CMAKE_BUILD_TYPE=DEBUG, for example.

It has been a while since this issue was posted. If you're aware of any Lean targeted linters, I'd like to take a look.

jack-ullery avatar Feb 22 '22 02:02 jack-ullery

Mathlib has a linter framework: https://leanprover-community.github.io/mathlib_docs/commands.html#linting%20commands . Some of this should probably be incorporated into the core lean 4 distribution, but the details have not been worked out. (My impression is that the issue is primarily about Lean linters, as the C++ code is foundational and both user code and the elaborator itself are mostly written in lean.)

digama0 avatar Feb 22 '22 09:02 digama0

Let's close this issue now that the linter framework has been implemented, and reopen issues for specific linters.

digama0 avatar Oct 07 '22 22:10 digama0