RM007#

class src.ansys.pre_commit_hooks.quality_rules.readme.RM007#

Bases: README

README has a license section.

Requires a heading that contains license or licence. Either a Markdown # heading or an underlined reStructuredText heading is accepted. The word in body text, or in a badge URL, does not count.

Notes

  • A missing heading produces an error, including when there is no README file.

Overview#

check

Return whether the README has a license heading.

Import detail#

from src.ansys.pre_commit_hooks.quality_rules.readme import RM007

Method detail#

static RM007.check(repository_root: pathlib.Path, readme_file: str | None) → ansys.pre_commit_hooks.quality_rules.common.RuleCheckResult#

Return whether the README has a license heading.

Parameters:
repository_rootpathlib.Path

Repository root directory.

readme_filestr or None

Name of the detected README file, or None if there is none.

Returns:
bool or str

True if the heading exists, False otherwise, or an "ERROR: ..." message if the README cannot be read.