Skip to content

Releases: cheshirekow/cmake_format

cmake-format v0.6.5

26 Dec 04:49
Compare
Choose a tag to compare

This is largely a maintenance release, implementing explicit parse logic for all cmake commands that don't already have parsers. One additional configuration option is added allowing cmake-lint to globally ignore specific lint ids.

cmake-format v0.6.4

19 Dec 06:34
Compare
Choose a tag to compare

This release includes implementations for many more lint checkers. Under the hood there was a pretty significant refactor of the parser, though none of the parse logic has changed. The refactor was primarily to split up the very large parser module, and to make it easier to access qualifiers of the parse tree during lint checks.

You can see a running list of all the implemented checkers at the docs

cmake-format v0.6.3

13 Dec 06:17
Compare
Choose a tag to compare

This release finally includes some progress on a long-standing goal: a cmake-linter built on the same foundation as the formatter. As of this release The cmake-format python package now comes with both the cmake-format and cmake-lint programs. The linter is still in a relatively early state and lacks many features, but should continue to grow with the formatter in future releases.

Along with the new linter, this release also includes some reorganization of the documentation in order to more clearly separate information about the different programs that are distributed from this repository.

cmake-format v0.6.2

03 Dec 01:04
Compare
Choose a tag to compare

This is a maintenance release. Some additional command parsers have moved out of the standard parse model improving the parse of these commands. This release also includes some groundwork scripts to parse the usage strings in the cmake help text. Additionally:

  • --in-place will preserve file mode
  • The new --check command line option will not format the file, but exit with non-zero status if any changes would be made
  • The new --require-valid-layout option will exit with non-zero status if an admissible layout is not found.

cmake-format v0.6.0

15 Oct 23:34
Compare
Choose a tag to compare

This release includes a significant refactor of the formatting logic. Details of the new algorithm are described in the documentation. As a result of the algorithm changes, some config options have changed too. The following config options are removed:

  • max_subargs_per_line (see max_pargs_hwrap)
  • nest_threshold (see min_prefix_chars)
  • algorithm_order (see layout_passes)

And the following config options have been added:

  • max_subgroups_hwrap
  • max_pargs_hwrap
  • dangle_align
  • min_prefix_chars
  • max_prefix_chars
  • max_lines_hwrap
  • layout_passes
  • enable_sort

Also as a result of the algorithm changes, the default layout has changed. By default, cmake-format will now prefer to nest long lists rather than aligning them to the opening parenthesis of a statement. Also, due to the new configuration options, the output of cmake-format is likely to be different with your current configs.

Additionally, cmake-format will now tend to prefer a normal "horizontal" wrap for relatively long lists of positional arguments (e.g. source files in add_library) whereas it would previously prefer a vertical layout (one-entry per line). This is a consequence of an ambiguity between which positional arguments should be vertical versus which should be wrapped. Two planned features (layout tags and positional semantics) should help to provide enough control to get the layout you want in these lists.

I acknowledge that it is not ideal for formatting to change between releases but this is an unfortunate inevitability at this stage of development. The changes in this release eliminate a number of inconsistencies and also adds the groundwork for future planned features and options. Hopefully we are getting close to a stable state and a 1.0 release.

cmake-format v0.5.5

26 Sep 15:17
Compare
Choose a tag to compare

This is a maintenance release fixing a few minor bugs and enhancements. One new feature is that the --config command line option now accepts a list of config files, which should allow for including multiple databases of command specifications

cmake-format v0.5.4

23 Jul 16:52
Compare
Choose a tag to compare

This is a maintenance release fixing a couple of bugs and adding some missing documentation. One notable feature added is that, during in-place formatting, if the file content is unchanged cmake-format will no-longer write the file.

cmake-format v0.5.2

30 May 20:18
Compare
Choose a tag to compare

This release fixes a few bugs and does some internal prep work for upcoming format algorithm changes. The documentation on the format algorithm is a little ahead of the code state in this release. Also, the documentation theme has changed to something based on read-the-docs (I hope you like it).

  • Add missing forms of add_library() and add_executable()
  • --autosort now defaults to False (it can be somewhat suprising) and it doesn't always get it right.
  • Configuration options in --help and in the example configurations from --dump-config are now split into hopefully meaningful sections.
  • cmake-format no longer tries to infer "keywords" or "flags" from COMMAND strings. This matching wasn't good enough as there is way too much variance in how programs design their command line options.

cmake-format v0.5.1

03 May 16:05
Compare
Choose a tag to compare

The 0.5.0 release involved some pretty big changes to the parsing engine and introduced a new format algorithm. These two things combined unfortunately lead to a lot of new bugs. The full battery of pre-release tests wasn't run and so a lot of those issues popped up after release. Hopefully most of those are squashed in this release.

  • Fixed lots of bugs introduced in 0.5.0
  • cmake-format has a channel on discord now. Come chat about it at https://discord.gg/NgjwyPy

cmake-format v0.5.0

03 May 16:04
Compare
Choose a tag to compare
  • Overhauled the parser logic enabling arbitrary implementations of statement parsers. The generic statement parser is now implemented by the standard_parse function (or the StandardParser functor, which is used to load legacy additional_commands).

  • New custom parser logic for deep cmake statements such as:

    • install
    • file
    • ExternalProject_XXX
    • FetchContent_XXX
  • cmake-format can now sort your argument lists for you (such as lists of files). This enabled with the autosort config option. Some argument lists are inherently sortable (e.g. the list of sources supplied to add_library or add_executable). Other commands (e.g. set() which cannot be inferred sortable can be explicitly tagged using a comment at the beginning of the list. See the README for more information.

  • A consequence of the above is that the parse tree for set() has changed, and so it's default formatting in many cases has also changed. You can restore the old behavior by adding the following to your config:

    additional_commands = {
      "set": {
        "flags": ["FORCE", "PARENT_SCOPE"],
        "kwargs": {
          "CACHE": "*"
        }
      }
    }
    
  • The default command case has changed from lower to canonical (which is a new option). In most cases this is the same as lower but for some standard, non-builtin commands the canonical spelling is CamelCase (i.e. ExternalProject_Add).

  • There is a new cmake-annotate program distributed with the package. It can generate semantic HTML renderings of your listfiles (see the documentation for details).