Jump to content

Code Checks: Difference between revisions

From Torben's Wickie
No edit summary
 
(22 intermediate revisions by the same user not shown)
Line 1: Line 1:
==CSpell==
# run
pnpm dlx cspell-cli@10.2.0 --unique --words-only .
# show list of processed files
pnpm dlx cspell-cli@10.2.0 . --verbose --show-context
cspell.config.yaml
---
$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json
version: '0.2'
useCache: true
useGitignore: true
dictionaryDefinitions:
  - name: cspell-words
    path: cspell-words.txt
    addWords: true
dictionaries:
  - cspell-words
  - python
  - typescript
language: en-US
ignorePaths:
  - '**/*.d.ts'
  - /.vscode/
  - /LICENSE
  - /public/
  - /vue_app/src/api/
  - biome.json
  - cspell-words.txt
  - cspell.config.yaml
  - package*.json
  - pnpm-lock.yaml
  - pnpm-workspace.yaml
  - uv.lock
cspell-words.txt
Torben
Menke
In-file-commands
# cspell:disable
# cspell:enable
# cspell:disable-line
# cspell:ignore foobar asdf
# cspell:words foobar bazqux
==pre-commit via prek==
==pre-commit via prek==
replacement for pre-commit
https://github.com/j178/prek is a replacement for [https://pre-commit.com/ pre-commit]
  brew install prek
  brew install prek
  prek run --all-files
  prek run --all-files
Line 6: Line 52:
  prek autoupdate
  prek autoupdate
  # or  
  # or  
  pnpm dlx @j178/prek run --all-files
  pnpm dlx @j178/prek@0.5.3 run --all-files


prek.toml (copy in edit mode)
.pre-commit-config.yaml (copy in edit mode)
  #:schema https://www.schemastore.org/prek.json
---
# install prek package (instead of python pre-commit)
#  brew install prek
# register as git commit-hook to run automatically
#  prek install
# run manually
  # prek run --all-files
# update hooks to latest version
#  prek autoupdate
   
   
  exclude = '''
  exclude: >-
(?x)^(
  (?x)^(
  \.vscode/.*
    \.vscode/.*
)$
    |pnpm-lock.yaml
  '''
  )$
  repos:
[[repos]]
  - repo: builtin
repo = "builtin"
    hooks:
hooks = [
      - id: check-added-large-files
  { id = "check-added-large-files", args = [
        args: ["--maxkb=500"]
    "--maxkb=500",
      - id: check-case-conflict
  ] },
      - id: check-executables-have-shebangs
  { id = "check-case-conflict" },
      - id: check-illegal-windows-names
  { id = "check-executables-have-shebangs" },
      - id: check-json
  { id = "check-illegal-windows-names" },
      - id: check-json5
  { id = "check-json" },
      - id: check-merge-conflict
  { id = "check-json5" },
      - id: check-shebang-scripts-are-executable
  { id = "check-merge-conflict" },
      - id: check-symlinks
  { id = "check-shebang-scripts-are-executable" },
      - id: check-toml
  { id = "check-symlinks" },
      - id: check-vcs-permalinks
  { id = "check-toml" },
      - id: check-xml
  { id = "check-vcs-permalinks" },
      - id: check-yaml
  { id = "check-xml" },
      - id: destroyed-symlinks
  { id = "check-yaml" },
      - id: detect-private-key
  { id = "destroyed-symlinks" },
      - id: end-of-file-fixer
  { id = "detect-private-key" },
      - id: file-contents-sorter
  { id = "end-of-file-fixer" },
        files: '^(\.gitignore|cspell-words\.txt)$'
  { id = "file-contents-sorter", files = "^(.gitignore|cspell-words.txt)$", args = [
        args: ["--ignore-case"]
    "--ignore-case",
      - id: fix-byte-order-marker
  ] },
      - id: mixed-line-ending
  { id = "fix-byte-order-marker" },
        args: ["--fix=lf"]
  { id = "mixed-line-ending", args = [
      - id: requirements-txt-fixer
    "--fix=lf",
      - id: trailing-whitespace
  ] },
 
  { id = "requirements-txt-fixer" },
==GitLeaks==
  { id = "trailing-whitespace" },
.pre-commit-config.yaml
]
  - repo: https://github.com/gitleaks/gitleaks
    rev: v8.30.1
    hooks:
      - id: gitleaks
 
