Showing 142 of 681 total issues
Function get_subclass
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_subclass(cls, source_type: str, metric_type: str) -> type["SourceCollector"] | None:
"""Return the subclass registered for the source/metric name.
First try to find a match on both source type and metric type. If no match is found, return the generic
collector for the source type.
- 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 SortColumnMenuItem
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function SortColumnMenuItem({ column, disabled, sortColumn, sortDirection, handleSort, help }) {
let sortIndicator = null
if (sortColumn.equals(column) && sortDirection.value) {
sortIndicator = sortDirection.equals("ascending") ? <ArrowDropDownIcon /> : <ArrowDropUpIcon />
}
- 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 __entities
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __entities(cls, tree: Element, test_results_to_count: list[str]) -> Entities:
"""Transform the test methods into entities."""
# Unfortunately, there's no DTD or XSD for the testng-result.xml format (see
# https://github.com/cbeust/testng/issues/2371), so we have to make some assumptions about elements and
# attributes here. We use element.attribute[key] to access attributes that we assume are mandatory so that we
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def metric_section(metric: MetricNotificationData, report_url: str) -> pymsteams.cardsection:
"""Create a section for a metric status change."""
section = pymsteams.cardsection()
section.activityTitle(metric.metric_name)
section.activitySubtitle(metric.subject_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
Function DeltaCell
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function DeltaCell({ dateOrderAscending, index, metric, metricValue, previousValue, status }) {
const dataModel = useContext(DataModel)
let label = null
if (index > 0 && previousValue !== "?" && metricValue !== "?" && previousValue !== metricValue) {
// Note that the delta cell only gets content if the previous and current values are both available and unequal
- 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 niceNumber
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function niceNumber(number) {
let rounded_numbers = [10, 12, 15, 20, 30, 50, 75]
do {
for (let rounded_number of rounded_numbers) {
if (number <= (9 * rounded_number) / 10) {
- 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 encrypt_source_credentials
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def encrypt_source_credentials(public_key: str, *reports: dict):
"""Encrypt all source credentials in the reports."""
for source in iter_sources(*reports):
for parameter_key in __password_parameter_keys(source):
password = source["parameters"][parameter_key]
- 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 SubjectTableRow
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function SubjectTableRow({
changed_fields,
dates,
handleSort,
index,
- 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 SourceEntities
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function SourceEntities({ loading, measurements, metric, metric_uuid, reload, report, source_uuid }) {
const dataModel = useContext(DataModel)
const [hideIgnoredEntities, setHideIgnoredEntities] = useState(false)
const [sortColumn, setSortColumn] = useState(null)
const [columnType, setColumnType] = useState("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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def change_source_parameter( # noqa: PLR0913
reports,
items,
parameter_key: str,
old_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 summarize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def summarize(self, measurements: dict[MetricId, list[Measurement]]) -> dict:
"""Create a summary dict of this report."""
summary = dict(self)
summary["summary"] = {"red": 0, "green": 0, "yellow": 0, "grey": 0, "blue": 0, "white": 0}
summary["subjects"] = {subject.uuid: subject.summarize(measurements) for subject in self.subjects}
- 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 ActionAndItemPickerButton
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function ActionAndItemPickerButton({ action, itemType, onChange, get_options, icon }) {
const [options, setOptions] = useState([])
const breadcrumbProps = { report: "report" }
if (itemType !== "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 encrypt_issue_tracker_credentials
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def encrypt_issue_tracker_credentials(public_key: str, *reports: dict):
"""Encrypt all issue tracker credentials in the reports."""
for report in reports:
for secret_attribute in ("password", "private_token"):
if secret_attribute in report.get("issue_tracker", {}).get("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 SettingsMenuItem
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function SettingsMenuItem({ active, children, disabled, disabledHelp, help, onClick, onClickData }) {
// A menu item that can can show help when disabled so users can see why the menu item is disabled
const props = {
disabled: disabled,
onBeforeInput: (event) => {
- 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 ReportDashboard
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function ReportDashboard({ dates, measurements, onClick, onClickTag, reload, report, settings }) {
const dataModel = useContext(DataModel)
const nrMetrics = Math.max(nrMetricsInReport(report), 1)
const subjectCards = []
if (settings.hiddenCards.excludes("subjects")) {
- 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 renderAddDropdownButton
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function renderAddDropdownButton(nrItems = 2, totalItems = 10, usedItemKeys = []) {
const mockCallback = jest.fn()
const itemSubtypes = []
let allItemSubtypes
if (nrItems < totalItems) {
- 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 MeasurementValue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function MeasurementValue({ metric, reportDate }) {
const dataModel = useContext(DataModel)
const metricValue = getMetricValue(metric, dataModel)
let value = metricValue || "?"
const scale = getMetricScale(metric, dataModel)
- 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 remove_test_cases_manual_number
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def remove_test_cases_manual_number(report) -> str:
"""Remove manual number sources from test cases metrics."""
# Added after Quality-time v5.15.0, see https://github.com/ICTU/quality-time/issues/9793
change = ""
for metric in metrics(report, metric_types=("test_cases",)):
- 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_with_branch_parameter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sources_with_branch_parameter(report: dict):
"""Return the sources with a branch parameter."""
for metric in metrics(report, list(METRICS_WITH_SOURCES_WITH_BRANCH_PARAMETER.keys())):
for source in metric.get("sources", {}).values():
if source["type"] in METRICS_WITH_SOURCES_WITH_BRANCH_PARAMETER[metric["type"]]:
- 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 _builds_with_jobs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _builds_with_jobs(self, jobs: Sequence[Job]) -> Iterator[tuple[Build, Job]]:
"""Recursively return the builds and their respective jobs, for all selected jobs."""
for job in self._jobs(jobs):
for build in job.get("builds", []):
if self._include_build(build): # pragma: no cover # can be overridden
- 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"