{"id":13501746,"url":"https://github.com/jeanralphaviles/comment_parser","last_synced_at":"2026-01-25T09:37:04.626Z","repository":{"id":37484506,"uuid":"41647032","full_name":"jeanralphaviles/comment_parser","owner":"jeanralphaviles","description":"Python module to extract comments from source code files of various types.","archived":false,"fork":false,"pushed_at":"2025-05-19T21:22:32.000Z","size":82,"stargazers_count":102,"open_issues_count":18,"forks_count":30,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-01-06T06:49:34.409Z","etag":null,"topics":["comment-parser","extract-comments","python"],"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/jeanralphaviles.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}},"created_at":"2015-08-30T23:57:35.000Z","updated_at":"2025-09-23T18:40:16.000Z","dependencies_parsed_at":"2024-01-16T10:50:00.737Z","dependency_job_id":null,"html_url":"https://github.com/jeanralphaviles/comment_parser","commit_stats":{"total_commits":59,"total_committers":6,"mean_commits":9.833333333333334,"dds":"0.18644067796610164","last_synced_commit":"e5b1fa91110416656d0e3d4211b24803acc7baa8"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/jeanralphaviles/comment_parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeanralphaviles%2Fcomment_parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeanralphaviles%2Fcomment_parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeanralphaviles%2Fcomment_parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeanralphaviles%2Fcomment_parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeanralphaviles","download_url":"https://codeload.github.com/jeanralphaviles/comment_parser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeanralphaviles%2Fcomment_parser/sbom","scorecard":{"id":513261,"data":{"date":"2025-08-11","repo":{"name":"github.com/jeanralphaviles/comment_parser","commit":"f3bd0b94b656285bcad934c6d5147594cc51b58d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.1,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":1,"reason":"Found 3/16 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/deploy.yml:1","Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/jeanralphaviles/comment_parser/deploy.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/jeanralphaviles/comment_parser/deploy.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/jeanralphaviles/comment_parser/deploy.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/deploy.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/jeanralphaviles/comment_parser/deploy.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/jeanralphaviles/comment_parser/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/jeanralphaviles/comment_parser/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/jeanralphaviles/comment_parser/test.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/deploy.yml:15","Warn: pipCommand not pinned by hash: .github/workflows/test.yml:16","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/deploy.yml:22"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":3,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'master'","Info: 'force pushes' disabled on branch 'master'","Info: 'branch protection settings apply to administrators' is required to merge on branch 'master'","Warn: could not determine whether codeowners review is allowed","Warn: no status checks found to merge onto branch 'master'","Warn: PRs are not required to make changes on branch 'master'; or we don't have data to detect it.If you think it might be the latter, make sure to run Scorecard with a PAT or use Repo Rules (that are always public) instead of Branch Protection settings"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2025-49 / GHSA-5rjg-fvgr-3xxf"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 24 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T01:07:56.524Z","repository_id":37484506,"created_at":"2025-08-20T01:07:56.524Z","updated_at":"2025-08-20T01:07:56.524Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28750876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T09:00:19.176Z","status":"ssl_error","status_checked_at":"2026-01-25T09:00:04.131Z","response_time":113,"last_error":"SSL_read: 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":["comment-parser","extract-comments","python"],"created_at":"2024-07-31T22:01:48.660Z","updated_at":"2026-01-25T09:37:04.604Z","avatar_url":"https://github.com/jeanralphaviles.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Comment Parser\n\n[![Run Tests](https://github.com/jeanralphaviles/comment_parser/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/jeanralphaviles/comment_parser/actions/workflows/test.yml)\n[![Deploy](https://github.com/jeanralphaviles/comment_parser/actions/workflows/deploy.yml/badge.svg)](https://github.com/jeanralphaviles/comment_parser/actions/workflows/deploy.yml)\n[![PyPI status](https://img.shields.io/pypi/status/comment_parser.svg)](https://pypi.python.org/pypi/comment_parser/)\n[![PyPI version shields.io](https://img.shields.io/pypi/v/comment_parser.svg)](https://pypi.python.org/pypi/comment_parser/)\n[![PyPI license](https://img.shields.io/pypi/l/comment_parser.svg)](https://pypi.python.org/pypi/comment_parser/)\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/comment_parser.svg)](https://pypi.python.org/pypi/comment_parser/)\n\nPython module used to extract comments from source code files of various types.\n\n## Installation\n\n### Prerequisites\n\n* libmagic\n\n### Linux/Unix\n\n```shell\nsudo pip3 install comment_parser\n```\n\n### OSX and Windows\n\nAdditionally, complete the special installation requirements for\n[python-magic](https://github.com/ahupp/python-magic).\n\n## Usage\n\nTo use, simply run:\n\n```python\n\u003e\u003e\u003e from comment_parser import comment_parser\n\u003e\u003e\u003e # Returns a list of comment_parser.parsers.common.Comments\n\u003e\u003e\u003e comment_parser.extract_comments('/path/to/source_file')\n\u003e\u003e\u003e # Or\n\u003e\u003e\u003e comment_parser.extract_comments_from_str('...')\n```\n\n### extract_comments signatures\n\n```python\ndef extract_comments(filename, mime=None):\n    \"\"\"Extracts and returns the comments from the given source file.\n\n    Args:\n        filename: String name of the file to extract comments from.\n        mime: Optional MIME type for file (str). Note some MIME types accepted\n            don't comply with RFC2045. If not given, an attempt to deduce the\n            MIME type will occur.\n    Returns:\n        Python list of parsers.common.Comment in the order that they appear in\n            the source file.\n    Raises:\n        UnsupportedError: If filename is of an unsupported MIME type.\n    \"\"\"\n    pass\n\n\ndef extract_comments_from_str(code, mime=None):\n    \"\"\"Extracts and returns comments from the given source string.\n\n    Args:\n        code: String containing code to extract comments from.\n        mime: Optional MIME type for code (str). Note some MIME types accepted\n            don't comply with RFC2045. If not given, an attempt to deduce the\n            MIME type will occur.\n    Returns:\n        Python list of parsers.common.Comment in the order that they appear in\n            the source code.\n    Raises:\n        UnsupportedError: If code is of an unsupported MIME type.\n    \"\"\"\n    pass\n```\n\n### Comments Interface\n\n```python\nclass Comment(object):\n    \"\"\"Represents comments found in source files.\"\"\"\n    def text(self):\n        \"\"\"Returns the comment's text.\n        Returns:\n            String\n        \"\"\"\n        pass\n\n    def line_number(self):\n        \"\"\"Returns the line number the comment was found on.\n        Returns:\n            Int\n        \"\"\"\n        pass\n\n    def is_multiline(self):\n        \"\"\"Returns whether this comment was a multiline comment.\n        Returns:\n            True if comment was a multiline comment, False if not.\n        \"\"\"\n       pass\n\n    def __str__(self):\n        pass\n\n    def __eq__(self, other):\n        pass\n```\n\n## Development\n\n### Install Dependencies\n\n```shell\npip install -r requirements.txt -r requirements-dev.txt\n```\n\n### Running locally\n\nStart python in the base of repository.\n\n```python\nfrom comment_parser import comment_parser\ncomment_parser.extract_comments('foo.c', mime='text/x-c')\n```\n\n### Running tests\n\n```shell\npython -m pytest\n```\n\n### Running pylint\n\n```shell\npylint comment_parser\n```\n\n### Running formatter\n\n```shell\nyapf -rip .\n```\n\n### Deploying to PyPi\n\n```shell\npython setup.py sdist\ntwine upload dist/*\n```\n\n## Supported Programming Languages\n\n| Language    | Mime String              |\n|------------ |------------------------- |\n| C           | text/x-c                 |\n| C++/C#      | text/x-c++               |\n| Go          | text/x-go                |\n| HTML        | text/html                |\n| Java        | text/x-java-source       |\n| Javascript  | application/javascript   |\n| Python      | text/x-python            |\n| Python      | text/x-script.python     |\n| Ruby        | text/x-ruby              |\n| Shell       | text/x-shellscript       |\n| XML         | text/xml                 |\n\nAnd more to come!\n\n*Check comment_parser.py for corresponding MIME types.*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeanralphaviles%2Fcomment_parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeanralphaviles%2Fcomment_parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeanralphaviles%2Fcomment_parser/lists"}