proselint

repository·main·Indexed 26 days ago

https://github.com/amperser/proselint

A linter for English prose that aggregates best practices from writers and editors to detect stylistic issues. It provides a command-line interface, a Python library, and a REST API for linting text, with support for custom JSON configurations and integration with tools like pre-commit and SublimeLinter.

Tokens
7.2K
Snippets
15
Records
38
Agent score
88%

What's inside proselint

  1. Overview of Proselint

    main
    Proselint is a linter for prose designed to improve writing quality. It scans documents and analyzes them for stylistic issues, providing suggestions inspired by famous writers and editors (such as George Orwell, Strunk & White, and Bryan Garner). It acts similarly to a spell checker but focuses on best practices in writing, such as avoiding clichés, mixed metaphors, and redundancy.
  2. Understand Proselint terminology

    main

    When working with Proselint, use the following standard terminology:

    • check: A lint rule (e.g., annotations.misc).
    • term: A word or phrase that Proselint flags or recommends a replacement for.
    • term pair or entry: A set of two terms where one is flagged and the other is recommended.
    • lint file: A document being analyzed by Proselint.
    • check result: An individual suggestion from a check (lacks file context).
    • lint result: An extension of a check result that includes contextual information about the lint file.
  3. Implement technical requirements for checks

    main

    To maintain performance and organization, all new checks must follow these implementation rules:

    • Batching: Checks containing more than 150 entries must be batched into chunks of 150.
    • External Data Files: Checks with more than 50 entries must have their contents factored out into a separate CSV file. The CSV file must bear the same name as the last element of the check path.

    Example: A check at cliches.misc.write_good should have an associated file named write-good (formatted as CSV).

  4. Run the Jekyll development server

    main

    Start the Jekyll server to preview the site locally. Use the --watch option to automatically update the generated HTML whenever you make changes to the source files. The site will be available at localhost:4000.

    $ jekyll serve --watch
  5. Use proselint with pre-commit

    main

    To integrate proselint into your pre-commit or prek workflow, add the following configuration to your .pre-commit-config.yaml. Ensure you update the rev to the desired git tag or revision.

    repos:
      - repo: https://github.com/amperser/proselint
        rev: v0.16.0
        hooks:
          - id: proselint
  6. Install proselint

    main

    You can install proselint using pip, or via system package managers depending on your operating system.

    Python (pip):

    pip install proselint

    Fedora:

    sudo dnf install proselint

    Debian:

    sudo apt install python3-proselint

    Ubuntu:

    sudo add-apt-repository universe
    sudo apt install python3-proselint

    Nix (Declarative):

    environment.systemPackages = [pkgs.proselint];

    Nix (Imperative):

    nix profile install nixpkgs#proselint
    pip install proselint