How openmainframeproject/cobol-check works
1. Repository shape
This is a dual-repo project: a Java/Gradle command-line tool at the root, plus a Visual Studio Code extension under vs-code-extension/. The Java tool is the core engine; the VS Code extension is a client/UI wrapper around the same Cobol-check workflow.
2. Primary runtime: Java CLI engine
The main application entrypoint is org.openmainframeproject.cobolcheck.Main. The Java code is organized around feature controllers and workers, suggesting a staged batch pipeline rather than a long-lived service. The build produces a runnable JAR and ZIP distribution (build/libs, build/distributions).
3. End-to-end data flow
The core flow is: read command-line/config → parse Cobol test suites → expand/prepare Cobol sources and copybooks → generate or modify test Cobol → launch external Cobol execution → capture output → format results. The system is built to work on local files and external Cobol toolchains, not to embed a Cobol compiler itself.
4. Input boundary: Cobol sources and .cut test suites
The repository contains real Cobol sample programs under src/main/cobol/ and test suites under src/test/cobol/. The .cut files are the test-suite format that the parser consumes. This is the key domain boundary: plain Cobol source files and Cobol-check test description files enter the pipeline.
5. Test-suite parsing and code generation
The features/testSuiteParser package is the heart of the Cobol-check DSL. It contains the parser, keyword extraction, mock handling, before/after hooks, and generation logic (TestSuiteParser, KeywordExtractor, MockGenerator, CobolGenerator, WhenOtherGenerator, etc.). This subsystem turns test-suite declarations into executable Cobol test code and tracks syntax/semantic errors.
6. Cobol source interpretation and copybook expansion
The features/interpreter and services/cobolLogic packages handle Cobol-specific analysis: line classification, tokenization, replace processing, paragraph/section tracking, numeric field handling, and copybook expansion. The CopybookExpander, Interpreter, and replace/tokenizer classes are critical because Cobol syntax and copybook inclusion materially affect how tests are generated and where assertions can be inserted.
7. Preparation and merge stage
The features/prepareMerge package indicates an intermediate phase that merges or prepares source and generated artifacts before execution. This is where file selection and file-system layout matter, especially for mixed inputs like expanded copybooks, generated test files, and output directories.
8. Execution boundary: external Cobol runtime
Cobol-check does not execute Cobol itself; it shells out through features/launcher. The ProcessLauncher abstraction has platform-specific implementations for Linux and Windows, which is a major architectural boundary. The launcher writes process output and likely invokes GnuCOBOL or another installed Cobol runtime/compiler via scripts such as scripts/linux_gnucobol_run_tests and scripts/windows_gnucobol_run_tests.cmd.
9. Result formatting and reporting
Execution results are transformed into multiple output shapes by the launcher formatter layer: JUnitDto, TableDocumentDto, and formatters for XML, HTML, and text. This is the reporting boundary consumed by CI and by users who need machine-readable test output or human-readable summaries.
10. Configuration, platform, and utility layer
Shared infrastructure lives under services/: config loading, message localization, logging, versioning, platform detection, path/file helpers, and tuple/string helpers. These are cross-cutting concerns that support all stages of the pipeline, especially platform-specific execution and file resolution.
11. VS Code extension architecture
The extension is a separate TypeScript project with a client and server. The client layer handles extension activation, config, launch orchestration, output parsing, and test-tree UI. The server layer provides language-service behavior for .cut files. The extension bundles its own Cobol-check distribution and sample Cobol files under vs-code-extension/Cobol-check/, acting as an integrated front end rather than a thin remote client.
12. Test assets and validation strategy
The repo is heavily test-driven with Java unit/integration tests, approval-test fixtures, and Cobol sample programs. The testfiles/, testsuites/, and src/test/cobol/ directories provide end-to-end scenarios for parsing, generation, mocking, and result formatting. CI workflows in .github/workflows/ and the separate approval scripts show that the architecture is validated across OS/platform boundaries.
13. Important architectural constraint
The project’s main complexity comes from Cobol syntax handling plus cross-platform process execution. For a diagram, the most important boundaries are:
- Cobol-check parser/generator vs. external Cobol toolchain
- Java core vs. VS Code extension
- source/test files vs. generated/expanded artifacts
- platform-neutral logic vs. Windows/Linux launcher implementations
Main entry points: CobolCheckLauncher.ts Ext launcher · TestSuiteParser.java Test parser · InterpreterController.java Cobol interp · ArgumentHandlerController.java Args
Components 23
Java CLI core
Gradle-based Cobol-check engine and packaged runtime
- Main · Java application entrypoint
src/main/java/org/openmainframeproject/cobolcheck/Main.java - Args · Command-line argument handling and environment bootstrap
src/main/java/org/openmainframeproject/cobolcheck/features/argumentHandler/ArgumentHandlerController.java - Test parser · Parses .cut suites, keywords, mocks, hooks, and generation rules
src/main/java/org/openmainframeproject/cobolcheck/features/testSuiteParser/TestSuiteParser.java - Cobol gen · Generates executable Cobol from parsed test-suite declarations
src/main/java/org/openmainframeproject/cobolcheck/features/testSuiteParser/CobolGenerator.java - Cobol interp · Interprets Cobol structure, tokens, paragraphs, and copybooks
src/main/java/org/openmainframeproject/cobolcheck/features/interpreter/InterpreterController.java - Copybook expander · Expands included copybooks and normalizes source layout
src/main/java/org/openmainframeproject/cobolcheck/features/interpreter/CopybookExpander.java - Prepare merge · Selects, prepares, and merges source and generated files before run
src/main/java/org/openmainframeproject/cobolcheck/features/prepareMerge/PrepareMergeController.java - Test runner · Coordinates generation and execution workflow
src/main/java/org/openmainframeproject/cobolcheck/workers/CobolTestRunner.java - Launcher · Launches external Cobol toolchain through OS-specific process launchers
src/main/java/org/openmainframeproject/cobolcheck/features/launcher/LauncherController.java - Formatters · Transforms execution results into JUnit, XML, HTML, table, and text outputs
src/main/java/org/openmainframeproject/cobolcheck/features/launcher/Formatter/Formats/Formatter.java - Cobol writer · Writes generated Cobol artifacts and output files
src/main/java/org/openmainframeproject/cobolcheck/features/writer/WriterController.java - Shared services · Config, platform, logging, messages, paths, and Cobol helpers
src/main/java/org/openmainframeproject/cobolcheck/services/Config.java - OS launchers · Windows and Linux process-launch implementations
src/main/java/org/openmainframeproject/cobolcheck/features/launcher/ProcessLauncher.java - Cobol runtime · External Cobol compiler/runtime invoked by scripts
VS Code extension
TypeScript extension with client and language server
- Extension · Extension activation and UI orchestration
vs-code-extension/client/src/extension.ts - Ext config · Reads and applies Cobol-check extension configuration
vs-code-extension/client/src/services/CobolCheckConfiguration.ts - Ext launcher · Starts Cobol-check runs from the editor
vs-code-extension/client/src/services/CobolCheckLauncher.ts - Input parser · Parses editor input and .cut test tree structure
vs-code-extension/client/src/services/CobolCheckInputParser.ts - Output parser · Parses execution output back into extension views
vs-code-extension/client/src/services/CobolCheckOutputParser.ts - Language server · Server-side support for .cut language features
vs-code-extension/server/src/server.ts - Bundled core · VS Code-bundled Cobol-check distribution, scripts, and sample files
vs-code-extension/Cobol-check
Cobol assets
Sample Cobol sources, test suites, and generated fixtures
- Test suites · .cut suites used to drive parser, generator, and end-to-end scenarios
src/test/cobol - Cobol sources · Sample Cobol programs and copybooks used by the engine
src/main/cobol
Connections 25
- Main → Args: bootstraps · Main delegates startup to argument and environment setup
- Args → Shared services: reads config · Arguments resolve paths, config, platform, and messages
- Args → Test runner: starts flow · CLI dispatches the batch pipeline
- Test runner → Test parser: parses suites · Test suites are turned into executable generation plans
- Test parser → Cobol gen: generates · Parsed DSL drives Cobol test code generation
- Test parser → Cobol writer: emits artifacts · Generated source and intermediate files are written out
- Test runner → Cobol interp: analyzes source · Cobol source is interpreted before generation and insertion
- Cobol interp → Copybook expander: expands includes · Copybooks are resolved and expanded as part of interpretation
- Cobol interp → Shared services: uses helpers · Cobol analysis relies on shared helpers and logic services
- Cobol gen → Prepare merge: prepares run · Generated Cobol is staged with source artifacts
- Prepare merge → Launcher: hands off · Prepared inputs are passed to the execution boundary
- Launcher → OS launchers: platforms · Launcher selects Linux or Windows process implementation
- OS launchers → Cobol runtime: invokes · OS process wrappers call the external Cobol toolchain
- Launcher → Formatters: formats results · Raw execution output is converted into structured reports
- Formatters → Cobol writer: persists output · Formatted reports and artifacts are written to disk
- Test suites → Test parser: input · .cut files are the parser's primary domain input
- Cobol sources → Cobol interp: input · Cobol sources and copybooks enter the interpreter pipeline
- Extension → Ext config: activates · Extension startup loads settings
- Extension → Ext launcher: orchestrates · Extension coordinates run launch and UI updates
- Ext launcher → Input parser: reads input · Editor content and test tree are parsed before launch
- Ext launcher → Output parser: reads output · Execution output is parsed back into extension state
- Ext launcher → Bundled core: uses bundle · The extension runs its packaged Cobol-check distribution
- Bundled core → Cobol runtime: invokes · Bundled scripts shell out to the Cobol runtime
- Language server → Extension: supports UI · Language-server features augment the extension client
- Bundled core → Test suites: ships samples · Bundled distribution includes sample Cobol and .cut files