Showing 126 of 683 total issues
Function SourceEntity
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function SourceEntity({
metric_uuid,
source_uuid,
hide_ignored_entities,
entity,
- 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 add_source_parameter_hash_to_latest_measurement
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def add_source_parameter_hash_to_latest_measurement(database: Database, report) -> int:
"""Add source parameter hashes to the latest measurements. Return the number of measurements changed."""
# Added after Quality-time v5.12.0, see https://github.com/ICTU/quality-time/issues/8736
count = 0
for subject in subjects(report):
- 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_parameters
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def check_parameters(self) -> Self:
"""Check that if the source has a landing URL parameter it also has a URL parameter."""
if "landing_url" in self.parameters and "url" not in self.parameters:
msg = f"Source {self.name} has a landing URL but no URL"
raise ValueError(msg)
- 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 access_parameters
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def access_parameters(
metrics: list[str],
include: dict[str, bool] | None = None,
source_type: str = "",
source_type_format: Literal["", "CSV", "HTML", "JSON", "XML"] = "",
- 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 verify_user
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def verify_user(database: Database, username: str, password: str) -> User:
"""Authenticate the user and return whether they are authorized to login and their email address."""
ldap_config = get_ldap_config(username)
try:
ldap_servers = [Server(ldap_url, get_info=ALL) for ldap_url in ldap_config.get("ldap_urls")]
- 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 hide_credentials
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def hide_credentials(data_model, *reports) -> None:
"""Hide the credentials in the reports. The data model must be passed so hiding also works when time traveling."""
for source in iter_sources(*reports):
for parameter_key in __password_parameter_keys(source, data_model):
source["parameters"][parameter_key] = CREDENTIALS_REPLACEMENT_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 change_source_parameter
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def change_source_parameter( # noqa: PLR0913
Function deltaDescription
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
function deltaDescription(dataModel, metric, scale, delta, improved, oldValue, newValue) {
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__( # noqa: PLR0913
Function datetime_from_parts
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def datetime_from_parts( # noqa: PLR0913
Function EditableTextInput
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function EditableTextInput(props) {
let { label, required, set_value, ...otherProps } = props
const initialValue = props.value || ""
const [text, setText] = useState(initialValue)
- 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_source_configuration
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_source_configuration(self, source_key, configuration) -> None:
"""Check that the metrics listed by the source configuration have the source as supported source."""
for configuration_key, configuration_value in configuration.items():
for metric_key in configuration_value.metrics:
if metric_key not in self.metrics:
- 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 issuePopupContent
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function issuePopupContent(issueStatus) {
let popupContent = <TimeAgoWithDate date={issueStatus.created}>Created</TimeAgoWithDate>
if (issueStatus.updated) {
popupContent = (
<>
- 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 set_source_entity_attribute
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
export function set_source_entity_attribute(metric_uuid, source_uuid, entity_key, attribute, value, reload) {
Function summarizeReportsOnDate
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function summarizeReportsOnDate(reports, measurements, date, tag, hiddenTags, dataModel) {
Function __parse_test_results
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __parse_test_results(self, json) -> Generator:
"""Yield dicts with test result (applicable/incomplete/violations/passes) as key and rules as values."""
if isinstance(json, list):
if json and "tags" in json[0]:
yield {"violations": json} # The items in the list are violated rules
- 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 labelDetails
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function labelDetails(issueStatus, settings) {
let details = [<Label.Detail key="name">{issueStatus.name || "?"}</Label.Detail>]
if (issueStatus.summary && settings.showIssueSummary.value) {
details.push(<Label.Detail key="summary">{issueStatus.summary}</Label.Detail>)
}
- 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 sortMetrics
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function sortMetrics(dataModel, metrics, sortDirection, sortColumn, report, measurements) {
Consider simplifying this complex logical expression. Open
if parameter_info.type == "multiple_choice":
# If the user didn't pick any values, select the default value if any, otherwise select all values:
default_value = parameter_info.default_value
value = self.__parameters.get(parameter_key) or default_value or parameter_info.values or []
# Ensure all values picked by the user are still allowed. Remove any values that are no longer allowed:
Function metricStatusOnDate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export function metricStatusOnDate(metric_uuid, metric, measurements, date, dataModel) {