Kotlin OpenRewrite testing

Testing an OpenRewrite recipe

For the last two weeks, I’ve kicked the tires of OpenRewrite. At first, I created a recipe to move Kotlin source files as per the official recommendations with a set package name. I then improved the recipe to compute the root automatically. In both versions, I thoroughly tested the recipe. However, my testing approach was wrong. In this post, I want to describe my mistakes, and how I fixed them. The naive approach I originally approached the testing of the recipe in a very naive way, t

Kotlin OpenRewrite

Improving my previous OpenRewrite recipe

I started discovering OpenRewrite last week by writing a Kotlin recipe that moves Kotlin files according to the official directory structure recommendation. I mentioned some future works, and here they are. In this post, I want to describe how to compute the root package instead of letting the user set it. Reminder I developed last week a recipe to follow the Kotlin recommendation regarding directory structure: In pure Kotlin projects, the recommended directory structure follows the packa

Kotlin OpenRewrite

Authoring an OpenRewrite recipe

I’ve been eying OpenRewrite for some time, but I haven’t had time to play with it yet. In case you never heard about OpenRewrite, OpenRewrite takes care of refactoring your codebase to newer language, framework, and paradigm versions. OpenRewrite is an open-source automated refactoring ecosystem for source code, enabling developers to effectively eliminate technical debt within their repositories. It consists of an auto-refactoring engine that runs prepackaged, open-source refac

Rust lazy_static LazyLock OnceLock

Runtime-initialized variables in Rust

Rust offers different ways to initialize compile time-initialized variables. Recently, I had to create a runtime-initialized variable: existing approaches don’t work in this case. I want to describe multiple ways to achieve it in this post. Constants The Rust language allows you to create constants. Two keywords are available: const and static. Sometimes a certain value is used many times throughout a program, and it can become inconvenient to copy it over and over. What’s more, it’

technical writing blog

Writing for Developers

I started this blog as a hobby seventeen years ago, in April 2008. At the time, I had no clue about technical writing. I’m pretty sure it was not even a thing back then: the only content aimed at developers was technical documentation. Since then, the landscape has changed a lot, to the point that companies hire for technical writer positions. I was curious to compare what I learned by doing to the structured approach of a book. I ordered the book last year when it was still being written

home assistant entity state temperature Netatmo

Getting a single value from a device's state in Home Assistant

This is the 7th post in the My journey with Home Assistant focus series. I recently acquired Netatmo smart radiator valves to manage my rooms' temperature remotely. I’m not skilled at manual tasks, but I could easily replace the old thermo-static valves. I then registered the smart ones in the Netatmo app. Finally, I integrated them in my Home Assistant via the dedicated Netatmo integration. Everything was very straightforward. I noticed that each valve not only allows remote control but al

Infrastructure-as-Code IaC Kubernetes Crossplane

Getting my feet wet with Crossplane

In the early days of IT, we manually configured servers–each one a precious snowflake, lovingly maintained and documented. But the size of the infrastructure grew and this approach couldn’t scale. Chef and Puppet popularized the idea of Infrastructure-as-Code: engineers would define the state of the machine(s) in text files, stored in Git–hence the name. A global node would read these files to create a registry. Then, a local agent on each machine would check the desired state at regular in