Skip to content

Commit d1dbc6b

Browse files
gregghclaude
andcommitted
chore: add linting and pre-commit configuration
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ebd1625 commit d1dbc6b

12 files changed

Lines changed: 746 additions & 37 deletions
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Lint Markdown
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- '**.md'
8+
pull_request:
9+
branches: [main]
10+
paths:
11+
- '**.md'
12+
13+
jobs:
14+
lint:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: '16'
22+
- name: Install markdownlint
23+
run: npm install -g markdownlint-cli
24+
- name: Run markdownlint
25+
run: markdownlint '**/*.md' --ignore node_modules

.github/workflows/scripts-lint.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Lint Scripts
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'scripts/**.sh'
8+
- '**.lua'
9+
- '.github/workflows/scripts-lint.yml'
10+
pull_request:
11+
branches: [main]
12+
paths:
13+
- 'scripts/**.sh'
14+
- '**.lua'
15+
- '.github/workflows/scripts-lint.yml'
16+
17+
jobs:
18+
shellcheck:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
- name: Install shellcheck
23+
run: sudo apt-get update && sudo apt-get install -y shellcheck
24+
- name: List shell scripts
25+
id: list-scripts
26+
run: |
27+
if [[ -d "./scripts" && $(find ./scripts -name "*.sh" | wc -l) -gt 0 ]]; then
28+
echo "SHELL_SCRIPTS_EXIST=true" >> $GITHUB_ENV
29+
find ./scripts -name "*.sh" -type f
30+
else
31+
echo "SHELL_SCRIPTS_EXIST=false" >> $GITHUB_ENV
32+
echo "No shell scripts found in ./scripts directory"
33+
fi
34+
- name: Run shellcheck
35+
if: env.SHELL_SCRIPTS_EXIST == 'true'
36+
run: |
37+
echo "Running shellcheck on shell scripts:"
38+
find ./scripts -name "*.sh" -type f -print0 | xargs -0 shellcheck --severity=warning
39+
40+
luacheck:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v3
44+
- name: Check for Lua files
45+
id: check-lua
46+
run: |
47+
if [[ $(find . -name "*.lua" | wc -l) -gt 0 ]]; then
48+
echo "LUA_FILES_EXIST=true" >> $GITHUB_ENV
49+
find . -name "*.lua" -type f | head -5
50+
else
51+
echo "LUA_FILES_EXIST=false" >> $GITHUB_ENV
52+
echo "No Lua files found in repository"
53+
fi
54+
- name: Set up Lua
55+
if: env.LUA_FILES_EXIST == 'true'
56+
uses: leafo/gh-actions-lua@v9
57+
with:
58+
luaVersion: "5.1"
59+
- name: Set up LuaRocks
60+
if: env.LUA_FILES_EXIST == 'true'
61+
uses: leafo/gh-actions-luarocks@v4
62+
- name: Install luacheck
63+
if: env.LUA_FILES_EXIST == 'true'
64+
run: luarocks install luacheck
65+
- name: Run luacheck
66+
if: env.LUA_FILES_EXIST == 'true'
67+
run: luacheck .

.github/workflows/yaml-lint.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Lint YAML
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- '**.yml'
8+
- '**.yaml'
9+
pull_request:
10+
branches: [main]
11+
paths:
12+
- '**.yml'
13+
- '**.yaml'
14+
15+
jobs:
16+
lint:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Set up Python
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: '3.10'
24+
- name: Install yamllint
25+
run: pip install yamllint
26+
- name: Run yamllint
27+
run: yamllint .

.gitignore

Lines changed: 117 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,126 @@
1-
# Compiled Lua sources
2-
luac.out
1+
# General
2+
.DS_Store
3+
.AppleDouble
4+
.LSOverride
5+
Thumbs.db
6+
ehthumbs.db
7+
Desktop.ini
8+
$RECYCLE.BIN/
39

4-
# luarocks build files
5-
*.src.rock
6-
*.zip
7-
*.tar.gz
10+
# Backup files
11+
*~
12+
*.bak
13+
*.swp
14+
*.swo
15+
*.tmp
816

