Publications by Maëlle's R blog on Maëlle Salmon's personal website

Does my test really validate a bug fix? Check it with git cherry-pick

28.08.2024

Earlier this year I wrote a post about git worktree that allows you to load different versions of an R package at once on your computer. To keep with the “juggle between versions of a codebase with Git plant-related commands” theme, let me show you how I use cherry-pick to assess the quality of an unit test. Scenario: you fix a bug in a branch ...

2950 sym

Get your codebase lint-free forever with lintr

27.08.2024

Writing good code is hard. Some aspects get easier with experience – although I observe that I consistently forget some things. 🙈 Other aspects can be tackled through code review – although your reviewer’s time will be better spent on design questions than on nitpicks. 💅 Static code analysis can help with code quality. In this post I wi...

3473 sym Python (366 sym/4 pcs)

Extracting names of functions defined in a script with treesitter

17.07.2024

Coming back from a conference, we might be excited to install and try out the cool things we have heard about. I, going against the stream 🐟, decided to experiment with a tool I have not heard about last week, as I unfortunately missed Davis Vaughan’s talk about treesitter. Nonetheless, I caught the idea that treesitter is a parser of code, R ...

4123 sym R (7965 sym/7 pcs)

Extracting all links from my slidedeck

15.07.2024

Last week after my useR! talk, someone I had met at the R-Ladies dinner asked me for a list of all the links in my slides. I said I’d prepare it, not because I’m a nice person, but because I knew it’d be an use case where the great tinkr package would shine! 😈 What is tinkr? tinkr is an R package I created, and that its current maintainer ...

3562 sym R (2733 sym/4 pcs)

Hack your way to a good Git history

10.06.2024

I’ve now explained on this blog why it’s important to have small, informative Git commits1 and how I’ve realized that polishing history can happen in a second phase of work in a branch. However, I’ve more or less glossed over how to craft the history in a branch once you’re done with the work. I’ve entitled this post “Hack your way to...

6814 sym R (1208 sym/5 pcs)

Why you need small, informative Git commits

02.06.2024

“Make small Git commits with informative messages” is a piece of advice we hear a lot when learning Git. That’s why we might want to sometimes rewrite history in a branch. In this post, I’d like to underline three main (😉) reasons why you’ll be happy you, or someone else, made small and informative Git commits in a codebase. A disclaim...

6663 sym R (10 sym/1 pcs) 22 img

What I edit when refactoring a test file

22.05.2024

I’m currently refactoring test files in a package. Beside some automatic refactoring, I am also manually updating lines of code. Here are some tips (or pet peeves, based on how I look at it / how tired I am 😁) Prequel: please read the R packages book The new edition of the R Packages book by Hadley Wickham and Jenny Bryan features three chapte...

2665 sym R (2339 sym/10 pcs)

Automate code refactoring with {xmlparsedata} and {brio}

14.05.2024

Once again a post praising XML. 😇 These are notes from a quite particular use case: what if you want to replace the usage of a function with another one in many scripts, without manual edits and without touching lines that do not contain a call to replace? The real life example that inspired this post is the replacement of all calls to expect_th...

4623 sym Python (5608 sym/6 pcs)

Reading notes on Producing open source software by Karl Fogel (First edition)

07.02.2024

I recently re-read Nadia Eghbal’s Working in public. This time around, I noticed her mention of the book “Producing open source software” by Karl Fogel. It is a book about the people aspect of open-source projects, including money, and it reads like a sort of guide. Complying with my first-edition-curse, I did not notice there was a second ed...

8379 sym

Load different R package versions at once with git worktree

22.01.2024

Do you ever see GitHub issue comments where someone posts the results of a reprex with a current package version, and then with an older one, to prove a regression? How would you go about preparing such a report? Today I learnt there is a clean way to have different versions of a codebase at once on your computer, thanks to the ever powerful Git. A...

3013 sym