summaryrefslogtreecommitdiffstats
path: root/gitlint-core/gitlint/git.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitlint-core/gitlint/git.py')
-rw-r--r--gitlint-core/gitlint/git.py22
1 files changed, 7 insertions, 15 deletions
diff --git a/gitlint-core/gitlint/git.py b/gitlint-core/gitlint/git.py
index 4b292f0..6612a7d 100644
--- a/gitlint-core/gitlint/git.py
+++ b/gitlint-core/gitlint/git.py
@@ -5,13 +5,12 @@ from pathlib import Path
import arrow
from gitlint import shell as sh
+from gitlint.cache import PropertyCache, cache
+from gitlint.exception import GitlintError
# import exceptions separately, this makes it a little easier to mock them out in the unit tests
from gitlint.shell import CommandNotFound, ErrorReturnCode
-from gitlint.cache import PropertyCache, cache
-from gitlint.exception import GitlintError
-
# For now, the git date format we use is fixed, but technically this format is determined by `git config log.date`
# We should fix this at some point :-)
GIT_TIMEFORMAT = "YYYY-MM-DD HH:mm:ss Z"
@@ -22,8 +21,6 @@ LOG = logging.getLogger(__name__)
class GitContextError(GitlintError):
"""Exception indicating there is an issue with the git context"""
- pass
-
class GitNotInstalledError(GitContextError):
def __init__(self):
@@ -46,7 +43,7 @@ def _git(*command_parts, **kwargs):
git_kwargs.update(kwargs)
try:
LOG.debug(command_parts)
- result = sh.git(*command_parts, **git_kwargs) # pylint: disable=unexpected-keyword-arg
+ result = sh.git(*command_parts, **git_kwargs)
# If we reach this point and the result has an exit_code that is larger than 0, this means that we didn't
# get an exception (which is the default sh behavior for non-zero exit codes) and so the user is expecting
# a non-zero exit code -> just return the entire result
@@ -80,7 +77,7 @@ def git_commentchar(repository_path=None):
"""Shortcut for retrieving comment char from git config"""
commentchar = _git("config", "--get", "core.commentchar", _cwd=repository_path, _ok_code=[0, 1])
# git will return an exit code of 1 if it can't find a config value, in this case we fall-back to # as commentchar
- if hasattr(commentchar, "exit_code") and commentchar.exit_code == 1: # pylint: disable=no-member
+ if hasattr(commentchar, "exit_code") and commentchar.exit_code == 1:
commentchar = "#"
return commentchar.replace("\n", "")
@@ -174,11 +171,6 @@ class GitChangedFileStats:
def __str__(self) -> str:
return f"{self.filepath}: {self.additions} additions, {self.deletions} deletions"
- def __repr__(self) -> str:
- return (
- f'GitChangedFileStats(filepath="{self.filepath}", additions={self.additions}, deletions={self.deletions})'
- )
-
class GitCommit:
"""Class representing a git commit.
@@ -193,7 +185,7 @@ class GitCommit:
message,
sha=None,
date=None,
- author_name=None, # pylint: disable=too-many-arguments
+ author_name=None,
author_email=None,
parents=None,
changed_files_stats=None,
@@ -289,7 +281,7 @@ class LocalGitCommit(GitCommit, PropertyCache):
startup time and reduces gitlint's memory footprint.
"""
- def __init__(self, context, sha): # pylint: disable=super-init-not-called
+ def __init__(self, context, sha):
PropertyCache.__init__(self)
self.context = context
self.sha = sha
@@ -382,7 +374,7 @@ class StagedLocalGitCommit(GitCommit, PropertyCache):
information.
"""
- def __init__(self, context, commit_message): # pylint: disable=super-init-not-called
+ def __init__(self, context, commit_message):
PropertyCache.__init__(self)
self.context = context
self.message = commit_message