==Markdown via rumdl==
==Markdown via rumdl==
https://github.com/rvben/rumdl
  brew install rumdl
  brew install rumdl
  rumdl fmt .
  rumdl fmt .
  rumdl check .
  rumdl check .
rumdl check . --fix
  # or
  # or
  pnpm dlx rumdl@0.2.55 fmt
  pnpm dlx rumdl@0.2.77 fmt
  pnpm dlx rumdl@0.2.55 check --fix
  pnpm dlx rumdl@0.2.77 check
pnpm dlx rumdl@0.2.77 check --fix


.rumdl.toml
.rumdl.toml
  [global]
  [global]
  disable = ["MD013"] # line-length
  disable = ["MD013"] # line-length
.pre-commit-config.yaml
  - repo: https://github.com/rvben/rumdl-pre-commit
    rev: v0.2.77
    hooks:
      - id: rumdl
        # "--fix"
        args: ["--disable", "MD013"]  # line-length
      - id: rumdl-fmt


==YAML via ryl==
==YAML via ryl==
https://github.com/owenlamont/ryl
# run without config file:
  # via uv
  # via uv
  uvx ryl@0.21.0 check -d '{extends: default, rules: {line-length: disable, truthy: disable}, ignore: [pnpm-lock.yaml]}' . --fix
  uvx ryl@0.22.0 check -d "{extends: default, rules: {line-length: disable, truthy: disable}, ignore: [pnpm-lock.yaml]}" . --fix
  # via npm
  # via npm
  npx -y @owenlamont/ryl@0.21.0 check -d '{extends: default, rules: {line-length: disable, truthy: disable}, ignore: [pnpm-lock.yaml]}' .
  npx -y @owenlamont/ryl@0.21.0 check -d "{extends: default, rules: {line-length: disable, truthy: disable}, ignore: [pnpm-lock.yaml]}" . --fix
# via pnpm
pnpm dlx @owenlamont/ryl@0.21.0 check -d "{extends: default, rules: {line-length: disable, truthy: disable}, ignore: [pnpm-lock.yaml]}" . --fix


.ryl.toml
.pre-commit-config.yaml
ignore = ["pnpm-lock.yaml"]
  - repo: https://github.com/owenlamont/ryl-pre-commit
    rev: v0.22.0
[rules]
    hooks:
# https://ryl-docs.pages.dev/rules/
      - id: ryl
anchors = "enable"
        args: ["--fix", "-d", "{extends: default, rules: {line-length: disable}}"]
braces = "enable"
 
brackets = "enable"
==Shell via shfmt==
colons = "enable"
https://github.com/mvdan/sh#shfmt
commas = "enable"
  brew install shfmt
document-end = "disable"
  shfmt -w -i 2 -ci .
empty-lines = "enable"
 
empty-values = "disable"
.pre-commit-config.yaml
float-values = "disable"
  - repo: https://github.com/scop/pre-commit-shfmt
hyphens = "enable"
    rev: v3.14.1-1
indentation = "enable"
    hooks:
key-duplicates = "enable"
      - id: shfmt
key-ordering = "disable"
        args: ["-w", "-i", "2", "-ci"]
  line-length = "disable"
  new-line-at-end-of-file = "enable"
new-lines = "enable"
octal-values = "disable"
quoted-strings = "disable"
trailing-spaces = "enable"
[rules.comments]
level = "warning"
[rules.comments-indentation]
level = "warning"
[rules.document-start]
level = "warning"
[rules.truthy]
level = "warning"


TOML via taplo
==TOML via taplo==
  pnpm dlx @taplo/cli fmt *.toml
https://github.com/tamasfe/taplo (last release 1 year ago)
  pnpm dlx @taplo/cli check *.toml
  pnpm dlx @taplo/cli@0.7.0 fmt *.toml
  pnpm dlx @taplo/cli@0.7.0 check *.toml

Latest revision as of 09:42, 26 September 2026

CSpell

# run
pnpm dlx cspell-cli@10.2.0 --unique --words-only .
# show list of processed files
pnpm dlx cspell-cli@10.2.0 . --verbose --show-context

cspell.config.yaml

---
$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json
version: '0.2'
useCache: true
useGitignore: true
dictionaryDefinitions:
  - name: cspell-words
    path: cspell-words.txt
    addWords: true
dictionaries:
  - cspell-words
  - python
  - typescript
