java-functional-lsp 0.1.0__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.1.0/.github/CODEOWNERS +2 -0
- java_functional_lsp-0.1.0/.github/ISSUE_TEMPLATE/bug-report.md +42 -0
- java_functional_lsp-0.1.0/.github/ISSUE_TEMPLATE/feature-request.md +31 -0
- java_functional_lsp-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +17 -0
- java_functional_lsp-0.1.0/.github/SECURITY.md +24 -0
- java_functional_lsp-0.1.0/.github/dependabot.yml +21 -0
- java_functional_lsp-0.1.0/.github/release-drafter.yml +28 -0
- java_functional_lsp-0.1.0/.github/workflows/publish.yml +26 -0
- java_functional_lsp-0.1.0/.github/workflows/release-drafter.yml +19 -0
- java_functional_lsp-0.1.0/.github/workflows/stale.yml +31 -0
- java_functional_lsp-0.1.0/.github/workflows/test.yml +36 -0
- java_functional_lsp-0.1.0/.gitignore +18 -0
- java_functional_lsp-0.1.0/CONTRIBUTING.md +55 -0
- java_functional_lsp-0.1.0/LICENSE +21 -0
- java_functional_lsp-0.1.0/PKG-INFO +127 -0
- java_functional_lsp-0.1.0/README.md +99 -0
- java_functional_lsp-0.1.0/pyproject.toml +89 -0
- java_functional_lsp-0.1.0/src/java_functional_lsp/__init__.py +3 -0
- java_functional_lsp-0.1.0/src/java_functional_lsp/analyzers/__init__.py +1 -0
- java_functional_lsp-0.1.0/src/java_functional_lsp/analyzers/base.py +112 -0
- java_functional_lsp-0.1.0/src/java_functional_lsp/analyzers/exception_checker.py +63 -0
- java_functional_lsp-0.1.0/src/java_functional_lsp/analyzers/mutation_checker.py +152 -0
- java_functional_lsp-0.1.0/src/java_functional_lsp/analyzers/null_checker.py +70 -0
- java_functional_lsp-0.1.0/src/java_functional_lsp/analyzers/spring_checker.py +84 -0
- java_functional_lsp-0.1.0/src/java_functional_lsp/server.py +145 -0
- java_functional_lsp-0.1.0/tests/__init__.py +0 -0
- java_functional_lsp-0.1.0/tests/conftest.py +28 -0
- java_functional_lsp-0.1.0/tests/test_config.py +33 -0
- java_functional_lsp-0.1.0/tests/test_exception_checker.py +46 -0
- java_functional_lsp-0.1.0/tests/test_mutation_checker.py +96 -0
- java_functional_lsp-0.1.0/tests/test_null_checker.py +60 -0
- java_functional_lsp-0.1.0/tests/test_spring_checker.py +44 -0
- java_functional_lsp-0.1.0/uv.lock +602 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug Report
|
|
3
|
+
about: Report a bug in java-functional-lsp
|
|
4
|
+
title: ""
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Describe the bug
|
|
10
|
+
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
## To reproduce
|
|
14
|
+
|
|
15
|
+
Steps to reproduce the behavior:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Example: what Java code triggers the issue?
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Expected behavior
|
|
22
|
+
|
|
23
|
+
What you expected to happen.
|
|
24
|
+
|
|
25
|
+
## Actual behavior
|
|
26
|
+
|
|
27
|
+
What actually happened. Include the full diagnostic output if applicable:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
<paste output here>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Environment
|
|
34
|
+
|
|
35
|
+
- **java-functional-lsp version**: (`pip show java-functional-lsp`)
|
|
36
|
+
- **Python version**: (`python --version`)
|
|
37
|
+
- **OS**: (e.g., macOS 14.2, Ubuntu 22.04)
|
|
38
|
+
- **Editor/LSP client**: (e.g., Claude Code, VS Code)
|
|
39
|
+
|
|
40
|
+
## Additional context
|
|
41
|
+
|
|
42
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Request
|
|
3
|
+
about: Suggest a new rule or improvement
|
|
4
|
+
title: ""
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Problem
|
|
10
|
+
|
|
11
|
+
A clear description of the problem you're trying to solve. Example: "I want the linter to detect ..."
|
|
12
|
+
|
|
13
|
+
## Proposed solution
|
|
14
|
+
|
|
15
|
+
Describe the rule or improvement:
|
|
16
|
+
|
|
17
|
+
```java
|
|
18
|
+
// Example Java code that should be flagged
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Suggested diagnostic message
|
|
22
|
+
|
|
23
|
+
What should the warning say?
|
|
24
|
+
|
|
25
|
+
## Alternatives considered
|
|
26
|
+
|
|
27
|
+
Any alternative solutions or features you've considered.
|
|
28
|
+
|
|
29
|
+
## Additional context
|
|
30
|
+
|
|
31
|
+
Add any other context, references to functional programming best practices, or examples here.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
## What
|
|
2
|
+
|
|
3
|
+
Brief description of the change.
|
|
4
|
+
|
|
5
|
+
## Why
|
|
6
|
+
|
|
7
|
+
Why is this change needed? Link to any related issues.
|
|
8
|
+
|
|
9
|
+
Closes #
|
|
10
|
+
|
|
11
|
+
## Checklist
|
|
12
|
+
|
|
13
|
+
- [ ] Tests added/updated
|
|
14
|
+
- [ ] `uv run ruff check src/ tests/` passes
|
|
15
|
+
- [ ] `uv run mypy src/` passes
|
|
16
|
+
- [ ] `uv run pytest` passes
|
|
17
|
+
- [ ] Documentation updated (if applicable)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Reporting a Vulnerability
|
|
4
|
+
|
|
5
|
+
If you discover a security vulnerability in java-functional-lsp, please report it responsibly.
|
|
6
|
+
|
|
7
|
+
**Email**: [aviadshiber@gmail.com](mailto:aviadshiber@gmail.com)
|
|
8
|
+
|
|
9
|
+
Please include:
|
|
10
|
+
- Description of the vulnerability
|
|
11
|
+
- Steps to reproduce
|
|
12
|
+
- Potential impact
|
|
13
|
+
|
|
14
|
+
You will receive an acknowledgment within 48 hours and a detailed response within 7 days.
|
|
15
|
+
|
|
16
|
+
## Supported Versions
|
|
17
|
+
|
|
18
|
+
| Version | Supported |
|
|
19
|
+
|---------|-----------|
|
|
20
|
+
| Latest | Yes |
|
|
21
|
+
|
|
22
|
+
## Scope
|
|
23
|
+
|
|
24
|
+
This policy covers the `java-functional-lsp` tool itself.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: "pip"
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: "weekly"
|
|
7
|
+
commit-message:
|
|
8
|
+
prefix: "deps"
|
|
9
|
+
labels:
|
|
10
|
+
- "dependencies"
|
|
11
|
+
open-pull-requests-limit: 10
|
|
12
|
+
|
|
13
|
+
- package-ecosystem: "github-actions"
|
|
14
|
+
directory: "/"
|
|
15
|
+
schedule:
|
|
16
|
+
interval: "weekly"
|
|
17
|
+
commit-message:
|
|
18
|
+
prefix: "ci"
|
|
19
|
+
labels:
|
|
20
|
+
- "ci"
|
|
21
|
+
open-pull-requests-limit: 5
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name-template: "v$RESOLVED_VERSION"
|
|
2
|
+
tag-template: "v$RESOLVED_VERSION"
|
|
3
|
+
categories:
|
|
4
|
+
- title: "New Rules"
|
|
5
|
+
labels: ["rule", "enhancement", "feature"]
|
|
6
|
+
- title: "Bug Fixes"
|
|
7
|
+
labels: ["bug", "fix"]
|
|
8
|
+
- title: "Dependencies"
|
|
9
|
+
labels: ["dependencies"]
|
|
10
|
+
- title: "Documentation"
|
|
11
|
+
labels: ["documentation"]
|
|
12
|
+
- title: "CI/CD"
|
|
13
|
+
labels: ["ci"]
|
|
14
|
+
- title: "Other Changes"
|
|
15
|
+
labels: ["*"]
|
|
16
|
+
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
|
|
17
|
+
version-resolver:
|
|
18
|
+
major:
|
|
19
|
+
labels: ["breaking"]
|
|
20
|
+
minor:
|
|
21
|
+
labels: ["enhancement", "feature", "rule"]
|
|
22
|
+
patch:
|
|
23
|
+
labels: ["bug", "fix", "dependencies"]
|
|
24
|
+
default: patch
|
|
25
|
+
template: |
|
|
26
|
+
## Changes
|
|
27
|
+
$CHANGES
|
|
28
|
+
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
id-token: write
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
publish:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
environment: pypi
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v6
|
|
17
|
+
- name: Set up Python
|
|
18
|
+
uses: actions/setup-python@v6
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.12"
|
|
21
|
+
- name: Install build dependencies
|
|
22
|
+
run: pip install build
|
|
23
|
+
- name: Build package
|
|
24
|
+
run: python -m build
|
|
25
|
+
- name: Publish to PyPI
|
|
26
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
name: Release Drafter
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
types: [opened, reopened, synchronize]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
pull-requests: write
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
update-release-draft:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: release-drafter/release-drafter@v6
|
|
18
|
+
env:
|
|
19
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Stale Issues
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: "0 6 * * 1"
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
issues: write
|
|
9
|
+
pull-requests: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
stale:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/stale@v10
|
|
16
|
+
with:
|
|
17
|
+
stale-issue-message: >
|
|
18
|
+
This issue has been automatically marked as stale because it has not
|
|
19
|
+
had recent activity. It will be closed in 14 days if no further
|
|
20
|
+
activity occurs. If this issue is still relevant, please comment
|
|
21
|
+
to keep it open.
|
|
22
|
+
stale-pr-message: >
|
|
23
|
+
This PR has been automatically marked as stale because it has not
|
|
24
|
+
had recent activity. It will be closed in 14 days if no further
|
|
25
|
+
activity occurs.
|
|
26
|
+
days-before-stale: 60
|
|
27
|
+
days-before-close: 14
|
|
28
|
+
stale-issue-label: "stale"
|
|
29
|
+
stale-pr-label: "stale"
|
|
30
|
+
exempt-issue-labels: "pinned,security"
|
|
31
|
+
exempt-pr-labels: "pinned"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ${{ matrix.os }}
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
os: [ubuntu-latest, macos-latest]
|
|
16
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v6
|
|
19
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
20
|
+
uses: actions/setup-python@v6
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
- name: Install uv
|
|
24
|
+
uses: astral-sh/setup-uv@v7
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: uv sync
|
|
27
|
+
- name: Lint
|
|
28
|
+
run: uv run ruff check src/ tests/
|
|
29
|
+
- name: Format check
|
|
30
|
+
run: uv run ruff format --check src/ tests/
|
|
31
|
+
- name: Type check
|
|
32
|
+
run: uv run mypy src/
|
|
33
|
+
- name: Test
|
|
34
|
+
run: uv run pytest -q
|
|
35
|
+
env:
|
|
36
|
+
NO_COLOR: "1"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Contributing to java-functional-lsp
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
- Python 3.10+
|
|
6
|
+
- [uv](https://docs.astral.sh/uv/) (recommended) or pip
|
|
7
|
+
|
|
8
|
+
## Setup
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
git clone https://github.com/aviadshiber/java-functional-lsp.git
|
|
12
|
+
cd java-functional-lsp
|
|
13
|
+
uv sync
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Making Changes
|
|
17
|
+
|
|
18
|
+
1. Branch from `main` with a descriptive name (e.g., `feat/new-rule`, `fix/false-positive`)
|
|
19
|
+
2. Follow existing code patterns in `src/java_functional_lsp/analyzers/`
|
|
20
|
+
3. Add tests for new rules or behavior changes
|
|
21
|
+
4. Ensure all checks pass before submitting
|
|
22
|
+
|
|
23
|
+
## Pull Request Guidelines
|
|
24
|
+
|
|
25
|
+
- Keep PRs focused — one rule or one fix per PR
|
|
26
|
+
- Write a clear description of what and why
|
|
27
|
+
- All CI checks must pass
|
|
28
|
+
- Maintainer review is required
|
|
29
|
+
|
|
30
|
+
## Code Style
|
|
31
|
+
|
|
32
|
+
- **Ruff** for linting and formatting (line length: 120)
|
|
33
|
+
- **mypy** in strict mode for type checking
|
|
34
|
+
- **pytest** for tests with coverage reporting
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
uv run ruff check src/ tests/
|
|
38
|
+
uv run ruff format src/ tests/
|
|
39
|
+
uv run mypy src/
|
|
40
|
+
uv run pytest
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Adding a New Rule
|
|
44
|
+
|
|
45
|
+
1. Choose the appropriate analyzer in `src/java_functional_lsp/analyzers/`
|
|
46
|
+
2. Add the detection logic using tree-sitter node walking (see `base.py` helpers)
|
|
47
|
+
3. Add the rule ID and message to the module's `_MESSAGES` dict
|
|
48
|
+
4. Add tests in `tests/test_<analyzer>.py`
|
|
49
|
+
5. Update the rules table in `README.md`
|
|
50
|
+
|
|
51
|
+
## Reporting Issues
|
|
52
|
+
|
|
53
|
+
- Use the [bug report template](https://github.com/aviadshiber/java-functional-lsp/issues/new?template=bug-report.md)
|
|
54
|
+
- Use the [feature request template](https://github.com/aviadshiber/java-functional-lsp/issues/new?template=feature-request.md)
|
|
55
|
+
- For security issues, see [SECURITY.md](.github/SECURITY.md)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Aviad S.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: java-functional-lsp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Java LSP server enforcing functional programming best practices — null safety, immutability, no exceptions
|
|
5
|
+
Project-URL: Homepage, https://github.com/aviadshiber/java-functional-lsp
|
|
6
|
+
Project-URL: Repository, https://github.com/aviadshiber/java-functional-lsp
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/aviadshiber/java-functional-lsp/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/aviadshiber/java-functional-lsp/releases
|
|
9
|
+
Author: Aviad S.
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: functional-programming,java,linter,lombok,lsp,tree-sitter,vavr
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: pygls>=1.3.0
|
|
25
|
+
Requires-Dist: tree-sitter-java>=0.23.0
|
|
26
|
+
Requires-Dist: tree-sitter>=0.23.0
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# java-functional-lsp
|
|
30
|
+
|
|
31
|
+
[](https://github.com/aviadshiber/java-functional-lsp/actions/workflows/test.yml)
|
|
32
|
+
[](https://pypi.org/project/java-functional-lsp/)
|
|
33
|
+
[](https://pypi.org/project/java-functional-lsp/)
|
|
34
|
+
[](https://opensource.org/licenses/MIT)
|
|
35
|
+
|
|
36
|
+
A Java Language Server that enforces functional programming best practices. Designed for teams using **Vavr**, **Lombok**, and **Spring** with a functional-first approach.
|
|
37
|
+
|
|
38
|
+
## What it checks
|
|
39
|
+
|
|
40
|
+
| Rule | Detects | Suggests |
|
|
41
|
+
|------|---------|----------|
|
|
42
|
+
| `null-literal-arg` | `null` passed as method argument | `Option.none()` or default value |
|
|
43
|
+
| `null-return` | `return null` | `Option.of()`, `Option.none()`, or `Either` |
|
|
44
|
+
| `null-assignment` | `Type x = null` | `Option<Type>` |
|
|
45
|
+
| `null-field-assignment` | Field initialized to `null` | `Option<T>` with `Option.none()` |
|
|
46
|
+
| `throw-statement` | `throw new XxxException(...)` | `Either.left()` or `Try.of()` |
|
|
47
|
+
| `catch-rethrow` | catch block that wraps + rethrows | `Try.of().toEither()` |
|
|
48
|
+
| `mutable-variable` | Local variable reassignment | Final variables + functional transforms |
|
|
49
|
+
| `imperative-loop` | `for`/`while` loops | `.map()`/`.filter()`/`.flatMap()`/`.foldLeft()` |
|
|
50
|
+
| `mutable-dto` | `@Data` or `@Setter` on class | `@Value` (immutable) |
|
|
51
|
+
| `imperative-option-unwrap` | `if (opt.isDefined()) { opt.get() }` | `map()`/`flatMap()`/`fold()` |
|
|
52
|
+
| `field-injection` | `@Autowired` on field | Constructor injection |
|
|
53
|
+
| `component-annotation` | `@Component`/`@Service`/`@Repository` | `@Configuration` + `@Bean` |
|
|
54
|
+
|
|
55
|
+
## Install
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install java-functional-lsp
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Or from source:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install git+https://github.com/aviadshiber/java-functional-lsp.git
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Usage with Claude Code
|
|
68
|
+
|
|
69
|
+
Install the `deeperdive-java-linter` plugin from the DeeperDive marketplace, which registers this server as a Java LSP.
|
|
70
|
+
|
|
71
|
+
Or manually add to your Claude Code config:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"lspServers": {
|
|
76
|
+
"java-functional": {
|
|
77
|
+
"command": "java-functional-lsp",
|
|
78
|
+
"extensionToLanguage": { ".java": "java" }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Configuration
|
|
85
|
+
|
|
86
|
+
Create `.deeperdive-linter.json` in your project root to customize rules:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"rules": {
|
|
91
|
+
"null-literal-arg": "warning",
|
|
92
|
+
"throw-statement": "info",
|
|
93
|
+
"imperative-loop": "hint",
|
|
94
|
+
"mutable-dto": "off"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Severity levels: `error`, `warning`, `info`, `hint`, `off`.
|
|
100
|
+
All rules default to `warning` when not configured.
|
|
101
|
+
|
|
102
|
+
## How it works
|
|
103
|
+
|
|
104
|
+
Uses [tree-sitter](https://tree-sitter.github.io/) with the Java grammar for fast, incremental AST parsing. No Java compiler or classpath needed — analysis runs on raw source files.
|
|
105
|
+
|
|
106
|
+
The server speaks the Language Server Protocol (LSP) via stdio, making it compatible with any LSP client.
|
|
107
|
+
|
|
108
|
+
## Development
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Clone and setup
|
|
112
|
+
git clone https://github.com/aviadshiber/java-functional-lsp.git
|
|
113
|
+
cd java-functional-lsp
|
|
114
|
+
uv sync
|
|
115
|
+
|
|
116
|
+
# Run checks
|
|
117
|
+
uv run ruff check src/ tests/
|
|
118
|
+
uv run ruff format --check src/ tests/
|
|
119
|
+
uv run mypy src/
|
|
120
|
+
uv run pytest
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for full guidelines.
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
MIT
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# java-functional-lsp
|
|
2
|
+
|
|
3
|
+
[](https://github.com/aviadshiber/java-functional-lsp/actions/workflows/test.yml)
|
|
4
|
+
[](https://pypi.org/project/java-functional-lsp/)
|
|
5
|
+
[](https://pypi.org/project/java-functional-lsp/)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
A Java Language Server that enforces functional programming best practices. Designed for teams using **Vavr**, **Lombok**, and **Spring** with a functional-first approach.
|
|
9
|
+
|
|
10
|
+
## What it checks
|
|
11
|
+
|
|
12
|
+
| Rule | Detects | Suggests |
|
|
13
|
+
|------|---------|----------|
|
|
14
|
+
| `null-literal-arg` | `null` passed as method argument | `Option.none()` or default value |
|
|
15
|
+
| `null-return` | `return null` | `Option.of()`, `Option.none()`, or `Either` |
|
|
16
|
+
| `null-assignment` | `Type x = null` | `Option<Type>` |
|
|
17
|
+
| `null-field-assignment` | Field initialized to `null` | `Option<T>` with `Option.none()` |
|
|
18
|
+
| `throw-statement` | `throw new XxxException(...)` | `Either.left()` or `Try.of()` |
|
|
19
|
+
| `catch-rethrow` | catch block that wraps + rethrows | `Try.of().toEither()` |
|
|
20
|
+
| `mutable-variable` | Local variable reassignment | Final variables + functional transforms |
|
|
21
|
+
| `imperative-loop` | `for`/`while` loops | `.map()`/`.filter()`/`.flatMap()`/`.foldLeft()` |
|
|
22
|
+
| `mutable-dto` | `@Data` or `@Setter` on class | `@Value` (immutable) |
|
|
23
|
+
| `imperative-option-unwrap` | `if (opt.isDefined()) { opt.get() }` | `map()`/`flatMap()`/`fold()` |
|
|
24
|
+
| `field-injection` | `@Autowired` on field | Constructor injection |
|
|
25
|
+
| `component-annotation` | `@Component`/`@Service`/`@Repository` | `@Configuration` + `@Bean` |
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install java-functional-lsp
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Or from source:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install git+https://github.com/aviadshiber/java-functional-lsp.git
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Usage with Claude Code
|
|
40
|
+
|
|
41
|
+
Install the `deeperdive-java-linter` plugin from the DeeperDive marketplace, which registers this server as a Java LSP.
|
|
42
|
+
|
|
43
|
+
Or manually add to your Claude Code config:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"lspServers": {
|
|
48
|
+
"java-functional": {
|
|
49
|
+
"command": "java-functional-lsp",
|
|
50
|
+
"extensionToLanguage": { ".java": "java" }
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Configuration
|
|
57
|
+
|
|
58
|
+
Create `.deeperdive-linter.json` in your project root to customize rules:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"rules": {
|
|
63
|
+
"null-literal-arg": "warning",
|
|
64
|
+
"throw-statement": "info",
|
|
65
|
+
"imperative-loop": "hint",
|
|
66
|
+
"mutable-dto": "off"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Severity levels: `error`, `warning`, `info`, `hint`, `off`.
|
|
72
|
+
All rules default to `warning` when not configured.
|
|
73
|
+
|
|
74
|
+
## How it works
|
|
75
|
+
|
|
76
|
+
Uses [tree-sitter](https://tree-sitter.github.io/) with the Java grammar for fast, incremental AST parsing. No Java compiler or classpath needed — analysis runs on raw source files.
|
|
77
|
+
|
|
78
|
+
The server speaks the Language Server Protocol (LSP) via stdio, making it compatible with any LSP client.
|
|
79
|
+
|
|
80
|
+
## Development
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Clone and setup
|
|
84
|
+
git clone https://github.com/aviadshiber/java-functional-lsp.git
|
|
85
|
+
cd java-functional-lsp
|
|
86
|
+
uv sync
|
|
87
|
+
|
|
88
|
+
# Run checks
|
|
89
|
+
uv run ruff check src/ tests/
|
|
90
|
+
uv run ruff format --check src/ tests/
|
|
91
|
+
uv run mypy src/
|
|
92
|
+
uv run pytest
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for full guidelines.
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
MIT
|