Skip to content

CMake linting#47043

Merged
ZhilkinSerg merged 3 commits intoCleverRaven:masterfrom
lopho:cmake_format
Jan 26, 2021
Merged

CMake linting#47043
ZhilkinSerg merged 3 commits intoCleverRaven:masterfrom
lopho:cmake_format

Conversation

@lopho
Copy link
Copy Markdown
Contributor

@lopho lopho commented Jan 26, 2021

Summary

SUMMARY: Build "Add CMake linting"

Purpose of change

As mentioned in #46818 this pull adds linting rules for CMake and the appropriate github action to run on changes to CMakeLists.txt files.

Describe the solution

Using this tool: https://github.com/cheshirekow/cmake_format

Albeit still being quite limited in linting capabilities (see cheshirekow/cmake_format#240 / cheshirekow/cmake_format#239), it's the best out there short of rolling our own parser.

What It can do well is:

  • checking for correct indentation
  • max empty lines
  • max line length
  • variable naming
  • custom function/macro/command naming

What it lacks is:

  • upper/lower case for built-in functions
  • spacing between function name and parameter list open parens

The formatting part of the tool (cmake-format) supports everything required for a proper style, but the linter (cmake-lint) is still catching up, but issues are open, and the dev has acknowledged them in the tracker as well as documentation pertaining upcoming features.

Overview of all config options:
https://cmake-format.readthedocs.io/en/latest/configuration.html

Currently implemented and future linter rules:
https://cmake-format.readthedocs.io/en/latest/lint-summary.html

Describe alternatives you've considered

None

Testing

Ran the linter as github action and locally.

Additional context

None

@lopho lopho changed the title Cmake format CMake linting Jan 26, 2021
@ZhilkinSerg ZhilkinSerg added Code: Build Issues regarding different builds and build environments Code: Tooling Tooling that is not part of the main game but is part of the repo. labels Jan 26, 2021
@ZhilkinSerg ZhilkinSerg merged commit a149ceb into CleverRaven:master Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code: Build Issues regarding different builds and build environments Code: Tooling Tooling that is not part of the main game but is part of the repo.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants