BuddhaNexus/buddhanexus

View on GitHub

Showing 439 of 439 total issues

Function TablePage has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function TablePage() {
  const { sourceLanguage, fileName, defaultQueryParams, queryParams } =
    useDbQueryParams();
  const { isFallback } = useSourceFile();

Severity: Major
Found in frontend/src/pages/db/[language]/[file]/table.tsx - About 2 hrs to fix

    Function MyDocument has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function MyDocument(
      props: DocumentProps & DocumentHeadTagsProps,
    ) {
      const currentLocale =
        // eslint-disable-next-line react/destructuring-assignment
    Severity: Major
    Found in frontend/src/pages/_document.tsx - About 2 hrs to fix

      Function ExternalLinksSection has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const ExternalLinksSection = () => {
        const { fileName } = useDbQueryParams();
        const { t } = useTranslation("settings");
        const materialTheme = useTheme();
      
      

        Function NoSearchResultsFound has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function NoSearchResultsFound() {
          const { t } = useTranslation();
        
          return (
            <>
        Severity: Major
        Found in frontend/src/features/globalSearch/NoSearchResultsFound.tsx - About 2 hrs to fix

          Function get_folio_regex has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_folio_regex(language, file_name, folio) -> str:
              """
              Creates a regular expression for use in the AD Queries based on the language and
              file so as to match the segment numbers therein.
              """
          Severity: Minor
          Found in api/utils.py - 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 DisplayOptionsSection has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const DisplayOptionsSection = () => {
            const { t } = useTranslation("settings");
          
            const currentView = useAtomValue(currentDbViewAtom);
          
          

            Function ParallelsChip has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function ParallelsChip() {
              const { t } = useTranslation("settings");
            
              const { fileName, defaultQueryParams, queryParams } = useDbQueryParams();
            
            
            Severity: Minor
            Found in frontend/src/components/db/ParallelsChip.tsx - About 1 hr to fix

              Function TextPage has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function TextPage() {
                const {
                  isError,
                  sourceLanguage,
                  isFallback,
              Severity: Minor
              Found in frontend/src/pages/db/[language]/[file]/text.tsx - About 1 hr to fix

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

                PROPERTIES_SEARCH_INDEX_SKT = {
                    "cleanupIntervalStep": 0,
                    "links": {
                        COLLECTION_SEARCH_INDEX_SKT: {
                            "analyzers": [SANSKRIT_ANALYZER],
                Severity: Major
                Found in dataloader/views_properties.py and 1 other location - About 1 hr to fix
                dataloader/views_properties.py on lines 55..68

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

                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 preprocess_search_string has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                def preprocess_search_string(search_string, language):
                    tib = ""
                    chn = ""
                    skt = ""
                    pli = ""
                Severity: Minor
                Found in api/search/search_utils.py - 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

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

                PROPERTIES_SEARCH_INDEX_PLI = {
                    "cleanupIntervalStep": 0,
                    "links": {
                        COLLECTION_SEARCH_INDEX_PLI: {
                            "analyzers": [PALI_ANALYZER],
                Severity: Major
                Found in dataloader/views_properties.py and 1 other location - About 1 hr to fix
                dataloader/views_properties.py on lines 39..52

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

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

                export const useDbQueryParams = () => {
                  const { t } = useTranslation();
                  const router = useRouter();
                  const searchParams = useSearchParams();
                
                
                Severity: Minor
                Found in frontend/src/components/hooks/useDbQueryParams.tsx - About 1 hr to fix

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

                          <Box sx={{ display: "flex", alignItems: "center", mb: 1 }}>
                            <CheckCircle color="success" />
                            <Typography ml={1}>
                              buddho&apos;ha cācalaḥ siddhaḥ prajñāpāramitā priyā
                            </Typography>
                  Severity: Major
                  Found in frontend/src/features/globalSearch/NoSearchResultsFound.tsx and 1 other location - About 1 hr to fix
                  frontend/src/features/globalSearch/NoSearchResultsFound.tsx on lines 45..50

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

                  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

                          <Box sx={{ display: "flex", alignItems: "center", mb: 1 }}>
                            <CheckCircle color="success" />
                            <Typography ml={1}>
                              །བཅོམ་ལྡན་འདས་བྱང་ཆུབ་སེམས་དཔའ་སེམས་དཔའ་ཆེན
                            </Typography>
                  Severity: Major
                  Found in frontend/src/features/globalSearch/NoSearchResultsFound.tsx and 1 other location - About 1 hr to fix
                  frontend/src/features/globalSearch/NoSearchResultsFound.tsx on lines 15..20

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

                  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

                  export const getServerSideProps: GetServerSideProps = async ({ locale }) => ({
                    props: {
                      ...(await serverSideTranslations(locale ?? "en", ["common", "settings"])),
                    },
                  });
                  Severity: Major
                  Found in frontend/src/pages/db/[language]/[file]/numbers.tsx and 1 other location - About 1 hr to fix
                  frontend/src/pages/db/[language]/[file]/graph.tsx on lines 142..146

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

                  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

                  export const getServerSideProps: GetServerSideProps = async ({ locale }) => ({
                    props: {
                      ...(await serverSideTranslations(locale ?? "en", ["common", "settings"])),
                    },
                  });
                  Severity: Major
                  Found in frontend/src/pages/db/[language]/[file]/graph.tsx and 1 other location - About 1 hr to fix
                  frontend/src/pages/db/[language]/[file]/numbers.tsx on lines 129..133

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

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

                  function MyApp(props: AppProps) {
                    const { Component, pageProps } = props;
                    const [queryClient] = React.useState(
                      () =>
                        new QueryClient({
                  Severity: Minor
                  Found in frontend/src/pages/_app.tsx - About 1 hr to fix

                    Function create_numbers_view_data has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def create_numbers_view_data(table_results):
                        """
                        This function converts the table-view output into a format
                        that is usable for the numbers-view.
                        """
                    Severity: Minor
                    Found in api/endpoints/numbers_view.py - 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 cell has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        cell: (info: CellContext<APINumbersSegment, unknown>) => {
                          const parallels = info?.getValue<APIParallel[]>() || [];
                          return (
                            <div
                              style={{
                    Severity: Minor
                    Found in frontend/src/features/numbersView/numbersViewTableContent.tsx - About 1 hr to fix

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

                              rootFullNames: {
                                displayName: p.root_full_names.display_name ?? "",
                                textName: p.root_full_names.text_name ?? "",
                                link1: p.root_full_names.link1,
                                link2: p.root_full_names.link2,
                      Severity: Major
                      Found in frontend/src/utils/api/endpoints/table-view/table.ts and 1 other location - About 1 hr to fix
                      frontend/src/utils/api/endpoints/table-view/table.ts on lines 17..22

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language