Showing 142 of 681 total issues
Metric
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Metric(dict):
"""Class representing a metric."""
def __init__(
self,
File gitlab.py
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""GitLab source."""
from pydantic import HttpUrl
from shared_data_model.meta.entity import Color, Entity, EntityAttribute, EntityAttributeType
File SourceEntities.test.js
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { render, screen, waitFor } from "@testing-library/react"
import userEvent from "@testing-library/user-event"
import { DataModel } from "../context/DataModel"
import { SourceEntities } from "./SourceEntities"
File IssueTracker.js
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { func } from "prop-types"
import { useContext, useEffect, useState } from "react"
import { Grid, Header } from "semantic-ui-react"
import { get_report_issue_tracker_options, set_report_issue_tracker_attribute } from "../api/report"
Function MultipleChoiceInput
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function MultipleChoiceInput(props) {
let { allowAdditions, editableLabel, onSearchChange, required, set_value, requiredPermissions, ...otherProps } =
props
const [values, setValues] = useState(props.value || [])
const [searchQuery, setSearchQuery] = useState("")
Function SourceEntityAttribute
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export function SourceEntityAttribute({ entity, entityAttribute }) {
let cellContents = limitTextLength(entity[entityAttribute.key] ?? "")
// See the data model (components/shared_code/src/shared_data_model/meta/entity.py) for possible entity attribute
// types. Note that if entity attribute types are removed old types need to be supported to allow for time travel.
const type = entityAttribute.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 renderMetricDetails
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function renderMetricDetails(stopFilteringAndSorting, connection_error, failLoadingMeasurements) {
measurement_api.get_metric_measurements.mockImplementation(() => {
if (failLoadingMeasurements) {
return Promise.reject(new Error("failed to load measurements"))
} else {
Function ReactionTimes
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ReactionTimes(props) {
return (
<>
<Segment>
<Label attached="top" size="large">
Function groups
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
const groups = Object.values(parameterLayout).map((parameterGroup) => {
const parameterKeys = applicableParameters(allParameters, remainingParameters, parameterGroup, metric)
if (parameterKeys.length === 0) {
return null
}
Function issuePopupContent
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function issuePopupContent(issueStatus) {
let popupContent = <TimeAgoWithDate date={issueStatus.created}>Created</TimeAgoWithDate>
if (issueStatus.updated) {
popupContent = (
<>
Function AppUI
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
export function AppUI({
changed_fields,
dataModel,
email,
handleDateChange,
- 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_based_on_tags
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _include_entity_based_on_tags(self, entity: Entity) -> bool:
"""Return whether to include the entity based on the tags."""
tags = entity["tags"].split(", ")
if tags_to_include := self._parameter("tags_to_include"):
for tag in tags:
- 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 parameter_description
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def parameter_description(parameter: Parameter) -> str:
"""Return the Markdown version of the parameter."""
short_name = parameter.short_name
help_text = " " + parameter.help if parameter.help else ""
if parameter.type in ("single_choice", "multiple_choice"):
- 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 sourceEntitiesHeaders
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function sourceEntitiesHeaders(
entityAttributes,
hideIgnoredEntities,
metricEntities,
setHideIgnoredEntities,
Function renderIssueStatus
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function renderIssueStatus({
connectionError = false,
created = true,
due = false,
issueTrackerMissing = false,
- 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 get_notifications
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_notifications(
self,
reports: list[Report],
measurements: list[Measurement],
most_recent_measurement_seen: datetime,
- 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 popupText
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function popupText(metric, debtEndDateInThePast, allIssuesDone, dataModel) {
const unit = formatMetricScaleAndUnit(metric, dataModel)
const metricDirection = formatMetricDirection(metric, dataModel)
let debtEndDateText = ""
let endDate
- 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 Input
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function Input(props) {
let { editableLabel, label, error, prefix, required, set_value, warning, ...otherProps } = props
const initialValue = props.value || ""
const [value, setValue] = useState(initialValue)
Function source_options
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function source_options(reports, dataModel, currentMetricType, currentMetricUuid) {
const metricSources = dataModel.metrics[currentMetricType].sources
let options = []
reports.forEach((report) => {
Object.values(report.subjects).forEach((subject) => {
Function EditableTextInput
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function EditableTextInput(props) {
let { label, required, set_value, ...otherProps } = props
const initialValue = props.value || ""
const [text, setText] = useState(initialValue)