Skip to content

Check before you commit

Check only what you are about to commit, apply the fixes Lintsure is sure of, and look up your packages for known problems.

Four commands work on code that is on your machine and not yet committed. All of them show what they will do first.

You want to Run Changes anything?
Check only what you are about to commit npx lintsure scan --staged No
Have that check run on every commit npx lintsure hook --yes Adds one git hook
Apply the fixes Lintsure is sure of npx lintsure fix --yes Yes, with a backup
Look up your packages for known problems npx lintsure deps --yes No, but it uses the network

Check what you are about to commit

git add .
npx lintsure scan --staged

It lists only findings on lines you have staged. Old findings elsewhere in the project don’t get in the way.

To stop when it finds a clear problem, add --fail-on gap.

Run it on every commit

npx lintsure hook          # shows the hook it would add
npx lintsure hook --yes    # adds it
npx lintsure hook --undo   # removes it

The hook runs lintsure scan --staged --fail-on gap before each commit. If your repo already has a pre-commit hook of its own, Lintsure leaves it alone and prints the one line to add.

To skip it once: git commit --no-verify.

An agent may skip this hook

Some agents commit and push for you with git hooks switched off. Those commits never run this check.

So keep the hook for your own commits, and put the check that must never be skipped in CI. That is what the GitHub Action is for.

Apply the fixes Lintsure is sure of

Some findings have one exact fix: a setting to flip, a line to add. For those, Lintsure can make the change.

npx lintsure fix           # shows each change, writes nothing
npx lintsure fix --yes     # writes them
npx lintsure fix --undo    # puts back what the last fix changed

With --yes it does four things, in order:

  1. Backs up each file it will change.
  2. Makes the change.
  3. Scans again.
  4. Puts the file back if the finding is still there.

To fix chosen findings only, name them: npx lintsure fix F-003 F-007.

Most findings don’t have an exact fix. They need judgement, so they stay as proposals for you or your agent.

Look up your packages

npx lintsure deps          # says what it would send
npx lintsure deps --yes    # sends it and shows the result

It reads the exact versions from package-lock.json and requirements.txt, and asks the public database at osv.dev whether any has a known problem.

This is the only Lintsure command that uses the network. It sends package names and versions. It never sends code, file names or anything else from your project. It tells you so, and waits for --yes.

A listed problem may not affect how you use the package. Read it before you decide.

Watch a check before it blocks anyone

Turning on a check that fails the build can stop a team on day one. --observe lets you watch first:

npx lintsure scan --fail-on gap --observe

It says when the run would have failed, and passes anyway. Watch it for a week, then take --observe off.

See how the project is doing over time

npx lintsure scan --save-record    # keep a record of this scan
npx lintsure history               # list the saved records, oldest first

From the menu

Run lintsure with nothing after it and you get a menu with all of these. Each one shows its preview, then offers a row to apply it.

Next steps

Lintsure is a readiness tool, not an audit or legal advice. Results cover code only; a qualified person should review them. Disclaimer