|
1 | | -# Codewars Solutions |
| 1 | +# Java Algorithms & Reliability Showcase |
2 | 2 |
|
3 | | -[Russian](README.md) |
| 3 | +[Русская версия](README.md) |
4 | 4 |
|
| 5 | +Curated Java reference implementations for deterministic algorithms and stateful validation. The project demonstrates API design, edge-case handling, property-based testing, static analysis, and reproducible CI. |
5 | 6 |
|
6 | | -This repository is a portfolio-grade Java kata workspace focused on deterministic algorithms, reproducible tests, visible quality workflows, readable production code, and bilingual project documentation. |
| 7 | +[](https://github.com/krotname/JavaAlgorithmsShowcase/actions/workflows/maven.yml) |
| 8 | +[](https://github.com/krotname/JavaAlgorithmsShowcase/actions/workflows/quality.yml) |
| 9 | +[](https://github.com/krotname/JavaAlgorithmsShowcase/actions/workflows/codeql-analysis.yml) |
| 10 | +[](https://app.codecov.io/gh/krotname/JavaAlgorithmsShowcase) |
| 11 | +[](https://securityscorecards.dev/viewer/?uri=github.com/krotname/JavaAlgorithmsShowcase) |
| 12 | +[](https://www.bestpractices.dev/projects/13151) |
| 13 | +[](LICENSE) |
| 14 | +[](https://adoptium.net/) |
| 15 | +[](https://junit.org/) |
| 16 | +[](https://maven.apache.org/) |
7 | 17 |
|
8 | | -## Why This Repository Exists |
| 18 | + |
9 | 19 |
|
10 | | -- It demonstrates practical coding and test engineering from problem solving to delivery quality. |
11 | | -- Solutions are organized by difficulty/source: kyu, LeetCode, interview, transactions, and other groups. |
12 | | -- Static checks and tests are visible and runnable in one place. |
| 20 | +## Selected engineering components |
13 | 21 |
|
14 | | -## Repository Map |
| 22 | +| Component | Engineering problem | What it demonstrates | |
| 23 | +| --- | --- | --- | |
| 24 | +| [Transaction validation](src/main/java/transactions) | Ordered, stateful operations; cascading invalidation; balance and overflow boundaries | Deterministic state transitions, immutable results, integration scenarios | |
| 25 | +| [Algorithm utilities](src/main/java/algorithms) | Boundary conditions, complexity, stream and file I/O | Deterministic APIs, explicit complexity tradeoffs, edge cases, and property-based invariants | |
| 26 | +| [Parsing / validation](src/main/java/common/SafeParse.java) | Malformed numeric and text input | Explicit contracts, preserved exception causality, unit tests, and static analysis | |
15 | 27 |
|
16 | | -- `src/main/java` - production solutions and domain classes. |
17 | | -- `src/test/java` - tests and quality suites: |
18 | | - - `quality.SmokeSuite` for unit/smoke tests. |
19 | | - - `quality.IntegrationSuite` for transaction scenario tests. |
20 | | - - `quality.PropertySuite` for curated property-based tests. |
21 | | -- `.github` - CI workflows, Dependabot, and repository templates. |
22 | | -- `ARCHITECTURE.md` - architectural and reviewability notes. |
23 | | -- `CHANGELOG.md`, `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`, `SECURITY.md`, `TESTING.md` - project governance. |
| 28 | +This is an engineering demonstration repository, not a commercial product. Implementations are selected to make code quality, test strategy, and the development process directly reviewable. |
24 | 29 |
|
25 | | -## Testing Strategy |
| 30 | +## Verification strategy |
26 | 31 |
|
27 | | -- Smoke/unit tests cover each kata directly and are grouped by `quality.SmokeSuite`. |
28 | | -- Integration tests cover transaction validation state and ordering through `quality.IntegrationSuite`. |
29 | | -- Property-based tests are grouped in `quality.PropertySuite`. |
30 | | -- UI tests are not applicable because this repository has no UI layer. |
31 | | -- Static quality gates include Checkstyle, PMD, and SpotBugs in Maven verify. |
32 | | -- JaCoCo fails `mvn verify` below 70% line, branch, or instruction coverage. |
| 32 | +- **Smoke / unit:** baseline contracts for public APIs. |
| 33 | +- **Integration:** transaction state and ordering, plus algorithm CLI contracts. |
| 34 | +- **Property-based (jqwik):** invariants over broad generated input sets. |
| 35 | +- **Static analysis:** Checkstyle, PMD, and SpotBugs with a zero-new-violation baseline. |
| 36 | +- **Coverage:** JaCoCo fails `mvn verify` below 70% line, branch, or instruction coverage. |
| 37 | +- **Security:** CodeQL, dependency review, and OpenSSF Scorecard. |
| 38 | +- **Reproducibility:** Java 17/21 CI and a strict offline Windows gate after Maven cache priming. |
33 | 39 |
|
34 | | -## CI and Quality Signals |
35 | | - |
36 | | -- `.github/workflows/maven.yml` runs category jobs on JDK 21 and full `mvn verify` on JDK 17 and 21. |
37 | | -- The same workflow validates the strict offline PowerShell gate on Windows after an explicit dependency-prime step. |
38 | | -- `.github/workflows/quality.yml` runs Checkstyle, PMD, and SpotBugs without executing tests. |
39 | | -- `.github/workflows/codeql-analysis.yml` runs security analysis. |
40 | | -- `.github/dependabot.yml` keeps dependency automation visible. |
41 | | - |
42 | | -## Default Branch Governance |
43 | | - |
44 | | -`main` intentionally uses lightweight branch governance. This is a personal educational kata journal where small solution, test, and explanation updates are often pushed directly to keep a fast practice loop. Public quality assurance comes from CI, CodeQL, quality gates, Dependabot, the Security Policy, and reproducible local commands. Substantive changes that affect kata behavior or quality policy still use the normal PR/review workflow. |
45 | | - |
46 | | -The absence of branch protection on `main` is an intentional project-specific exception and should not be treated as a hardening defect. |
47 | | - |
48 | | -## Local Run |
| 40 | +## Local verification |
49 | 41 |
|
50 | 42 | ```bash |
51 | 43 | mvn -B verify |
52 | | -mvn -B test |
53 | 44 | mvn -B test -Dgroups='smoke' |
54 | 45 | mvn -B test -Dgroups='integration' |
55 | 46 | mvn -B test -Dgroups='property' |
56 | 47 | mvn -B -DskipTests checkstyle:check pmd:check spotbugs:check |
57 | | -mvn -B test -Dtest='quality.SmokeSuite' |
58 | | -mvn -B test -Dtest='quality.IntegrationSuite' |
59 | | -mvn -B test -Dtest='quality.PropertySuite' |
60 | 48 | ``` |
61 | 49 |
|
62 | | -Run the complete PowerShell gate without network access: |
| 50 | +Run the complete offline gate in PowerShell: |
63 | 51 |
|
64 | 52 | ```powershell |
65 | 53 | .\scripts\run-offline-gate.ps1 |
66 | 54 | ``` |
67 | 55 |
|
68 | | -See [`TESTING.md`](TESTING.md) for strict dependency-cache mode and the documented |
69 | | -cached-JUnit fallback. |
| 56 | +See [TESTING.md](TESTING.md) for the complete test matrix and dependency-cache rules. |
| 57 | + |
| 58 | +## Repository map |
70 | 59 |
|
71 | | -## Reviewer Checklist |
| 60 | +- `src/main/java/transactions` — stateful validation and its transaction domain model. |
| 61 | +- `src/main/java/algorithms` — sorting, graphs, dynamic programming, data structures, and CLI algorithms. |
| 62 | +- `src/main/java/common`, `interview`, `leetcode`, `coderun`, `other`, `kyu*` — utilities and implementations with provenance-preserving layout. |
| 63 | +- `src/test/java/quality` — entry points for smoke, integration, and property suites. |
| 64 | +- `.github/workflows` — CI, quality gates, CodeQL, dependency review, and supply-chain checks. |
| 65 | +- [ARCHITECTURE.md](ARCHITECTURE.md), [TESTING.md](TESTING.md), and [SECURITY.md](SECURITY.md) — architecture, test strategy, and security policy. |
72 | 66 |
|
73 | | -- No hidden mutation of test inputs inside algorithmic methods. |
74 | | -- Meaningful method-level comments in non-obvious logic. |
75 | | -- Deterministic edge-case handling in boundary tests. |
76 | | -- Governance artifacts for maintainability and process. |
| 67 | +## Sources & provenance |
77 | 68 |
|
78 | | -## Local Quality Policy |
| 69 | +Problems and APIs come from several sources: Codewars, LeetCode, Yandex algorithm tracks, CodeRun, interview tasks, and standalone exercises. Links to original statements and compatible signatures remain in the code where they help verification. |
79 | 70 |
|
80 | | -- Use ASCII-only patch style unless a file already contains another script. |
81 | | -- Keep public method behavior deterministic. |
82 | | -- Add or adjust tests for changed branch behavior. |
83 | | -- Keep comments close to complex algorithmic logic. |
| 71 | +The `kyu*` packages are retained as internal provenance and compatibility structure. They are not the project's primary taxonomy; the showcase is organized around engineering problems, contracts, and test strategy. |
0 commit comments