Showing 2,441 of 6,157 total issues
Function parseResponse
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default async function parseResponse<T extends ParseMethod = 'json'>(
apiPromise: Promise<Response>,
parseMethod?: T,
) {
type ReturnType = T extends 'raw' | null
- 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 buildQueryObject
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default function buildQueryObject<T extends QueryFormData>(
formData: T,
queryFields?: QueryFieldAliases,
): QueryObject {
const {
- 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 ExecutionLog
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function ExecutionLog({
addDangerToast,
addSuccessToast,
isReportEnabled,
}: ExecutionLogProps) {
- 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 push
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
push(record) {
const x = record[attr];
if (['min', 'max'].includes(mode)) {
const coercedValue = Number(x);
if (Number.isNaN(coercedValue)) {
Function getTooltipHtml
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getTooltipHtml(d) {
let html;
if (d.sourceLinks) {
// is node
Function actions.CLONE_QUERY_TO_NEW_TAB
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
[actions.CLONE_QUERY_TO_NEW_TAB]() {
const queryEditor = state.queryEditors.find(
qe => qe.id === state.tabHistory[state.tabHistory.length - 1],
);
const progenitor = {
Function actions.SET_ACTIVE_QUERY_EDITOR
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
[actions.SET_ACTIVE_QUERY_EDITOR]() {
const qeIds = state.queryEditors.map(qe => qe.id);
if (
qeIds.indexOf(action.queryEditor?.id) > -1 &&
state.tabHistory[state.tabHistory.length - 1] !== action.queryEditor.id
Function saveModalReducer
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function saveModalReducer(state = {}, action) {
const actionHandlers = {
[actions.SET_SAVE_CHART_MODAL_VISIBILITY]() {
return { ...state, isVisible: action.isVisible };
},
Function getDerivedStateFromProps
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
static getDerivedStateFromProps(nextProps, state) {
const { hasError, editorMode, markdownSource, undoLength, redoLength } =
state;
const {
component: nextComponent,
Function constructor
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor() {
super({
buildQuery,
controlPanel,
loadChart: () => import('./EchartsSunburst'),
Function extractShowValueIndexes
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function extractShowValueIndexes(
series: SeriesOption[],
opts: {
stack: StackType;
onlyTotal?: boolean;
Function transformProps
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function transformProps(chartProps: ChartProps) {
const { formData, queriesData, width, height } =
chartProps as EventFlowChartProps;
const { allColumnsX, entity, minLeafNodeEventCount } = formData;
const { data } = queriesData[0];
Function sortAndFilterSeries
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function sortAndFilterSeries(
rows: DataRecord[],
xAxis: string,
extraMetricLabels: any[],
sortSeriesType?: SortSeriesType,
Function getLabelContent
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getLabelContent = () => {
const shouldShowTooltip =
(!isDragging &&
typeof label === 'string' &&
tooltipTitle &&
Function mergeFilterBoxToFormData
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const mergeFilterBoxToFormData = (
exploreFormData: QueryFormData,
dashboardFormData: JsonObject,
) => {
const dateColumns = {
Function ButtonGroup
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function ButtonGroup(props: ButtonGroupProps) {
const { className, children } = props;
return (
<div
role="group"
Function renderModal
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const renderModal = async (overrideState: Record<string, any> = {}) => {
const DrillDetailModalWrapper = () => {
const [showModal, setShowModal] = useState(false);
return (
<>
Function handleScroll
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function handleScroll(scroll: string) {
const setupScroll =
scroll === 'SCROLL_TOP' &&
!scrollTopDashboardInterval &&
document.documentElement.scrollTop !== 0;
Function findTabsWithChartsInScopeHelper
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const findTabsWithChartsInScopeHelper = (
dashboardLayout: DashboardLayout,
chartsInScope: number[],
componentId: string,
tabIds: string[],
Function confirmOverwriteField
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const confirmOverwriteField = () => {
if (!alreadyExists.length) return null;
return (
<>