File svn_fs.py
has 1015 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2023 Edgewall Software
# Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
# Copyright (C) 2005-2007 Christian Boos <cboos@edgewall.org>
Function get_changes
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def get_changes(self):
"""Retrieve file changes for a given revision.
(wraps ``repos.svn_repos_replay``)
"""
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _read_substitute
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def _read_substitute(self, stream, n):
if n is None:
n = -1
buffer = self.buffer
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_path_history
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def get_path_history(self, path, rev=None, limit=None):
"""Retrieve creation and deletion events that happened on
given `path`.
"""
path = self.normalize_path(path)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
SubversionRepository
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class SubversionRepository(Repository):
"""Repository implementation based on the svn.fs API."""
has_linear_changesets = True
Function get_changes
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def get_changes(self, old_path, old_rev, new_path, new_rev,
ignore_ancestry=0):
"""Determine differences between two arbitrary pairs of paths
and revisions.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_copy_ancestry
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def get_copy_ancestry(self):
"""Retrieve the list of `(path,rev)` copy ancestors of this node.
Most recent ancestor first. Each ancestor `(path, rev)` corresponds
to the path and revision of the source at the time the copy or move
operation was performed.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _get_tags_or_branches
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def _get_tags_or_branches(self, paths):
"""Retrieve known branches or tags."""
for path in self.params.get(paths, []):
if path.endswith('*'):
folder = posixpath.dirname(path)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_history
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def get_history(self, limit=None):
"""Yield change events that happened on this path"""
newer = None # 'newer' is the previously seen history tuple
older = None # 'older' is the currently examined history tuple
pool = Pool(self.pool)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _get_keyword_values
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _get_keyword_values(self, keywords):
if not keywords:
return None
keywords = list(filter(None, self.KEYWORD_SPLIT_RE.split(keywords)))
if not keywords:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _history
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _history(self, path, start, end, pool):
"""`path` is a str path in the scope.
Generator yielding `(path, rev)` pairs, where `path` is a `str`
object. Must start with `(path, created rev)`.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function normalize_rev
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def normalize_rev(self, rev):
"""Take any revision specification and produce a revision suitable
for the rest of the API
"""
if rev is None or isinstance(rev, str) and \
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, path, params, log):
self.log = log
self.pool = Pool()
# note that this should usually not happen (str arg expected)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
if older[0] == path:
# still on the path: 'newer' was an edit
yield newer[0], newer[1], Changeset.EDIT
else:
# the path changed: 'newer' was a copy
Function next_rev
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def next_rev(self, rev, path='', find_initial_rev=False):
"""Return revision immediately following `rev`, eventually below
given `path` or globally.
"""
rev = self.normalize_rev(rev)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_changes
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_changes(self, old_path, old_rev, new_path, new_rev,
Function add_file
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_file(self, path, dir_baton, copyfrom_path, copyfrom_revision,
Function blame_receiver
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def blame_receiver(line_no, revision, author, date, line, pool):
Function add_directory
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_directory(self, path, dir_baton, copyfrom_path, copyfrom_rev,
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, path, rev, repos, pool=None, parent_root=None):
Function _get_changed_revs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _get_changed_revs(self, node_infos):
path_revs = {}
for node, first in node_infos:
path = node.path
revs = []
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __init__
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, path, rev, repos, pool=None, parent_root=None):
self.fs_ptr = repos.fs_ptr
self.scope = repos.scope
self.pool = Pool(pool)
pool = self.pool
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _translate_keyword
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _translate_keyword(self, text, match):
keyword = match.group('keyword')
value = self.keywords.get(keyword)
if value is None:
return text
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_youngest_rev
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_youngest_rev(self):
"""Retrieve the latest revision in the repository.
(wraps ``fs.youngest_rev``)
"""
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _path_within_scope
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _path_within_scope(scope, fullpath):
"""Remove the leading scope from repository paths.
Return `None` if the path is not is scope.
"""
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"