hyper-tuner/hyper-tuner-cloud

View on GitHub

Showing 212 of 214 total issues

Function UploadPage has 812 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const UploadPage = () => {
  const [form] = useForm<TunesRecord>();
  const routeMatch = useMatch(Routes.UPLOAD_WITH_TUNE_ID);

  const [isLoading, setIsLoading] = useState(false);
Severity: Major
Found in src/pages/Upload.tsx - About 4 days to fix

    File Upload.tsx has 911 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {
      CheckOutlined,
      CopyOutlined,
      EditOutlined,
      EyeOutlined,
    Severity: Major
    Found in src/pages/Upload.tsx - About 2 days to fix

      Function UploadPage has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring.
      Open

      const UploadPage = () => {
        const [form] = useForm<TunesRecord>();
        const routeMatch = useMatch(Routes.UPLOAD_WITH_TUNE_ID);
      
        const [isLoading, setIsLoading] = useState(false);
      Severity: Minor
      Found in src/pages/Upload.tsx - About 1 day 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 2 locations. Consider refactoring.
      Open

                      {
                        label: (
                          <Badge
                            size="small"
                            style={badgeStyle}
      Severity: Major
      Found in src/pages/Logs.tsx and 1 other location - About 1 day to fix
      src/pages/Diagnose.tsx on lines 215..247

      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 232.

      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 2 locations. Consider refactoring.
      Open

                      {
                        label: (
                          <Badge
                            size="small"
                            style={badgeStyle}
      Severity: Major
      Found in src/pages/Diagnose.tsx and 1 other location - About 1 day to fix
      src/pages/Logs.tsx on lines 398..430

      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 232.

      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

      Function Hub has 234 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const Hub = () => {
        const { xs } = useBreakpoint();
        const { searchTunes } = useDb();
        const navigate = useNavigate();
        const [dataSource, setDataSource] = useState<TunesResponse[]>([]);
      Severity: Major
      Found in src/pages/Hub.tsx - About 1 day to fix

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

                    <List.Item
                      actions={[
                        tune.visibility === TunesVisibilityOptions.public ? (
                          <GlobalOutlined />
                        ) : (
        Severity: Major
        Found in src/pages/auth/Profile.tsx and 1 other location - About 1 day to fix
        src/pages/User.tsx on lines 60..92

        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 216.

        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 2 locations. Consider refactoring.
        Open

                  <List.Item
                    actions={[
                      <Button
                        key="show"
                        icon={<ArrowRightOutlined />}
        Severity: Major
        Found in src/pages/User.tsx and 1 other location - About 1 day to fix
        src/pages/auth/Profile.tsx on lines 177..220

        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 216.

        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 2 locations. Consider refactoring.
        Open

                              <div
                                style={
                                  showSingleGraph ? { height: 'calc(100vh - 250px)' } : fieldsSectionStyle
                                }
                              >
        Severity: Major
        Found in src/pages/Logs.tsx and 1 other location - About 1 day to fix
        src/pages/Logs.tsx on lines 375..392

        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 199.

        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 2 locations. Consider refactoring.
        Open

                                  <div style={fieldsSectionStyle}>
                                    <PerfectScrollbar options={{ suppressScrollX: true }}>
                                      <Checkbox.Group onChange={setSelectedFields2} value={selectedFields2}>
                                        {fields.map((field) => (
                                          <Row
        Severity: Major
        Found in src/pages/Logs.tsx and 1 other location - About 1 day to fix
        src/pages/Logs.tsx on lines 344..365

        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 199.

        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

        Function Profile has 197 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const Profile = () => {
          const [formProfile] = Form.useForm();
          const { currentUser, sendEmailVerification, updateUsername, refreshUser } = useAuth();
          const navigate = useNavigate();
          const { getUserTunes } = useDb();
        Severity: Major
        Found in src/pages/auth/Profile.tsx - About 7 hrs to fix

          Function useDb has 175 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const useDb = () => {
            const updateTune = async (id: string, data: TunesRecordPartial): Promise<void> => {
              try {
                await tunesCollection.update(id, data);
                return Promise.resolve();
          Severity: Major
          Found in src/hooks/useDb.ts - About 7 hrs to fix

            File Logs.tsx has 456 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { EditOutlined, FileTextOutlined, GlobalOutlined } from '@ant-design/icons';
            import { DatalogEntry, Logs as LogsType, OutputChannel } from '@hyper-tuner/types';
            import {
              Badge,
              Checkbox,
            Severity: Minor
            Found in src/pages/Logs.tsx - About 6 hrs to fix

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

                const getIni = async (signature: string): Promise<IniFilesResponse | null> => {
                  const response = await fetch(`${customEndpoint}/iniFiles/bySignature/${signature}`);
              
                  if (response.ok) {
                    return response.json() as Promise<IniFilesResponse>;
              Severity: Major
              Found in src/hooks/useDb.ts and 1 other location - About 6 hrs to fix
              src/hooks/useDb.ts on lines 67..82

              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 169.

              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 2 locations. Consider refactoring.
              Open

                const getTune = async (tuneId: string): Promise<TunesResponse | null> => {
                  const response = await fetch(`${customEndpoint}/tunes/byTuneId/${tuneId}`);
              
                  if (response.ok) {
                    return response.json() as Promise<TunesResponse>;
              Severity: Major
              Found in src/hooks/useDb.ts and 1 other location - About 6 hrs to fix
              src/hooks/useDb.ts on lines 84..99

              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 169.

              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

              Function Dialog has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
              Open

              const Dialog = ({
                ui,
                config,
                tune,
                url,
              Severity: Minor
              Found in src/components/Tune/Dialog.tsx - About 5 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 useDb has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
              Open

              const useDb = () => {
                const updateTune = async (id: string, data: TunesRecordPartial): Promise<void> => {
                  try {
                    await tunesCollection.update(id, data);
                    return Promise.resolve();
              Severity: Minor
              Found in src/hooks/useDb.ts - About 5 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

              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 AuthProvider has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const AuthProvider = (props: { children: ReactNode }) => {
                  const { children } = props;
                  const [currentUser, setCurrentUser] = useState<UsersResponse | null>(null);
                  const [currentUserToken, setCurrentUserToken] = useState<string | null>(null);
                
                
                Severity: Major
                Found in src/contexts/AuthContext.tsx - About 4 hrs to fix

                  Function TopBar has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const TopBar = ({ tuneData }: { tuneData: TuneDataState | null }) => {
                    const { xs, sm, lg } = useBreakpoint();
                    const { pathname } = useLocation();
                    const { currentUser, logout } = useAuth();
                    const navigate = useNavigate();
                  Severity: Minor
                  Found in src/components/TopBar.tsx - About 4 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

                  Severity
                  Category
                  Status
                  Source
                  Language