9-
# Object files
10-
*.o
11-
*.os
12-
*.ko
13-
*.obj
14-
*.elf
17+
# IDE - VSCode
18+
.vscode/*
19+
!.vscode/settings.json
20+
!.vscode/tasks.json
21+
!.vscode/launch.json
22+
!.vscode/extensions.json
1523

16-
# Precompiled Headers
17-
*.gch
18-
*.pch
24+
# IDE - JetBrains
25+
.idea/
26+
*.iml
27+
*.iws
28+
*.ipr
29+
.idea_modules/
30+
*.sln.iml
1931

20-
# Libraries
21-
*.lib
22-
*.a
23-
*.la
24-
*.lo
25-
*.def
26-
*.exp
32+
# IDE - Eclipse
33+
.classpath
34+
.project
35+
.settings/
2736

28-
# Shared objects (inc. Windows DLLs)
29-
*.dll
37+
# Dependency directories
38+
node_modules/
39+
vendor/
40+
.bundle/
41+
bower_components/
42+
jspm_packages/
43+
44+
# Virtual environments
45+
.venv/
46+
venv/
47+
env/
48+
ENV/
49+
50+
# Build outputs
51+
dist/
52+
out/
53+
build/
54+
target/
55+
site/
56+
*.o
57+
*.obj
3058
*.so
31-
*.so.*
59+
*.dll
3260
*.dylib
61+
*.class
62+
*.pyc
63+
__pycache__/
64+
*.py[cod]
65+
*$py.class
66+
*.pyo
67+
*.egg-info/
68+
*.egg
69+
.eggs/
3370

34-
# Executables
35-
*.exe
36-
*.out
37-
*.app
38-
*.i*86
39-
*.x86_64
40-
*.hex
71+
# Logs
72+
logs/
73+
*.log
74+
npm-debug.log*
75+
yarn-debug.log*
76+
yarn-error.log*
77+
pip-log.txt
78+
pip-delete-this-directory.txt
4179

42-
# Neovim
43-
.DS_Store
44-
**/doc/tags
45-
**/doc/tags-*
80+
# Runtime data
81+
pids
82+
*.pid
83+
*.seed
84+
*.pid.lock
85+
86+
# Coverage & Test
87+
coverage/
88+
.coverage
89+
htmlcov/
90+
.tox/
91+
.nox/
92+
.hypothesis/
93+
.pytest_cache/
94+
95+
# Environment & Configuration
96+
.env
97+
.env.*
98+
!.env.example
99+
.npmrc
100+
.yarnrc
101+
102+
# Documentation build
103+
docs/_build/
104+
_site/
105+
.docusaurus
106+
107+
# Pre-commit environments
108+
.pre-commit-cache/
109+
.cache/
110+
.cache/pre-commit/
111+
112+
# Misc
113+
temp/
114+
tmp/
115+
.tmp/
116+
.sass-cache/
117+
118+
# Neovim specific
119+
doc/tags
120+
doc/tags-*
121+
122+
# Lua specific
123+
luac.out
124+
*.src.rock
125+
*.zip
126+
*.tar.gz

.markdownlint.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"default": true,
3+
"line-length": false,
4+
"no-duplicate-heading": false,
5+
"no-inline-html": false
6+
}

.pre-commit-config.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-added-large-files
9+
10+
- repo: https://github.com/igorshubovych/markdownlint-cli
11+
rev: v0.34.0
12+
hooks:
13+
- id: markdownlint
14+
name: Check markdown formatting
15+
args: [--config, .markdownlint.json]
16+
17+
- repo: https://github.com/adrienverge/yamllint.git
18+
rev: v1.30.0
19+
hooks:
20+
- id: yamllint
21+
args: [--config-file, .yamllint.yml]
22+
23+
- repo: https://github.com/koalaman/shellcheck-precommit
24+
rev: v0.9.0
25+
hooks:
26+
- id: shellcheck
27+
28+
- repo: local
29+
hooks:
30+
- id: fix-markdown-comprehensive
31+
name: Fix common markdown issues comprehensively
32+
entry: ./scripts/markdown/fix_markdown_comprehensive.sh
33+
language: script
34+
pass_filenames: false
35+
verbose: true
36+
37+
- id: fix-list-numbering
38+
name: Fix ordered list numbering
39+
entry: ./scripts/markdown/fix_list_numbering.sh
40+
language: script
41+
pass_filenames: false
42+
verbose: true
43+
44+
- id: fix-heading-levels
45+
name: Fix markdown heading levels
46+
entry: ./scripts/markdown/fix_heading_levels.sh
47+
language: script
48+
pass_filenames: false
49+
verbose: true
50+
51+
- id: markdownlint-fix
52+
name: Fix remaining markdown issues with markdownlint
53+
entry: bash -c 'markdownlint --fix "**/*.md" --ignore node_modules'
54+
language: system
55+
pass_filenames: false
56+
types: [markdown]
57+
verbose: true

.yamllint.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
extends: default
2+
3+
rules:
4+
line-length: disable
5+
document-start: disable
6+
truthy:
7+
allowed-values: ["true", "false", "yes", "no", "on", "off"]
8+
brackets:
9+
min-spaces-inside: 0
10+
max-spaces-inside: 1
11+
indentation:
12+
spaces: 2
13+
indent-sequences: consistent

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,5 +233,5 @@ make format
233233
---
234234

235235
<div align="center">
236-
<p>Made with ❤️ by <a href="https://github.com/greggh">greggh</a></p>
236+
<p>Made with ❤️ by <a href="https://github.com/greggh">Gregg Housh</a></p>
237237
</div>

0 commit comments

Comments
 (0)