{"id":50614566,"url":"https://github.com/algodesigner/eclipse-format","last_synced_at":"2026-06-06T07:02:34.267Z","repository":{"id":340779733,"uuid":"1167557297","full_name":"algodesigner/eclipse-format","owner":"algodesigner","description":"eclipse-format: A command-line tool for formatting Java code using Eclipse's formatter in headless mode with complete symmetry to Eclipse IDE.","archived":false,"fork":false,"pushed_at":"2026-05-22T17:20:49.000Z","size":100,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-22T20:57:53.836Z","etag":null,"topics":["automation","build-tools","ci-cd","cli","code-formatting","code-quality","code-style","developer-tools","eclipse","eclipse-formatter","eclipse-ide","formatter","formatting-tool","gradle","java","java-development","java-formatter","programming-tools","software-quality"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/algodesigner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-26T12:30:04.000Z","updated_at":"2026-05-22T17:20:53.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/algodesigner/eclipse-format","commit_stats":null,"previous_names":["algodesigner/eclipse-format"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/algodesigner/eclipse-format","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algodesigner%2Feclipse-format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algodesigner%2Feclipse-format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algodesigner%2Feclipse-format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algodesigner%2Feclipse-format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/algodesigner","download_url":"https://codeload.github.com/algodesigner/eclipse-format/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algodesigner%2Feclipse-format/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33972398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-06T02:00:07.033Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","build-tools","ci-cd","cli","code-formatting","code-quality","code-style","developer-tools","eclipse","eclipse-formatter","eclipse-ide","formatter","formatting-tool","gradle","java","java-development","java-formatter","programming-tools","software-quality"],"created_at":"2026-06-06T07:02:32.740Z","updated_at":"2026-06-06T07:02:34.253Z","avatar_url":"https://github.com/algodesigner.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Eclipse Formatter CLI\n\nA command-line tool for formatting Java code using Eclipse's code formatter in headless mode. Provides a simple, user-friendly interface for consistent code formatting across projects.\n\n## Features\n\n- 🚀 **Simple CLI interface** - Easy to use with intuitive commands\n- ⚡ **Fast formatting** - Leverages Eclipse's proven formatter engine\n- 🔧 **Customisable** - Use your own Eclipse formatter configuration\n- 📁 **Batch processing** - Format single files or entire directories\n- 🔍 **Dry run mode** - Preview changes before applying\n- 🔄 **Recursive formatting** - Process nested directories\n- 🧪 **Tested** - Comprehensive unit and integration tests\n- 🏗️ **IDE friendly** - Works with Eclipse and IntelliJ IDEA\n\n## 🚀 Quick Installation\n\n### Option 1: One-Command Setup (Easiest \u0026 Recommended)\n```bash\n# Clone and setup in one go\ngit clone https://github.com/algodesigner/eclipse-format.git\ncd eclipse-format\n./setup.sh\n\n# Now use it!\n./eclipse-format --help\n```\n\n### Option 2: Interactive Installer (Full Features)\n```bash\ngit clone https://github.com/algodesigner/eclipse-format.git\ncd eclipse-format\n./install.sh\n\n# Choose from:\n# 1. System-wide installation (requires sudo)\n# 2. Local user installation (~/.local/bin)\n# 3. Standalone script\n# 4. Just build\n```\n\n### Option 3: Universal Wrapper (Smart Auto-Detection)\n```bash\ngit clone https://github.com/algodesigner/eclipse-format.git\ncd eclipse-format\n./gradlew shadowJar\n./eclipse-format.sh --help  # Auto-finds the JAR!\n```\n\n### Option 4: Direct Usage (Simple)\n```bash\ngit clone https://github.com/algodesigner/eclipse-format.git\ncd eclipse-format\n./gradlew shadowJar\njava -jar build/libs/eclipse-format.jar --help\n```\n\n### Option 5: Windows Users\n```batch\ngit clone https://github.com/algodesigner/eclipse-format.git\ncd eclipse-format\ngradlew.bat shadowJar\neclipse-format.bat --help\n```\n\n## Usage\n\n### Basic Usage\n\n```bash\n# Format a single Java file\neclipse-format MyClass.java\n\n# Format all Java files in a directory\neclipse-format src/\n\n# Format recursively\neclipse-format -r src/\n\n# Dry run (show what would change)\neclipse-format -d src/\n\n# Verbose output\neclipse-format -v MyClass.java\n\n# Auto-discover eclipse-format.xml (walks up from target)\neclipse-format MyClass.java\n\n# Use custom configuration file\neclipse-format -c my-formatter.xml MyClass.java\n```\n\n### Command Line Options\n\n```\nUsage: eclipse-format [-cdrv] [-c=\u003cconfigFile\u003e] \u003ctarget\u003e\n      \u003ctarget\u003e            File or directory to format\n  -c, --config=\u003cconfigFile\u003e\n                          Path to Eclipse formatter configuration file.\n                          If not specified, searches for eclipse-format.xml\n                          starting from the target's parent directory and\n                          walking up the directory tree.\n  -d, --dry-run           Show what would be formatted without making changes\n  -r, --recursive         Format files recursively\n  -v, --verbose           Verbose output\n      --help              Show this help message and exit\n      --version           Print version information and exit\n```\n\n### Configuration File\n\nThe tool uses Eclipse's XML formatter configuration files. You can:\n\n1. **Export from Eclipse IDE**: Window → Preferences → Java → Code Style → Formatter → Export...\n2. **Use the default** included in this project (`eclipse-format.xml`)\n3. **Create your own** XML configuration\n\n**Config file resolution:** When `-c` is not specified, the tool searches\nfor `eclipse-format.xml` by walking up the directory tree. The search\nstarts from the target's parent directory (for a file) or the target\ndirectory itself (for a directory), ascending towards the filesystem\nroot. The first `eclipse-format.xml` found is used. Use `-c` to specify\nan exact path and bypass auto-discovery entirely.\n\nPlace `eclipse-format.xml` in your project root and run the tool from\nany subdirectory — it will find it automatically. This matches the\nbehaviour of tools like clang-format.\n\nExample configuration file structure:\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?\u003e\n\u003cprofiles version=\"20\"\u003e\n\u003cprofile kind=\"CodeFormatterProfile\" name=\"My Profile\" version=\"20\"\u003e\n  \u003csetting id=\"org.eclipse.jdt.core.formatter.tabulation.size\" value=\"4\"/\u003e\n  \u003csetting id=\"org.eclipse.jdt.core.formatter.tabulation.char\" value=\"space\"/\u003e\n  \u003c!-- More settings... --\u003e\n\u003c/profile\u003e\n\u003c/profiles\u003e\n```\n\n## Development\n\n### Prerequisites\n\n- Java 15 or higher\n- Gradle 8.5 or higher\n\n### Setup Development Environment\n\n```bash\n# Clone and setup\ngit clone https://github.com/algodesigner/eclipse-format.git\ncd eclipse-format\n\n# Setup for Eclipse\n./gradlew setupEclipse\n\n# Setup for IntelliJ IDEA\n./gradlew setupIntelliJ\n\n# Clean IDE files\n./gradlew cleanIDE\n```\n\n### Build Commands\n\n```bash\n# Build the project\n./gradlew build\n\n# Run tests\n./gradlew test\n\n# Run integration tests\n./gradlew integrationTest\n\n# Create executable JAR\n./gradlew shadowJar\n\n# Run the application\n./gradlew run --args=\"-v MyClass.java\"\n```\n\n### Project Structure\n\n```\neclipse-format/\n├── src/\n│   ├── main/java/com/algodesigner/eclipseformat/cli/\n│   │   ├── EclipseFormatCli.java        # Main CLI entry point\n│   │   └── FormatterService.java        # Core formatting logic\n│   └── test/java/com/algodesigner/eclipseformat/cli/\n│       ├── EclipseFormatCliTest.java    # Unit tests\n│       └── IntegrationTest.java         # Integration tests\n├── eclipse-format.xml                   # Default formatter config\n├── build.gradle                         # Gradle build configuration\n├── gradlew                              # Gradle wrapper\n└── README.md                            # This file\n```\n\n## Examples\n\n### Example 1: Format a Project\n\n```bash\n# Format all Java files (auto-discovers eclipse-format.xml in project root)\neclipse-format -r src/main/java/\n\n# With custom configuration\neclipse-format -c company-style.xml -r src/\n```\n\n### Example 2: Preview Changes\n\n```bash\n# See what files would be formatted\neclipse-format -d -r src/\n\n# Output:\n# [DRY RUN] Would format: src/main/java/com/example/Main.java\n# [DRY RUN] Would format: src/main/java/com/example/Util.java\n```\n\n### Example 3: CI/CD Integration\n\n```bash\n# Check if code is properly formatted (exit code 0 if formatted, 1 if not)\neclipse-format -d -r src/ \u0026\u0026 echo \"Code is properly formatted\"\n```\n\n## Testing\n\nThe project includes comprehensive test coverage:\n\n```bash\n# Run all tests\n./gradlew test\n\n# Run specific test class\n./gradlew test --tests \"EclipseFormatterCliTest\"\n\n# Run integration tests\n./gradlew test --tests \"IntegrationTest\"\n\n# Generate test coverage report\n./gradlew jacocoTestReport\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests for new functionality\n5. Ensure all tests pass\n6. Submit a pull request\n\n### Code Style\n\nPlease ensure your code follows the project's formatting rules:\n```bash\n# Format your code before submitting\n./gradlew run --args=\"src/main/java/\"\n```\n\n## License\n\nThis project is licensed under the BSD 3-Clause License - see the [LICENSE](LICENSE) file for details.\n\n## Uninstalling\n\nEasy removal with the uninstall script:\n\n```bash\n# Interactive uninstall (recommended)\n./uninstall.sh\n\n# Remove everything\n./uninstall.sh --all\n\n# Clean up PATH entries\n./uninstall.sh --clean-path\n```\n\nSee [USAGE.md](USAGE.md) for complete uninstall options.\n\n## Support\n\n- 📖 **Documentation**: [README.md](README.md) and [USAGE.md](USAGE.md)\n- 🐛 **Issues**: Report installation or usage issues\n- 🔧 **Uninstall**: Use `./uninstall.sh` for clean removal\n\n## Acknowledgments\n\n- Built with [Picocli](https://picocli.info/) for CLI parsing\n- Uses Eclipse's Java Development Tools for formatting\n- Inspired by the need for consistent code formatting in CI/CD pipelines\n\n---\n\nMade with ❤️ by [Vlad Shurupov](https://github.com/algodesigner) for clean code everywhere\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falgodesigner%2Feclipse-format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falgodesigner%2Feclipse-format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falgodesigner%2Feclipse-format/lists"}