language: en-US
ignorePaths:
  - '**/*.d.ts'
  - /.vscode/
  - /LICENSE
  - /public/
  - /vue_app/src/api/
  - biome.json
  - cspell-words.txt
  - cspell.config.yaml
  - package*.json
  - pnpm-lock.yaml
  - pnpm-workspace.yaml
  - uv.lock

cspell-words.txt

Torben
Menke

In-file-commands

# cspell:disable
# cspell:enable
# cspell:disable-line
# cspell:ignore foobar asdf
# cspell:words foobar bazqux

pre-commit via prek

https://github.com/j178/prek is a replacement for pre-commit

brew install prek
prek run --all-files
# update hook versions
prek autoupdate
# or 
pnpm dlx @j178/prek@0.5.3 run --all-files

.pre-commit-config.yaml (copy in edit mode)

---
# install prek package (instead of python pre-commit)
#  brew install prek
# register as git commit-hook to run automatically
#  prek install
# run manually
#  prek run --all-files
# update hooks to latest version
#  prek autoupdate

exclude: >-
  (?x)^(
    \.vscode/.*
    |pnpm-lock.yaml
  )$
repos:
  - repo: builtin
    hooks:
      - id: check-added-large-files
        args: ["--maxkb=500"]
      - id: check-case-conflict
      - id: check-executables-have-shebangs
      - id: check-illegal-windows-names
      - id: check-json
      - id: check-json5
      - id: check-merge-conflict
      - id: check-shebang-scripts-are-executable
      - id: check-symlinks
      - id: check-toml
      - id: check-vcs-permalinks
      - id: check-xml
      - id: check-yaml
      - id: destroyed-symlinks
      - id: detect-private-key
      - id: end-of-file-fixer
      - id: file-contents-sorter
        files: '^(\.gitignore|cspell-words\.txt)$'
        args: ["--ignore-case"]
      - id: fix-byte-order-marker
      - id: mixed-line-ending
        args: ["--fix=lf"]
      - id: requirements-txt-fixer
      - id: trailing-whitespace

GitLeaks

.pre-commit-config.yaml

  - repo: https://github.com/gitleaks/gitleaks
    rev: v8.30.1
    hooks:
      - id: gitleaks

Markdown via rumdl

https://github.com/rvben/rumdl

brew install rumdl
rumdl fmt .
rumdl check .
rumdl check . --fix
# or
pnpm dlx rumdl@0.2.77 fmt
pnpm dlx rumdl@0.2.77 check
pnpm dlx rumdl@0.2.77 check --fix

.rumdl.toml

[global]
disable = ["MD013"] # line-length

.pre-commit-config.yaml

  - repo: https://github.com/rvben/rumdl-pre-commit
    rev: v0.2.77
    hooks:
      - id: rumdl
        # "--fix"
        args: ["--disable", "MD013"]  # line-length
      - id: rumdl-fmt

YAML via ryl

https://github.com/owenlamont/ryl

# run without config file:
# via uv
uvx ryl@0.22.0 check -d "{extends: default, rules: {line-length: disable, truthy: disable}, ignore: [pnpm-lock.yaml]}" . --fix
# via npm
npx -y @owenlamont/ryl@0.21.0 check -d "{extends: default, rules: {line-length: disable, truthy: disable}, ignore: [pnpm-lock.yaml]}" . --fix
# via pnpm
pnpm dlx @owenlamont/ryl@0.21.0 check -d "{extends: default, rules: {line-length: disable, truthy: disable}, ignore: [pnpm-lock.yaml]}" . --fix

.pre-commit-config.yaml

  - repo: https://github.com/owenlamont/ryl-pre-commit
    rev: v0.22.0
    hooks:
      - id: ryl
        args: ["--fix", "-d", "{extends: default, rules: {line-length: disable}}"]

Shell via shfmt

https://github.com/mvdan/sh#shfmt

brew install shfmt
shfmt -w -i 2 -ci .

.pre-commit-config.yaml

  - repo: https://github.com/scop/pre-commit-shfmt
    rev: v3.14.1-1
    hooks:
      - id: shfmt
        args: ["-w", "-i", "2", "-ci"]

TOML via taplo

https://github.com/tamasfe/taplo (last release 1 year ago)

pnpm dlx @taplo/cli@0.7.0 fmt *.toml
pnpm dlx @taplo/cli@0.7.0 check *.toml