File check_indices.py
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Reconcile expected indices against live cluster state
Reconciles the state of multiple elasticsearch clusters against the expected
state of multiple wikis. The reconciliation process is accept based. Some
Function explain
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def explain(
self,
problem: Problem,
es_state: Mapping[Tuple[str, str], ElasticsearchState],
) -> Optional[str]:
- 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 accept
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def accept(self, cluster_state: ElasticsearchState) -> Sequence[str]:
# metastore should exist on all cirrussearch clusters
try:
yield cluster_state.aliases['mw_cirrus_metastore']
except KeyError:
- 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 build_config
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_config(parallelism: int) -> Sequence[ClusterToCheck]:
with ThreadPoolExecutor(max_workers=parallelism) as executor:
wiki_state = list(make_all_wiki_state(executor))
accept_all = [
- 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 validate_clusters
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_clusters(clusters: Sequence[ClusterToCheck]) -> Sequence[Problem]:
clusters = list(clusters)
es_states = {
cluster.key: make_elasticsearch_state(cluster)
for cluster in clusters}
- 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 too many return
statements within this function. Open
return "Index on wrong cluster of replica, expected in " + ', '.join(
Avoid too many return
statements within this function. Open
return (
Avoid too many return
statements within this function. Open
return (
Avoid too many return
statements within this function. Open
return 'Duplicate of live index ' + live_index + '. ' + reason