Skip to content

treewide: fix typos in comments#384334

Merged
Aleksanaa merged 1 commit intoNixOS:masterfrom
pbsds:fix-comment-typos-1740223266
Feb 24, 2025
Merged

treewide: fix typos in comments#384334
Aleksanaa merged 1 commit intoNixOS:masterfrom
pbsds:fix-comment-typos-1740223266

Conversation

@pbsds
Copy link
Copy Markdown
Member

@pbsds pbsds commented Feb 22, 2025

This run of typos targets the comments in .nix files. This is a new addition to #346453.

Made with

#!/usr/bin/env nix-shell
#!nix-shell --pure -i bash -p git fd typos gnugrep bat aha

git restore .
fd '\.nix$' pkgs/ --type f -j1 -x bash -xc "$(cat <<"EOF"
    typos --no-check-filenames --write-changes "$1"
    git diff --exit-code "$1" && exit
    #( git diff "$1" | grep -qE "^\+ +[^# ]") && git restore "$1"
    count1="$( bat --language nix --diff --style changes "$1" --theme "Monokai Extended" --color always | aha --no-header | grep -E '^<span style="color:olive;">~</span> ' | wc -l )"
    count2="$( bat --language nix --diff --style changes "$1" --theme "Monokai Extended" --color always | aha --no-header | grep -E '^<span style="color:olive;">~</span> (<span style="color:#f8f8f2;"> *</span>)?<span style="color:#75715e;">.*</span>$' | wc -l )"
    [[ $count1 -ne $count2 ]] && git restore "$1"
EOF
)" -- {}

and filtered with GIT_DIFF_OPTS='--unified=15' git -c interactive.singleKey=true add --patch

I initially tried using the tree-sitter cli, the python bindings and even ast-grep through various means, but this mess of a script is what I ended up with ᕕ( ᐛ )ᕗ
The current script reverts the whole file if a single typo fix is not inside a comment, in the future the script could be adapted to filter out all changes outside of comments per file. It also does not consider comments and the end of lines with code before them.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: haskell General-purpose, statically typed, purely functional programming language 6.topic: qt/kde Object-oriented framework for GUI creation 6.topic: emacs Text editor 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 6.topic: ruby A dynamic, open source programming language with a focus on simplicity and productivity. 6.topic: vim Advanced text editor 6.topic: ocaml OCaml is a general-purpose, high-level, multi-paradigm programming language. 6.topic: fetch Fetchers (e.g. fetchgit, fetchsvn, ...) 6.topic: stdenv Standard environment 6.topic: nodejs Node.js is a free, open-source, cross-platform JavaScript runtime environment 6.topic: coq A formal proof management system 6.topic: TeX Issues regarding texlive and TeX in general 6.topic: lua Lua is a powerful, efficient, lightweight, embeddable scripting language. 6.topic: testing Tooling for automated testing of packages and modules 6.topic: updaters Tooling for (semi-)automated updating of packages 6.topic: cuda Parallel computing platform and API 6.topic: jupyter Interactive computing tooling: kernels, notebook, jupyterlab 6.topic: games Gaming on NixOS 6.topic: rocm ROCm is an Advanced Micro Devices software stack for graphics processing unit programming. 6.topic: k3s Kubernates distribution (https://k3s.io/) 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Feb 22, 2025
@pbsbot
Copy link
Copy Markdown

pbsbot commented Feb 22, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 384334


x86_64-linux

✅ 1 package built:
  • vimPluginsUpdater

@pbsds pbsds marked this pull request as ready for review February 22, 2025 20:51
@pbsds pbsds requested a review from philiptaron February 22, 2025 20:51
Copy link
Copy Markdown
Contributor

@tobim tobim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for doing this.

@pbsds pbsds force-pushed the fix-comment-typos-1740223266 branch from d7f7387 to cd1bd46 Compare February 22, 2025 21:00
Copy link
Copy Markdown
Member

@Aleksanaa Aleksanaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a thorough review and others look fine

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one person. label Feb 24, 2025
Made with

```shell
git restore .
fd '\.nix$' pkgs/ --type f -j1 -x bash -xc "$(cat <<"EOF"
    typos --no-check-filenames --write-changes "$1"
    git diff --exit-code "$1" && exit
    #( git diff "$1" | grep -qE "^\+ +[^# ]") && git restore "$1"
    count1="$( bat --language nix --diff --style changes "$1" --theme "Monokai Extended" --color always | aha --no-header | grep -E '^<span style="color:olive;">~</span> ' | wc -l )"
    count2="$( bat --language nix --diff --style changes "$1" --theme "Monokai Extended" --color always | aha --no-header | grep -E '^<span style="color:olive;">~</span> (<span style="color:#f8f8f2;"> *</span>)?<span style="color:#75715e;">.*</span>$' | wc -l )"
    [[ $count1 -ne $count2 ]] && git restore "$1"
EOF
)" -- {}
```

and filtered with `GIT_DIFF_OPTS='--unified=15' git -c interactive.singleKey=true add --patch`

I initially tried using the tree-sitter cli, python bindings and even ast-grep through various means, but this is what I ended up with.
@pbsds pbsds force-pushed the fix-comment-typos-1740223266 branch from cd1bd46 to 5aba992 Compare February 24, 2025 09:44
@wegank wegank removed the 12.approvals: 1 This PR was reviewed and approved by one person. label Feb 24, 2025
@Aleksanaa Aleksanaa merged commit 0cd4067 into NixOS:master Feb 24, 2025
25 of 27 checks passed
@pbsds pbsds mentioned this pull request Jun 2, 2025
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: coq A formal proof management system 6.topic: cuda Parallel computing platform and API 6.topic: emacs Text editor 6.topic: fetch Fetchers (e.g. fetchgit, fetchsvn, ...) 6.topic: games Gaming on NixOS 6.topic: haskell General-purpose, statically typed, purely functional programming language 6.topic: jupyter Interactive computing tooling: kernels, notebook, jupyterlab 6.topic: k3s Kubernates distribution (https://k3s.io/) 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related 6.topic: lua Lua is a powerful, efficient, lightweight, embeddable scripting language. 6.topic: nodejs Node.js is a free, open-source, cross-platform JavaScript runtime environment 6.topic: ocaml OCaml is a general-purpose, high-level, multi-paradigm programming language. 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: qt/kde Object-oriented framework for GUI creation 6.topic: rocm ROCm is an Advanced Micro Devices software stack for graphics processing unit programming. 6.topic: ruby A dynamic, open source programming language with a focus on simplicity and productivity. 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 6.topic: stdenv Standard environment 6.topic: testing Tooling for automated testing of packages and modules 6.topic: TeX Issues regarding texlive and TeX in general 6.topic: updaters Tooling for (semi-)automated updating of packages 6.topic: vim Advanced text editor 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux.

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

5 participants