java-functional-lsp 0.4.1__tar.gz → 0.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- java_functional_lsp-0.4.2/.githooks/pre-commit +21 -0
- java_functional_lsp-0.4.2/.githooks/pre-push +19 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/PKG-INFO +31 -6
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/README.md +30 -5
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/SKILL.md +9 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/editors/vscode/package-lock.json +485 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/pyproject.toml +2 -1
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/src/java_functional_lsp/__init__.py +1 -1
- java_functional_lsp-0.4.2/src/java_functional_lsp/__main__.py +5 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/src/java_functional_lsp/server.py +19 -18
- java_functional_lsp-0.4.2/tests/test_e2e.py +351 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/uv.lock +15 -1
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/.claude-plugin/plugin.json +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/.github/CODEOWNERS +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/.github/ISSUE_TEMPLATE/bug-report.md +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/.github/ISSUE_TEMPLATE/feature-request.md +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/.github/SECURITY.md +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/.github/dependabot.yml +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/.github/release-drafter.yml +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/.github/workflows/publish.yml +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/.github/workflows/release-drafter.yml +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/.github/workflows/stale.yml +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/.github/workflows/test.yml +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/.github/workflows/update-homebrew.yml +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/.github/workflows/vscode-ext.yml +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/.gitignore +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/CONTRIBUTING.md +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/LICENSE +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/commands/lint-java.md +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/editors/intellij/README.md +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/editors/intellij/lsp4ij-template.json +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/editors/vscode/.vscodeignore +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/editors/vscode/README.md +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/editors/vscode/package.json +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/editors/vscode/src/extension.ts +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/editors/vscode/tsconfig.json +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/hooks/hooks.json +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/hooks/java_linter_reminder.py +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/scripts/ensure-lsp.sh +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/scripts/generate-formula.py +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/src/java_functional_lsp/analyzers/__init__.py +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/src/java_functional_lsp/analyzers/base.py +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/src/java_functional_lsp/analyzers/exception_checker.py +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/src/java_functional_lsp/analyzers/mutation_checker.py +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/src/java_functional_lsp/analyzers/null_checker.py +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/src/java_functional_lsp/analyzers/spring_checker.py +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/src/java_functional_lsp/cli.py +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/src/java_functional_lsp/proxy.py +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/tests/__init__.py +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/tests/conftest.py +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/tests/test_base.py +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/tests/test_cli.py +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/tests/test_config.py +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/tests/test_exception_checker.py +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/tests/test_mutation_checker.py +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/tests/test_null_checker.py +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/tests/test_proxy.py +0 -0
- {java_functional_lsp-0.4.1 → java_functional_lsp-0.4.2}/tests/test_spring_checker.py +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Pre-commit: run lint, format check, type check, and tests.
|
|
3
|
+
# Bypass with: git commit --no-verify
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
echo "Running pre-commit checks..."
|
|
8
|
+
|
|
9
|
+
echo " Lint..."
|
|
10
|
+
uv run ruff check src/ tests/
|
|
11
|
+
|
|
12
|
+
echo " Format..."
|
|
13
|
+
uv run ruff format --check src/ tests/
|
|
14
|
+
|
|
15
|
+
echo " Type check..."
|
|
16
|
+
uv run mypy src/
|
|
17
|
+
|
|
18
|
+
echo " Tests..."
|
|
19
|
+
uv run pytest -q
|
|
20
|
+
|
|
21
|
+
echo "All checks passed."
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Prevent direct pushes to main/master — all changes must go through PRs.
|
|
3
|
+
|
|
4
|
+
protected_branches=("main" "master")
|
|
5
|
+
current_branch=$(git symbolic-ref --short HEAD 2>/dev/null)
|
|
6
|
+
|
|
7
|
+
for branch in "${protected_branches[@]}"; do
|
|
8
|
+
if [ "$current_branch" = "$branch" ]; then
|
|
9
|
+
echo "ERROR: Direct push to '$branch' is not allowed."
|
|
10
|
+
echo "Create a feature branch and open a pull request instead."
|
|
11
|
+
echo ""
|
|
12
|
+
echo " git checkout -b feat/my-change"
|
|
13
|
+
echo " git push -u origin feat/my-change"
|
|
14
|
+
echo " gh pr create"
|
|
15
|
+
echo ""
|
|
16
|
+
echo "To bypass (emergency only): git push --no-verify"
|
|
17
|
+
exit 1
|
|
18
|
+
fi
|
|
19
|
+
done
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: java-functional-lsp
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: Java LSP server enforcing functional programming best practices — null safety, immutability, no exceptions
|
|
5
5
|
Project-URL: Homepage, https://github.com/aviadshiber/java-functional-lsp
|
|
6
6
|
Project-URL: Repository, https://github.com/aviadshiber/java-functional-lsp
|
|
@@ -126,7 +126,7 @@ Add to `~/.claude/settings.json`:
|
|
|
126
126
|
claude plugin add https://github.com/aviadshiber/java-functional-lsp.git
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
-
This registers the LSP server, adds auto-install hooks, and
|
|
129
|
+
This registers the LSP server, adds auto-install hooks, a PostToolUse hook that reminds Claude to fix violations on every `.java` file edit, and the `/lint-java` command.
|
|
130
130
|
|
|
131
131
|
Or manually add to your Claude Code config:
|
|
132
132
|
|
|
@@ -141,12 +141,32 @@ Or manually add to your Claude Code config:
|
|
|
141
141
|
}
|
|
142
142
|
```
|
|
143
143
|
|
|
144
|
-
**
|
|
144
|
+
**Alternative: project-level `.lsp.json`** — instead of installing the plugin or editing global config, add a `.lsp.json` file at your project root:
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"java-functional": {
|
|
149
|
+
"command": "java-functional-lsp",
|
|
150
|
+
"extensionToLanguage": { ".java": "java" }
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
This is useful for CI environments, containers, or ensuring all team members get the LSP server without individual setup. The `java-functional-lsp` binary must still be installed (`pip install java-functional-lsp` or `brew install aviadshiber/tap/java-functional-lsp`).
|
|
156
|
+
|
|
157
|
+
**Step 3: Nudge Claude to prefer LSP** (recommended):
|
|
158
|
+
|
|
159
|
+
Add to `~/.claude/rules/code-intelligence.md`:
|
|
147
160
|
```markdown
|
|
148
|
-
|
|
149
|
-
|
|
161
|
+
# Code Intelligence
|
|
162
|
+
|
|
163
|
+
Prefer LSP over Grep/Glob/Read for code navigation:
|
|
164
|
+
- goToDefinition / goToImplementation to jump to source
|
|
165
|
+
- findReferences to see all usages across the codebase
|
|
166
|
+
- hover for type info without reading the file
|
|
167
|
+
|
|
168
|
+
After writing or editing code, check LSP diagnostics before
|
|
169
|
+
moving on. Fix any type errors or missing imports immediately.
|
|
150
170
|
```
|
|
151
171
|
|
|
152
172
|
**Troubleshooting:**
|
|
@@ -205,6 +225,7 @@ The server speaks the Language Server Protocol (LSP) via stdio, making it compat
|
|
|
205
225
|
git clone https://github.com/aviadshiber/java-functional-lsp.git
|
|
206
226
|
cd java-functional-lsp
|
|
207
227
|
uv sync
|
|
228
|
+
git config core.hooksPath .githooks
|
|
208
229
|
|
|
209
230
|
# Run checks
|
|
210
231
|
uv run ruff check src/ tests/
|
|
@@ -213,6 +234,10 @@ uv run mypy src/
|
|
|
213
234
|
uv run pytest
|
|
214
235
|
```
|
|
215
236
|
|
|
237
|
+
Git hooks in `.githooks/` enforce quality automatically:
|
|
238
|
+
- **pre-commit** — runs lint, format, type check, and tests before each commit
|
|
239
|
+
- **pre-push** — blocks direct pushes to main (use feature branches + PRs)
|
|
240
|
+
|
|
216
241
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for full guidelines.
|
|
217
242
|
|
|
218
243
|
## License
|
|
@@ -98,7 +98,7 @@ Add to `~/.claude/settings.json`:
|
|
|
98
98
|
claude plugin add https://github.com/aviadshiber/java-functional-lsp.git
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
This registers the LSP server, adds auto-install hooks, and
|
|
101
|
+
This registers the LSP server, adds auto-install hooks, a PostToolUse hook that reminds Claude to fix violations on every `.java` file edit, and the `/lint-java` command.
|
|
102
102
|
|
|
103
103
|
Or manually add to your Claude Code config:
|
|
104
104
|
|
|
@@ -113,12 +113,32 @@ Or manually add to your Claude Code config:
|
|
|
113
113
|
}
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
-
**
|
|
116
|
+
**Alternative: project-level `.lsp.json`** — instead of installing the plugin or editing global config, add a `.lsp.json` file at your project root:
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"java-functional": {
|
|
121
|
+
"command": "java-functional-lsp",
|
|
122
|
+
"extensionToLanguage": { ".java": "java" }
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
This is useful for CI environments, containers, or ensuring all team members get the LSP server without individual setup. The `java-functional-lsp` binary must still be installed (`pip install java-functional-lsp` or `brew install aviadshiber/tap/java-functional-lsp`).
|
|
128
|
+
|
|
129
|
+
**Step 3: Nudge Claude to prefer LSP** (recommended):
|
|
130
|
+
|
|
131
|
+
Add to `~/.claude/rules/code-intelligence.md`:
|
|
119
132
|
```markdown
|
|
120
|
-
|
|
121
|
-
|
|
133
|
+
# Code Intelligence
|
|
134
|
+
|
|
135
|
+
Prefer LSP over Grep/Glob/Read for code navigation:
|
|
136
|
+
- goToDefinition / goToImplementation to jump to source
|
|
137
|
+
- findReferences to see all usages across the codebase
|
|
138
|
+
- hover for type info without reading the file
|
|
139
|
+
|
|
140
|
+
After writing or editing code, check LSP diagnostics before
|
|
141
|
+
moving on. Fix any type errors or missing imports immediately.
|
|
122
142
|
```
|
|
123
143
|
|
|
124
144
|
**Troubleshooting:**
|
|
@@ -177,6 +197,7 @@ The server speaks the Language Server Protocol (LSP) via stdio, making it compat
|
|
|
177
197
|
git clone https://github.com/aviadshiber/java-functional-lsp.git
|
|
178
198
|
cd java-functional-lsp
|
|
179
199
|
uv sync
|
|
200
|
+
git config core.hooksPath .githooks
|
|
180
201
|
|
|
181
202
|
# Run checks
|
|
182
203
|
uv run ruff check src/ tests/
|
|
@@ -185,6 +206,10 @@ uv run mypy src/
|
|
|
185
206
|
uv run pytest
|
|
186
207
|
```
|
|
187
208
|
|
|
209
|
+
Git hooks in `.githooks/` enforce quality automatically:
|
|
210
|
+
- **pre-commit** — runs lint, format, type check, and tests before each commit
|
|
211
|
+
- **pre-push** — blocks direct pushes to main (use feature branches + PRs)
|
|
212
|
+
|
|
188
213
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for full guidelines.
|
|
189
214
|
|
|
190
215
|
## License
|
|
@@ -59,6 +59,10 @@ Create `.java-functional-lsp.json` in your project root:
|
|
|
59
59
|
- `throw-statement`/`catch-rethrow` auto-suppressed in `@Bean` methods
|
|
60
60
|
- `mutable-dto` suggests `@ConstructorBinding` for `@ConfigurationProperties` classes
|
|
61
61
|
|
|
62
|
+
## Automatic Enforcement
|
|
63
|
+
|
|
64
|
+
The plugin includes a PostToolUse hook that fires on every Read/Edit/Write of `.java` files. If diagnostics appear, Claude is prompted to fix them immediately without explanation.
|
|
65
|
+
|
|
62
66
|
## On-Demand Linting
|
|
63
67
|
|
|
64
68
|
Use `/lint-java <path>` to force-run the linter on specific files or directories.
|
|
@@ -81,6 +85,11 @@ LSP support requires `ENABLE_LSP_TOOL=1` in `~/.claude/settings.json`:
|
|
|
81
85
|
{ "env": { "ENABLE_LSP_TOOL": "1" } }
|
|
82
86
|
```
|
|
83
87
|
|
|
88
|
+
For containers or CI, add a `.lsp.json` at the project root instead of installing the plugin:
|
|
89
|
+
```json
|
|
90
|
+
{ "java-functional": { "command": "java-functional-lsp", "extensionToLanguage": { ".java": "java" } } }
|
|
91
|
+
```
|
|
92
|
+
|
|
84
93
|
To nudge Claude to act on diagnostics, add to your project's `CLAUDE.md`:
|
|
85
94
|
```
|
|
86
95
|
After writing or editing Java code, check LSP diagnostics before moving on.
|