Showing 2,441 of 6,157 total issues
Function validateForm
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
export const validateForm = async (
form: FormInstance<NativeFiltersForm>,
currentFilterId: string,
setCurrentFilterId: Function,
) => {
- 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 Select
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
export default function Select<VT extends string | number>({
creatable,
onSearch,
dropdownMatchSelectWidth = false,
minWidth = '100%',
- 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 rows
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const rows = data.map((entry, i) => {
const values = groups.map(
(
group,
j, // group names
Function applyYAxisBounds
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const applyYAxisBounds = () => {
if (
chart.yDomain &&
Array.isArray(yAxisBounds) &&
yAxisBounds.length === 2
Function valueCells
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const valueCells = visibleColKeys.map(colKey => {
const flatColKey = flatKey(colKey);
const agg = pivotData.getAggregator(rowKey, colKey);
const aggValue = agg.value();
Function positionAndPopulate
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function positionAndPopulate(tip, d) {
let t = '<table>';
if (useRichTooltip) {
const nodes = getAncestors(d);
nodes.reverse().forEach(n => {
Function constructor
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(props) {
super(props);
const suppressContextMenu = getChartMetadataRegistry().get(
props.formData.viz_type ?? props.vizType,
)?.suppressContextMenu;
Function render
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { showSelector } = this.state;
return (
<ScopeContainer>
Function renderTrendline
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
renderTrendline(maxHeight: number) {
const { width, trendLineData, echartOptions, refs } = this.props;
// if can't find any non-null values, no point rendering the trendline
if (!trendLineData?.some(d => d[1] !== null)) {
Function buildQuery
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function buildQuery(formData: QueryFormData) {
const { groupby } = formData;
return buildQueryContext(formData, baseQueryObject => {
/* the `pivotOperatorInRuntime` determines how to pivot the dataframe returned from the raw query.
1. If it's a time compared query, there will return a pivoted dataframe that append time compared metrics. for instance:
Function getMemoizedSectionsToRender
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(datasourceType: DatasourceType, controlPanelConfig: ControlPanelConfig) => {
const {
sectionOverrides = {},
controlOverrides,
controlPanelSections = [],
Function updateResource
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(resourceID: number, resource: D, hideToast = false, setLoading = true) => {
// Set loading state
if (setLoading) {
updateState({
loading: true,
Function useDrillByBreadcrumbs
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
useMemo(() => {
// the last breadcrumb is not clickable
const isClickable = (index: number) => index < breadcrumbsData.length - 1;
const isHidden = (breadcumb: DrillByBreadcrumb) =>
ensureIsArray(breadcumb.groupby).length === 0 &&
Function useResultsTableView
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useResultsTableView = (
chartDataResult: QueryData[] | undefined,
datasourceId: string,
canDownload: boolean,
) => {
Function formList
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
orderedFilters.map(id => {
if (!renderedFilters.includes(id)) return null;
const isDivider = id.startsWith(NATIVE_FILTER_DIVIDER_PREFIX);
const isActive = currentFilterId === id;
return (
Function rowRenderer
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
rowRenderer({ index, style }: { index: number; style: React.CSSProperties }) {
const { filteredSlices, selectedSliceIdsSet } = this.state;
const cellData = filteredSlices[index];
const isSelected = selectedSliceIdsSet.has(cellData.slice_id);
Function CollapsibleControl
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const CollapsibleControl = (props: CollapsibleControlProps) => {
const {
checked,
disabled,
title,
Function quantile
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
quantile(q, formatter = usFmt) {
return function ([attr]) {
return function () {
return {
vals: [],
Function sortKeys
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
sortKeys() {
if (!this.sorted) {
this.sorted = true;
const v = (r, c) => this.getAggregator(r, c).value();
switch (this.props.rowOrder) {
Function constructor
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(props) {
super(props);
this.optionsForSelect = this.optionsForSelect.bind(this);
this.onRemoveFilter = this.onRemoveFilter.bind(this);
this.onNewFilter = this.onNewFilter.bind(this);