{"id":15103768,"url":"https://github.com/mdeweerd/logtocheckstyle","last_synced_at":"2026-01-19T12:33:01.313Z","repository":{"id":213199388,"uuid":"733289242","full_name":"mdeweerd/LogToCheckStyle","owner":"mdeweerd","description":"Github Annotations from a regular textual log, or convert to CheckStyle xml output","archived":false,"fork":false,"pushed_at":"2025-11-16T12:24:24.000Z","size":81,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-16T14:22:11.969Z","etag":null,"topics":["annotation-processing","annotation-tool","annotations","checkstyle","checkstyle-reports","github-actions","github-annotations","logging","logs","phpunit","pre-commit","reporting"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdeweerd.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}},"created_at":"2023-12-19T01:56:33.000Z","updated_at":"2025-11-16T12:24:13.000Z","dependencies_parsed_at":"2023-12-26T04:38:27.431Z","dependency_job_id":"33540dad-3c0f-4faf-a4a6-533eda67c413","html_url":"https://github.com/mdeweerd/LogToCheckStyle","commit_stats":{"total_commits":61,"total_committers":1,"mean_commits":61.0,"dds":0.0,"last_synced_commit":"56b9648a1b10378c4ba23c50afb0d09725987320"},"previous_names":["mdeweerd/logtocheckstyle"],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/mdeweerd/LogToCheckStyle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdeweerd%2FLogToCheckStyle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdeweerd%2FLogToCheckStyle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdeweerd%2FLogToCheckStyle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdeweerd%2FLogToCheckStyle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdeweerd","download_url":"https://codeload.github.com/mdeweerd/LogToCheckStyle/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdeweerd%2FLogToCheckStyle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28567896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T08:53:44.001Z","status":"ssl_error","status_checked_at":"2026-01-19T08:52:40.245Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["annotation-processing","annotation-tool","annotations","checkstyle","checkstyle-reports","github-actions","github-annotations","logging","logs","phpunit","pre-commit","reporting"],"created_at":"2024-09-25T19:41:59.700Z","updated_at":"2026-01-19T12:33:01.302Z","avatar_url":"https://github.com/mdeweerd.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Log2CheckStyle\n\nConvert a log to another format for easy integration with GitHub Actions,\ncontinuous integration pipelines and other purposes.\n\n## Features\n\n- Converts messages to Checkstyle XML format.\n- Supports specifying input and output files.\n- Allows specifying a root directory to remove from file paths.\n- Provides options for GitHub Action integration (annotations).\n- Handful as a standalone command-line tool (`logToCs.py`).\n\n## Usage\n\n### Command Line Interface\n\n```bash\nlogToCs.py [OPTIONS] [INPUT [OUTPUT]]\n```\n\n#### OPTIONS\n\n```text\nConvert messages to Checkstyle XML format.\n\npositional arguments:\n  input                 Input file. Use '-' or omit for stdin.\n  output                Output file. Use '-' or omit for stdout.\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -i INPUT_NAMED, --in INPUT_NAMED\n                        Input filename. Overrides positional input.\n  -o OUTPUT_NAMED, --out OUTPUT_NAMED\n                        Output filename. Overrides positional output.\n  --root ROOT_PATH      Root directory to remove from file paths. Defaults to\n                        working directory.\n  --github-annotate, --no-github-annotate\n                        Annotate when in Github workflow. (default: False)\n  --gitlab, --no-gitlab\n                        Generate gitlab report (artefact) when in Gitlab workflow. (default: False)\n  --name-only, --no-name-only\n                        Report filenames only. (default: False)\n```\n\n### GitHub Action\n\n#### Using No Extra Resources:\n\n```yaml\n  - name: Convert Raw Log to Checkstyle format (launch action)\n    uses: mdeweerd/logToCheckStyle@v2025.11.2\n    if: ${{ failure() }}\n    with:\n      in: ${{ env.RAW_LOG }}\n      # Out can be omitted if you do not need the xml output\n      out: ${{ env.CS_XML }}\n```\n\nThe above extracts the notifications from the `RAW_LOG`, writes a file in\nCheckStyle format and applies source code annotations for a Github Pull\nRequest.\n\nFor a full example, see\n[the precommit github workflow for this project](.github/workflows/pre-commit.yml).\n\n#### Using local resources\n\nConvert the output from an action to CheckStyle xml and convert that to\nGitHub Annotations using a different action.\n\nThese examples assume that logToCs.py is available as .github/logToCs.py.\n\n##### Example 1:\n\nUse other action to generate the GitHub annotations.\n\n```yaml\n  - run: |\n      pre-commit run -all-files | tee pre-commit.log\n      .github/logToCs.py pre-commit.log pre-commit.xml\n  - uses: staabm/annotate-pull-request-from-checkstyle-action@v1\n    with:\n      files: pre-commit.xml\n      notices-as-warnings: true     # optional\n```\n\n##### Example 2 (old):\n\nUse cs2pr commands to generate the GitHub annotations.\n\n```yaml\n  - run: |\n      pre-commit run --all-files | tee pre-commit.log\n  - name: Add results to PR\n    if: ${{ always() }}\n    run: |\n      .github/logToCs.py pre-commit.log | cs2pr\n```\n\n## Tips\n\n### PHP Codesniffer (AKA php-cs, phpcs)\n\nUse `--report=emacs` (when running with `pre-commit`).\n\n### Edit files that have notices from the CLI.\n\nWhen running a command on the CLI, it may be helpful to edit only files\nwith errors.\n\nFor instance, codespell reports:\n\n```bash\ncodespell\n./ChangeLog:8244: abadword ==\u003e agoodword\n```\n\nAnd you want to edit the ChangeLog to make the correction.\n\nWith the bash function below it is possible to edit the reported files\nusing `viErrors codespell`.\n\n`logToCs.py` must be in your path.\n\n## Add to .bashrc:\n\n```bash\nviErrors() { \"$EDITOR\" $(\"$@\" |\u0026 logToCs.py --name-only) ; }\n_viErrors_completion() { COMPREPLY=($(compgen -c -- \"${COMP_WORDS[COMP_CWORD]}\")); return 0; }\ncomplete -o default -F _viErrors_completion viErrors\n```\n\n## or, add in completions directory\n\nExecute the following once and everything code will be loaded when you type\n`viErrors....\u003cTAB\u003e`\n\n```bash\n_cdir=${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions\nmkdir -p \"${_cdir}\"\ncat \u003e \"${_cdir}/viErrors.bash\" \u003c\u003c 'EOF'\nviErrors() { \"$EDITOR\" $(\"$@\" |\u0026 logToCs.py --name-only) ; }\n_viErrors_completion() { COMPREPLY=($(compgen -c -- \"${COMP_WORDS[COMP_CWORD]}\")); return 0; }\ncomplete -o default -F _viErrors_completion viErrors\nEOF\n```\n\n## Extending\n\nIn the script, patterns can be added to \"PATTERNS\" to match more messages.\n\nTo allow multiline patterns, the python module 'regex' is required.\n\n## Author(s):\n\n- [mdeweerd]\n\n## License\n\nMIT License\n\n[mdeweerd]: https://github.com/mdeweerd\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdeweerd%2Flogtocheckstyle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdeweerd%2Flogtocheckstyle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdeweerd%2Flogtocheckstyle/lists"}