languagetool-code-comments integrates the LanguageTool API to parse, spell check, and correct the grammar of your code comments!

Overview

languagetool-code-comments

Build Status Release Coverage Status

languagetool-code-comments integrates the LanguageTool API to parse, spell check, and correct the grammar of your code comments!

Overview

Never will you submit a PR where you fat-fingered // This is a hck in your code again. LTCC can be integrated directly in your editor, or used in a linting fashion in your CI pipelines. Caching is built in to speed up processing new and edited docs.

Using the power of Tree Sitter, LTCC easily integrates with several programming languages. And if privacy is a concern, and you have some spare hardware lying around, LanguageTool offers a great way to self-host your own instance.

screenshot

languagetool-code-comments v0.4.0
Integrates the LanguageTool API to parse, spell check, and correct the grammar of your code
comments!

USAGE:
    languagetool-code-comments <SUBCOMMAND>

OPTIONS:
    -h, --help       Print help information
    -V, --version    Print version information

SUBCOMMANDS:
    cache         Functionality around the LanguageTools result cache.
    check         Parses source code comments from the provided file and passes them to
                      LanguageTool, returning grammar and spelling mistakes if any.
    completion    Generates shell completions
    help          Print this message or the help of the given subcommand(s)

SUPPORTED LANGUAGES:
  - astro
  - bash
  - css
  - dockerfile
  - go
  - hcl
  - html
  - javascript
  - jsx
  - lua
  - make
  - nix
  - python
  - rust
  - sql
  - toml
  - tsx
  - typescript
  - yaml

Install

MacOS

brew install dustinblackman/tap/languagetool-code-comments

Debian / Ubuntu

curl -s https://dustinblackman.github.io/apt/deb/KEY.gpg | apt-key add -
curl -s https://dustinblackman.github.io/apt/deb/dustinblackman.list > /etc/apt/sources.list.d/dustinblackman.list
sudo apt-get update
sudo apt-get install languagetool-code-comments

Fedora / CentOS

yum-config-manager --add-repo https://dustinblackman.github.io/yum/config.repo
yum install languagetool-code-comments

Nix

nix-env -f '<nixpkgs>' -iA nur.repos.dustinblackman.languagetool-code-comments

Arch Linux

yay -S languagetool-code-comments-bin

Windows

Chocolatey

choco install languagetool-code-comments --version=0.4.0

Scoop

scoop bucket add dustinblackman https://github.com/dustinblackman/scoop-bucket.git
scoop install languagetool-code-comments

Manual

Download the pre-compiled binaries and packages from the releases page and copy to the desired location.

Source

git clone https://github.com/dustinblackman/languagetool-code-comments.git
cd languagetool-code-comments
git submodule update --init --recursive
cargo install --path .

Usage

CLI

languagetool-code-comments check -l en-US --file /home/me/my-test-file.rs

Neovim

See ./tools/null-ls-config.lua

The above uses null-ls, and is based off the soon-to-be ltrs configuration. Once I feel languagetool-code-comments responses have stabilized, I'll attempt PRing the configs to null-rs itself.

Visual Studio Code

Coming Soon! Follow #1 for updates.

Development

Setup

git clone https://github.com/dustinblackman/languagetool-code-comments.git
cd languagetool-code-comments
git submodule update --init --recursive
cargo check

Adding a new language

Let's take the following steps to add Perl to languagetool-code-comments, as example which will take you from selecting the Tree Sitter config, to integrating the language in the repo, writing tests, and QAing. If you'd like to check out a complete example, see add Nix.

  1. Follow the setup for the project.
  2. Head over to the Tree Sitter Parsers docs and select the Perl parser.
  3. Add the repo as a submodule with git submodule add https://github.com/ganezdragon/tree-sitter-perl ./external/tree-sitter-perl
  4. Update build.rs by adding a configuration for Perl in the langs vec. Perl includes both a parser.c and scanner.cc, so the configuration would look like the following.
build_treesitter_grammar(
    "tree-sitter-perl",
    "tree-sitter-perl/src",
    vec!["parser.c", "scanner.cc"],
),
  1. Run cargo build to verify the configuration is set up correctly.
  2. Update parse.rs by adding fn tree_sitter_perl() - Language; to extern "C", Perl to the Languages enum, a case statement in get_language_config(), and an extension parser in get_language_from_filepath().
  3. Create a Perl file fixture in ./tests/fixtures, following the examples of the other languages.
  4. Update parse_test.rs with a test for Perl, following the examples of the other languages.
  5. Run cargo test to prove your tests work.
  6. Run cargo build and test the CLI works as expected with Perl.
