hyper-tuner/hyper-tuner-cloud

View on GitHub
src/components/CommandPalette.tsx

Summary

Maintainability
F
3 days
Test Coverage

File CommandPalette.tsx has 371 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  CarOutlined,
  CloudUploadOutlined,
  FundOutlined,
  InfoCircleOutlined,
Severity: Minor
Found in src/components/CommandPalette.tsx - About 4 hrs to fix

    Function ActionsProvider has 91 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const ActionsProvider = (props: CommandPaletteProps) => {
      const { config, tune, navigation } = props;
      const navigate = useNavigate();
    
      const generateActions = useCallback(
    Severity: Major
    Found in src/components/CommandPalette.tsx - About 3 hrs to fix

      Function CommandPalette has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const CommandPalette = (props: CommandPaletteProps) => {
        const { children, config, tune, navigation } = props;
        const { logout } = useAuth();
        const navigate = useNavigate();
      
      
      Severity: Major
      Found in src/components/CommandPalette.tsx - About 3 hrs to fix

        Function generateActions has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            (types: MenusType) => {
              const newActions: Action[] = [
                {
                  id: 'InfoAction',
                  section: Sections.TUNE,
        Severity: Major
        Found in src/components/CommandPalette.tsx - About 3 hrs to fix

          Function ActionsProvider has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          const ActionsProvider = (props: CommandPaletteProps) => {
            const { config, tune, navigation } = props;
            const navigate = useNavigate();
          
            const generateActions = useCallback(
          Severity: Minor
          Found in src/components/CommandPalette.tsx - About 2 hrs 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 mapSubMenuItems has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                const mapSubMenuItems = (
                  rootMenuName: string,
                  rootMenu: MenuType,
                  subMenus: Record<string, SubMenuType | GroupMenuType | GroupChildMenuType>,
                  groupMenuName: string | null = null,
          Severity: Minor
          Found in src/components/CommandPalette.tsx - About 1 hr to fix

            Function ResultItem has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              (
                {
                  action,
                  active,
                  currentRootActionId,
            Severity: Minor
            Found in src/components/CommandPalette.tsx - About 35 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

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                    {
                      id: 'DiagnoseAction',
                      section: Sections.DIAGNOSE,
                      name: 'Diagnose',
                      subtitle: 'Tooth and composite logs viewer.',
            Severity: Major
            Found in src/components/CommandPalette.tsx and 2 other locations - About 1 hr to fix
            src/components/CommandPalette.tsx on lines 213..222
            src/components/CommandPalette.tsx on lines 223..232

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 69.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                    {
                      id: 'LogsAction',
                      section: Sections.LOG,
                      name: 'Logs',
                      subtitle: 'Log viewer.',
            Severity: Major
            Found in src/components/CommandPalette.tsx and 2 other locations - About 1 hr to fix
            src/components/CommandPalette.tsx on lines 213..222
            src/components/CommandPalette.tsx on lines 233..242

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 69.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                    {
                      id: 'InfoAction',
                      section: Sections.TUNE,
                      name: 'Info',
                      subtitle: 'Basic information about this tune.',
            Severity: Major
            Found in src/components/CommandPalette.tsx and 2 other locations - About 1 hr to fix
            src/components/CommandPalette.tsx on lines 223..232
            src/components/CommandPalette.tsx on lines 233..242

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 69.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

                {
                  id: 'SignUpAction',
                  section: Sections.AUTH,
                  name: 'Sign-up',
                  subtitle: 'Create new account.',
            Severity: Major
            Found in src/components/CommandPalette.tsx and 3 other locations - About 1 hr to fix
            src/components/CommandPalette.tsx on lines 329..338
            src/components/CommandPalette.tsx on lines 345..354
            src/components/CommandPalette.tsx on lines 355..364

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

                {
                  id: 'UploadAction',
                  section: Sections.NAVIGATION,
                  name: 'Upload',
                  subtitle: 'Upload tune and logs.',
            Severity: Major
            Found in src/components/CommandPalette.tsx and 3 other locations - About 1 hr to fix
            src/components/CommandPalette.tsx on lines 329..338
            src/components/CommandPalette.tsx on lines 355..364
            src/components/CommandPalette.tsx on lines 365..374

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

                {
                  id: 'LoginAction',
                  section: Sections.AUTH,
                  name: 'Login',
                  subtitle: 'Login using email, Google or GitHub account.',
            Severity: Major
            Found in src/components/CommandPalette.tsx and 3 other locations - About 1 hr to fix
            src/components/CommandPalette.tsx on lines 329..338
            src/components/CommandPalette.tsx on lines 345..354
            src/components/CommandPalette.tsx on lines 365..374

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

                {
                  id: 'HubAction',
                  section: Sections.NAVIGATION,
                  name: 'Hub',
                  subtitle: 'Public tunes and logs.',
            Severity: Major
            Found in src/components/CommandPalette.tsx and 3 other locations - About 1 hr to fix
            src/components/CommandPalette.tsx on lines 345..354
            src/components/CommandPalette.tsx on lines 355..364
            src/components/CommandPalette.tsx on lines 365..374

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

            const mapStateToProps = (state: AppState) => ({
              config: state.config,
              tune: state.tune,
              ui: state.ui,
              navigation: state.navigation,
            Severity: Major
            Found in src/components/CommandPalette.tsx and 3 other locations - About 55 mins to fix
            src/components/Tune/SideBar.tsx on lines 61..66
            src/pages/Logs.tsx on lines 62..67
            src/pages/Tune.tsx on lines 12..17

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 54.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            There are no issues that match your filters.

            Category
            Status