Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use an linter for CMake code in TriBITS? #536

Open
bartlettroscoe opened this issue Oct 28, 2022 · 4 comments
Open

Use an linter for CMake code in TriBITS? #536

bartlettroscoe opened this issue Oct 28, 2022 · 4 comments
Labels
component: testing Dealing with automated testing not specific to any other component type: enhancement

Comments

@bartlettroscoe
Copy link
Member

CC: @KyleFromKitware

Description

A good fraction of the comments in recent TriBITS PRs relate to basic CMake language issues. These types of issues can be detected using a static analysis tool (aka, a linter). It is generally agreed that it is better to catch these types of issues using an automated tool an focus human effort of a review on issues automated tools can't easily catch (see 5. Always run automated code checkers).

It looks like there exists such a tool for CMake:

@bartlettroscoe bartlettroscoe added the component: testing Dealing with automated testing not specific to any other component label Oct 28, 2022
@bartlettroscoe
Copy link
Member Author

Hello @KyleFromKitware, would you consider evaluating the tool:

and try running it one some CMake projects, including TriBITS and see how it works?

Or, is there some other CMake linter you know about that we could try?

@bartlettroscoe
Copy link
Member Author

And we might look into a broader set of tools for CMake:

@KyleFromKitware
Copy link
Collaborator

https://github.com/cmake-lint/cmake-lint looks like it only catches the most basic of issues (extra spaces, etc.) It doesn't look like it checks quoting and such.

You're not the first customer to express interest in a linter. Perhaps we could either expand cmake-lint or write our own?

@bartlettroscoe
Copy link
Member Author

bartlettroscoe commented Oct 29, 2022

You're not the first customer to express interest in a linter. Perhaps we could either expand cmake-lint or write our own?

@KyleFromKitware, it seems like the CMake user community should fund an effort to use the CMake parser code that is already in CMake to create a linter. Could we extend cmake-lint to add these checks? That might be easier than starting from scratch.

But given that the current CMake language has such serious fundamental problems and there is a glaring need for a new CMake language (see here), I don't know that we could get a linter for the current CMake language funded. Do we keep investing in the existing CMake language or do we bit the bullet and create a new language?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: testing Dealing with automated testing not specific to any other component type: enhancement
Projects
Status: ToDo
Development

No branches or pull requests

2 participants