You might also like...
'apk-yara-checker' is a little CLI tool written in Rust to check Yara rules against a folder of APK files.
'apk-yara-checker' is a little CLI tool written in Rust to check Yara rules against a folder of APK files.

apk-yara-checker 'apk-yara-checker' is a little CLI tool written in Rust to check Yara rules against a folder of APK files. You have to pass the folde

CIEBII - Check if every bit is intact
CIEBII - Check if every bit is intact

CIEBII Checks If Every Byte Is Intact CIEBII is an image file format that checks if every single byte is intact. What does it do if it finds that a by

Check if the process is running inside Windows Subsystem for Linux (Bash on Windows)

is-wsl Check if the process is running inside Windows Subsystem for Linux (Bash on Windows) Inspired by sindresorhus/is-wsl and made for Rust lang. Ca

Tool to check Nixpkgs' pkgs/by-name directory

Nixpkgs pkgs/by-name checker This repository implements a program to check Nixpkgs' pkgs/by-name directory as part of RFC 140. See CONTRIBUTING.md for

parse command-line arguments into a hashmap and vec of positional args

parse command-line arguments into a hashmap and vec of positional args This library doesn't populate custom structs, format help messages, or convert types.

A CLI command to parse kustomize build result and notify it to GitLab

ksnotify A CLI command to parse kustomize build result and notify it to GitLab Caution This repository is under development status. What ksnotify does

Download pdbs from symbol servers and cache locally, parse symbol paths from env vars

symsrv This crate lets you download and cache pdb files from symbol servers, according to the rules from the _NT_SYMBOL_PATH environment variable. It

Parse command line arguments by defining a struct.

StructOpt Parse command line arguments by defining a struct. It combines clap with custom derive. Documentation Find it on Docs.rs. You can also check

Vim plugin to quickly parse strings into arrays.

butcher Vim plugin to quickly parse strings into arrays. It is painful to write arrays in any programming language, so butcher makes it easy for you.

Comments
  • Add Visual Studio Code extension

    Add Visual Studio Code extension

    Overview

    VSCode extension would be a great addition, and likely where the tool would be used most.

    Code actions example: https://github.com/microsoft/vscode-extension-samples/tree/main/code-actions-sample

    opened by dustinblackman 0
Owner
Dustin Blackman
Senior Staff Lead Software Engineer
Dustin Blackman
A CLI tool for CIs and build scripts, making file system based caching easy and correct (locking, eviction, etc.)

FS Dir Cache A CLI tool for CIs and build scripts, making file system based caching easy and correct (locking, eviction, etc.) When working on build s

Dawid Ciężarkiewicz 5 Aug 29, 2023
try to find the correct word with only first letter and unknown letter count.

MOTUS Current dictionaries are provided in french and can contain some words not included in the official Motus dictionary. Additionally, dictionaries

Alexandre 6 Apr 11, 2022
tidy-builder is a builder generator that is compile-time correct.

The Builder derive macro creates a compile-time correct builder which means that it only allows you to build the given struct if and only if you provi

M.Amin Rayej 7 Dec 18, 2022
Check the reproducibility status of your Arch Linux packages (read-only mirror)

arch-repro-status A CLI tool for querying the reproducibility status of the Arch Linux packages using data from a rebuilderd instance such as reproduc

Arch Linux 12 Nov 16, 2022
Mypyc DSL grammar for tree-sitter

tree-sitter-mypyc Mypyc DSL grammar for tree-sitter. Installing (Neovim) This is based on the Neovim Tree-sitter docs for adding new parsers. Basicall

dosisod 3 Dec 30, 2022
Simple grammar-based test case generator

tree-splicer tree-splicer is a simple grammar-based test case generator. It parses a number of input files using tree-sitter grammars, and produces ne

Langston Barrett 5 Mar 19, 2023
🍅 A command-line tool to get and set values in toml files while preserving comments and formatting

tomato Get, set, and delete values in TOML files while preserving comments and formatting. That's it. That's the feature set. I wrote tomato to satisf

C J Silverio 15 Dec 23, 2022
PlandUML and Drawio diagrams in doc comments as PNG or SVG images.

rsdoc This crate provides a procedural macro that transform PlandUML and Drawio diagrams in doc comments as PNG or SVG images. The diagrams in doc com

null 4 Feb 20, 2023
Check a folder for dirty git repositories, forgotten branches and commits

dg - find dirty git repos Ever forgot to push a commit or lost your work because you assumed it was pushed to Github but it wasn't? dg finds local git

Dotan J. Nahum 11 Mar 19, 2023
A rustc plugin to check for numerical instability

Herbie lint for Rust What This plugin can add warnings or errors to your crate when using a numerically unstable floating point expression. Quick exam

Martin Carton 172 Oct 31, 2022