pre_commit
¶
Configuration for pre-commit.
Data:
Instance of |
Classes:
Represents a pre-commit hook. |
|
|
Represents a repository providing a pre-commit hooks. |
Functions:
|
Construct a URL to a GitHub repository from a username and repository name. |
|
Add configuration for |
-
GITHUB_COM
= URL('https://github.com')¶ Type:
URL
Instance of
apeye.url.URL
that points to the GitHub website.
-
typeddict
Hook
[source]¶ Bases:
dict
Represents a pre-commit hook.
- Required Keys
id (
str
) – Which hook from the repository to use.
- Optional Keys
alias (
str
) – Allows the hook to be referenced using an additional id when using pre-commit run <hookid>.name (
str
) – Override the name of the hook - shown during hook execution.language_version (
str
) – Override the language version for the hook. See https://pre-commit.com/#overriding-language-versionfiles (
str
) – Override the default pattern for files to run on.exclude (
str
) – File exclude pattern.types (
List
[str
]) – Override the default file types to run on. See https://pre-commit.com/#filtering-files-with-types.args (
List
[str
]) – List of additional parameters to pass to the hook.stages (
List
[Literal
['commit'
,'merge-commit'
,'push'
,'prepare-commit-msg'
,'commit-msg'
,'manual'
]]) – Confines the hook to the commit, merge-commit, push, prepare-commit-msg, commit-msg, post-checkout, or manual stage. See https://pre-commit.com/#confining-hooks-to-run-at-certain-stages.additional_dependencies (
List
[str
]) – A list of dependencies that will be installed in the environment where this hook gets run. One useful application is to install plugins for hooks such as eslint.always_run (
bool
) – IfTrue
, this hook will run even if there are no matching files.verbose (
bool
) – IfTrue
, forces the output of the hook to be printed even when the hook passes.log_file (
str
) – If present, the hook output will additionally be written to a file.
-
class
Repo
(repo, rev, hooks)[source]¶ Bases:
object
Represents a repository providing a pre-commit hooks.
Methods:
__eq__
(other)Method generated by attrs for class Repo.
__ge__
(other)Method generated by attrs for class Repo.
__gt__
(other)Method generated by attrs for class Repo.
__le__
(other)Method generated by attrs for class Repo.
__lt__
(other)Method generated by attrs for class Repo.
__ne__
(other)Method generated by attrs for class Repo.
__repr__
()Method generated by attrs for class Repo.
to_dict
()Returns a dictionary representation of the
Repo
.Attributes:
The repository url to git clone from.
The revision or tag to clone at.
-
__eq__
(other)¶ Method generated by attrs for class Repo.
-
__ge__
(other)¶ Method generated by attrs for class Repo.
-
__gt__
(other)¶ Method generated by attrs for class Repo.
-
__le__
(other)¶ Method generated by attrs for class Repo.
-
__lt__
(other)¶ Method generated by attrs for class Repo.
-
__ne__
(other)¶ Method generated by attrs for class Repo.
-
__repr__
()¶ Method generated by attrs for class Repo.
-
-
make_github_url
(username, repository)[source]¶ Construct a URL to a GitHub repository from a username and repository name.
-
make_pre_commit
(repo_path, templates)[source]¶ Add configuration for
pre-commit
.https://github.com/pre-commit/pre-commit
# See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks