ICTU/quality-time

View on GitHub

Showing 681 of 681 total issues

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
Severity: Minor
Found in components/collector/src/source_collectors/testng/tests.py - About 25 mins to fix

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}
Severity: Minor
Found in components/shared_code/src/shared/model/report.py - About 25 mins to fix

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 = {
        active: active,
        color: activeColor,
Severity: Minor
Found in components/frontend/src/header_footer/SettingsMenuItem.js - About 25 mins to fix

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,
Severity: Minor
Found in components/frontend/src/subject/SubjectTableRow.js - About 25 mins to fix

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 ? (
Severity: Minor
Found in components/frontend/src/widgets/toast.js - About 25 mins to fix

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)
Severity: Minor
Found in components/notifier/src/destinations/ms_teams.py - About 25 mins to fix

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) {
        // We use a triangle because the sort down and up icons are not at the same height
        const iconDirection = sortDirection.equals("ascending") ? "up" : "down"
Severity: Minor
Found in components/frontend/src/header_footer/SettingsPanel.js - About 25 mins to fix

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 MetricSummaryCard has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function MetricSummaryCard({ header, onClick, selected, summary, maxY }) {
    const [boundingBox, ref] = useBoundingBox()
    const animate = { duration: 0, onLoad: { duration: 0 } }
    const colors = STATUSES.map((status) => STATUS_COLORS_RGB[status])
    const labelColor = useContext(DarkMode) ? "darkgrey" : "rgba(120, 120, 120)"
Severity: Minor
Found in components/frontend/src/dashboard/MetricSummaryCard.js - About 25 mins to fix

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) {
    const mockCallback = jest.fn()
    const itemSubtypes = []
    let allItemSubtypes
    if (nrItems < totalItems) {
Severity: Minor
Found in components/frontend/src/widgets/Button.test.js - About 25 mins to fix

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]
Severity: Minor
Found in components/api_server/src/model/transformations.py - About 25 mins to fix

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"
Severity: Minor
Found in components/shared_code/src/shared_data_model/meta/data_model.py - About 25 mins to fix

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 nice_number has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function nice_number(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) {
Severity: Minor
Found in components/frontend/src/utils.js - About 25 mins to fix

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
Severity: Minor
Found in components/frontend/src/subject/SubjectTableRow.js - About 25 mins to fix

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_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.
Severity: Minor
Found in components/collector/src/base_collectors/source_collector.py - About 25 mins to fix

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", {}):
Severity: Minor
Found in components/api_server/src/model/transformations.py - About 25 mins to fix

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,
Severity: Minor
Found in components/api_server/src/model/transformations.py - About 25 mins to fix

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
Severity: Minor
Found in components/frontend/src/fields/ReadOnlyInput.js - About 25 mins to fix

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 latest_report_for_uuids has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def latest_report_for_uuids(all_reports: list[Report], *uuids: ItemId) -> list[Report]:
    """Return the report for given child entity uuids.

    The uuids can be of a report, subject, metric or source.
    The returned results will be in order of provided uuids.
Severity: Minor
Found in components/api_server/src/database/reports.py - About 25 mins to fix

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: Jobs) -> 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

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") {
Severity: Minor
Found in components/frontend/src/widgets/Button.js - About 25 mins to fix

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

Severity
Category
Status
Source
Language