Showing 142 of 681 total issues
Function __calculate_status
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __calculate_status(self, value: str | None) -> Status | None:
"""Determine the status of the measurement."""
target, near_target, debt_target = (
self.get("target"),
self.get("near_target"),
- 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 _include_entity
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _include_entity(self, entity: Entity) -> bool:
"""Return whether the card should be included."""
def card_is_inactive() -> bool:
"""Return whether the card is inactive."""
- 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 post_reports_overview_attribute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def post_reports_overview_attribute(reports_attribute: str, database: Database):
"""Set a reports overview attribute."""
new_value = dict(bottle.request.json)[reports_attribute]
if reports_attribute == "comment" and new_value:
new_value = sanitize_html(new_value)
- 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 match_string_or_regular_expression
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def match_string_or_regular_expression(string: str, strings_and_or_regular_expressions: Collection[str]) -> bool:
"""Return whether the string is equal to one of the strings or matches one of the regular expressions."""
for string_or_regular_expression in strings_and_or_regular_expressions:
if is_regexp(string_or_regular_expression):
if re.match(string_or_regular_expression, string):
- 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 sources
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def sources(report, metric_types: Sequence[str], source_type: str, parameter: str):
"""Yield the sources in the report, filtered by metric type, source type, and parameter."""
for metric in metrics(report, metric_types):
for source in metric.get("sources", {}).values():
if source["type"] == source_type and parameter in source["parameters"]:
- 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 metric_section
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def metric_section(metric_key: str, metric: Metric, level: int) -> str:
"""Return the metric as Markdown section."""
markdown = markdown_header(metric.name, level=level, index=True)
markdown += markdown_paragraph(metric.description)
name = decapitalize(metric.name)
- 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 <StringInput {...parameter_props} error={warning} />
Avoid too many return
statements within this function. Open
return (
<VictoryChart
height={chartHeight}
scale={{ x: "time", y: "linear" }}
style={{
Avoid too many return
statements within this function. Open
return fetch_server_api("get", `changelog/${nr_changes}`)
Avoid too many return
statements within this function. Open
return true
Avoid too many return
statements within this function. Open
return (
<Table className="entities stickyHeader" sortable size="small">
<Table.Header>{headers}</Table.Header>
<Table.Body>{rows}</Table.Body>
</Table>
Avoid too many return
statements within this function. Open
return (
<Message
header="Measurement details not available"
content="There are currently no measurement details available."
/>
Avoid too many return
statements within this function. Open
return <StringInput {...parameter_props} />
Avoid too many return
statements within this function. Open
return <MultipleChoiceInput {...parameter_props} options={dropdownOptions(parameter_values)} />
Avoid too many return
statements within this function. Open
return null
Avoid too many return
statements within this function. Open
return <MultipleChoiceInput {...parameter_props} options={dropdownOptions(parameter_values)} allowAdditions />
Function DashboardCard
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function DashboardCard({ children, onClick, selected, title, titleFirst }) {
const color = selected ? "info.main" : null
const header = (
<CardHeader
title={title}
- 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 showMessage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function showMessage(type, title, description, messageId) {
const hideToasts = registeredURLSearchParams().get("hide_toasts")
if (hideToasts !== "true") {
const toastMessage =
title && description ? (
- 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 check_logos
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_logos(self) -> None:
"""Check that a logo exists for each source and vice versa."""
logos_path = pathlib.Path(__file__).parent.parent / "logos"
for source_type in self.sources:
logo_path = logos_path / f"{source_type}.png"
- 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 ReadOnlyInput
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function ReadOnlyInput({ error, label, placeholder, prefix, required, value, type, unit }) {
return (
<Form.Input
error={error || (required && value === "")}
fluid
- 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"