briangann/grafana-datatable-panel

View on GitHub

Showing 12 of 32 total issues

Function config has 164 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const config = async (env): Promise<Configuration> => {
  const baseConfig: Configuration = {
    cache: {
      type: 'filesystem',
      buildDependencies: {
Severity: Major
Found in .config/webpack/webpack.config.ts - About 6 hrs to fix

    Function ColumnAliasesEditor has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function ColumnAliasesEditor(props: StandardEditorProps<ColumnAliasField[]>) {
      const { onChange, value = [] } = props;
      const dataFields = getDataFramesFields(props.context.data);
      const availableFields = dataFields.reduce<SelectableValue[]>((acc, field) => {
        // Filter out fields that already have an alias
    Severity: Major
    Found in src/components/options/ColumnAliasesEditor.tsx - About 2 hrs to fix

      Function ColumnWidthHints has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function ColumnWidthHints(props: StandardEditorProps<ColumnWidthHint[]>) {
        const { onChange, value = [] } = props;
        const dataFields = getDataFramesFields(props.context.data);
        const availableFields = dataFields.reduce<SelectableValue[]>((acc, field) => {
          // Filter out fields that already have an width
      Severity: Major
      Found in src/components/options/ColumnWidthHintsEditor.tsx - About 2 hrs to fix

        Function optionsBuilder has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export async function optionsBuilder(
          builder: PanelOptionsEditorBuilder<SimpleOptions>,
          builderContext: StandardEditorContext<SimpleOptions>
        ) {
          builder.addSelect({
        Severity: Major
        Found in src/components/options/optionsBuilder.tsx - About 2 hrs to fix

          Function ColumnSortingEditor has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function ColumnSortingEditor(props: StandardEditorProps<ColumnSorting[]>) {
            const { onChange, value = [] } = props;
          
            function handleNewColumnSorting() {
              const newIndex = value.length ? Math.max(...value.map((item) => item.index)) + 1 : 0;
          Severity: Major
          Found in src/components/options/ColumnSortingEditor.tsx - About 2 hrs to fix

            Function ColumnStylesEditor has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function ColumnStylesEditor(props: StandardEditorProps<ColumnStyling[]>) {
              const { onChange, value = [] } = props;
            
              // @ts-ignore
              function handleRemoveColumnStyle(index: number) {
            Severity: Minor
            Found in src/components/options/ColumnStylesEditor.tsx - About 1 hr to fix

              Function DataTablePanel has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const DataTablePanel: React.FC<Props> = (props: Props) => {
                const { data, height } = props;
              
                const dataTableId = `data-table-renderer-${props.id}`;
              
              
              Severity: Minor
              Found in src/components/DataTablePanel.tsx - About 1 hr to fix

                Function ColumnAliasesEditor has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                export function ColumnAliasesEditor(props: StandardEditorProps<ColumnAliasField[]>) {
                  const { onChange, value = [] } = props;
                  const dataFields = getDataFramesFields(props.context.data);
                  const availableFields = dataFields.reduce<SelectableValue[]>((acc, field) => {
                    // Filter out fields that already have an alias
                Severity: Minor
                Found in src/components/options/ColumnAliasesEditor.tsx - About 1 hr 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 ColumnWidthHints has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                export function ColumnWidthHints(props: StandardEditorProps<ColumnWidthHint[]>) {
                  const { onChange, value = [] } = props;
                  const dataFields = getDataFramesFields(props.context.data);
                  const availableFields = dataFields.reduce<SelectableValue[]>((acc, field) => {
                    // Filter out fields that already have an width
                Severity: Minor
                Found in src/components/options/ColumnWidthHintsEditor.tsx - About 1 hr 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 currentAliases has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const currentAliases = value.map((alias: ColumnAliasField, index: number) => {
                    const options =
                      alias.name === '' ? availableFields : [...availableFields, { value: alias.name, label: alias.name }];
                    // TODO: fix the styling so all fields align. Currently
                    return (
                Severity: Minor
                Found in src/components/options/ColumnAliasesEditor.tsx - About 1 hr to fix

                  Function config has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const config = async (env): Promise<Configuration> => {
                    const baseConfig: Configuration = {
                      cache: {
                        type: 'filesystem',
                        buildDependencies: {
                  Severity: Minor
                  Found in .config/webpack/webpack.config.ts - About 55 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 ColumnSortingEditor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function ColumnSortingEditor(props: StandardEditorProps<ColumnSorting[]>) {
                    const { onChange, value = [] } = props;
                  
                    function handleNewColumnSorting() {
                      const newIndex = value.length ? Math.max(...value.map((item) => item.index)) + 1 : 0;
                  Severity: Minor
                  Found in src/components/options/ColumnSortingEditor.tsx - About 55 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