BuddhaNexus/buddhanexus

View on GitHub

Showing 439 of 439 total issues

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

      label={
        <Box sx={{ display: "flex", justifyContent: "space-between" }}>
          <Box>{t("resultsHead.matches")}</Box>
          <Box sx={{ minWidth: "2ch", ml: "3px", textAlign: "center" }}>
            {matches}
Severity: Major
Found in frontend/src/components/db/SearchMatchesChip.tsx and 1 other location - About 3 hrs to fix
frontend/src/components/db/ParallelsChip.tsx on lines 62..69

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

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 onCopyQueryTitle = async ({
  event,
  fileName,
  popperAnchorStateHandler,
}: UtilityClickHandlerProps) => {
frontend/src/features/sidebarSuite/common/dbSidebarHelpers.ts on lines 117..130

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

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 onCopyQueryLink = async ({
  event,
  popperAnchorStateHandler,
  href,
}: UtilityClickHandlerProps) => {
frontend/src/features/sidebarSuite/common/dbSidebarHelpers.ts on lines 102..115

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

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={
        <Box sx={{ display: "flex", justifyContent: "space-between" }}>
          <Box>{t("resultsHead.matches")}</Box>
          <Box sx={{ minWidth: "2ch", ml: "3px", textAlign: "center" }}>
            {parallelCount}
Severity: Major
Found in frontend/src/components/db/ParallelsChip.tsx and 1 other location - About 3 hrs to fix
frontend/src/components/db/SearchMatchesChip.tsx on lines 31..38

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

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

        <Box sx={{ display: "flex", alignItems: "center", mb: 1 }}>
          <Cancel color="error" />
          <Typography ml={1}>
            buddho&apos;ha cācalaḥ siddhaḥ prajñāpāramitā priy
            <span style={{ fontWeight: "bold" }}>a</span>
Severity: Major
Found in frontend/src/features/globalSearch/NoSearchResultsFound.tsx and 2 other locations - About 2 hrs to fix
frontend/src/features/globalSearch/NoSearchResultsFound.tsx on lines 35..41
frontend/src/features/globalSearch/NoSearchResultsFound.tsx on lines 51..57

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

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

        <Box sx={{ display: "flex", alignItems: "center", mb: 1 }}>
          <Cancel color="error" />
          <Typography ml={1}>
            །བཅོམ་ལྡན་འདས་བྱང་ཆུབ་སེམས་དཔའ་སེམས་དཔའ་
            <span style={{ fontWeight: "bold" }}>ཆེ</span>
Severity: Major
Found in frontend/src/features/globalSearch/NoSearchResultsFound.tsx and 2 other locations - About 2 hrs to fix
frontend/src/features/globalSearch/NoSearchResultsFound.tsx on lines 21..27
frontend/src/features/globalSearch/NoSearchResultsFound.tsx on lines 35..41

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

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

        <Box sx={{ display: "flex", alignItems: "center", mb: 1 }}>
          <Cancel color="error" />
          <Typography ml={1}>
            buddh<span style={{ fontWeight: "bold" }}>oh</span>a cācalaḥ siddhaḥ
            prajñāpāramitā priyā
Severity: Major
Found in frontend/src/features/globalSearch/NoSearchResultsFound.tsx and 2 other locations - About 2 hrs to fix
frontend/src/features/globalSearch/NoSearchResultsFound.tsx on lines 21..27
frontend/src/features/globalSearch/NoSearchResultsFound.tsx on lines 51..57

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

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

export default function FolioOption() {
  const { t } = useTranslation("settings");
  const { fileName, defaultParamConfig, uniqueSettings } = useDbQueryParams();
  const { data, isLoading } = useQuery({
    queryKey: DbApi.FolioData.makeQueryKey(fileName),

    Function calculate_color_maps_text_view has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def calculate_color_maps_text_view(data):
        """calculates the color maps for the text view"""
        textleft = data["textleft"]
        parallels_dict = dict(zip(data["parallel_ids"], data["parallels"]))
        for entry in textleft:
    Severity: Minor
    Found in api/colormaps.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 ScoreFilter has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function ScoreFilter() {
      const { t } = useTranslation("settings");
      const { defaultParamConfig, uniqueSettings } = useDbQueryParams();
    
      const [scoreParam, setScoreParam] = useQueryParam(

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

      export default function ParLengthFilter() {
        const { t } = useTranslation("settings");
      
        const { parLengthConfig, uniqueSettings } = useDbQueryParams();
        const [parLengthParam, setParLengthParam] = useQueryParam(

        Function LocaleSelector has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function LocaleSelector() {
          const router = useRouter();
          const { pathname, query, asPath, locale } = router;
          const currentLocale = locale as SupportedLocale;
        
        
        Severity: Major
        Found in frontend/src/components/layout/LocaleSelector.tsx - About 2 hrs to fix

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

          export async function getTextFileMenuData(query: APIMenuFilesRequestQuery) {
            if (!query.language) {
              return [];
            }
          
          
          Severity: Major
          Found in frontend/src/utils/api/endpoints/menus/files.ts and 1 other location - About 2 hrs to fix
          frontend/src/utils/api/endpoints/utils/available-languages.ts on lines 16..28

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

          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 async function getAvailableLanguages(
            query: APIAvailableLanguagesRequestQuery,
          ) {
            if (!query.file_name) {
              return [];
          frontend/src/utils/api/endpoints/menus/files.ts on lines 26..36

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

          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

          File tasks.py has 269 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import os
          from arango import (
              DatabaseCreateError,
              CollectionCreateError,
              CollectionDeleteError,
          Severity: Minor
          Found in dataloader/tasks.py - About 2 hrs to fix

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

                def load(self, number_of_threads: int = 1) -> None:
                    # only create collection if it does not exist
                    db = get_database()
                    if not check_if_collection_exists(db, self.SEARCH_COLLECTION_NAME):
                        db.create_collection(self.SEARCH_COLLECTION_NAME)
            Severity: Minor
            Found in dataloader/load_segments.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 Footer has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const Footer = () => {
              const { t } = useTranslation();
              const router = useRouter();
              const locale = router.locale as SupportedLocale;
            
            
            Severity: Major
            Found in frontend/src/components/layout/Footer.tsx - About 2 hrs to fix

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

                {
                  title: t("footer.about"),
                  links: [
                    { title: t("footer.introduction"), slug: "/introduction" },
                    { title: t("footer.history"), slug: "/history" },
              Severity: Major
              Found in frontend/src/components/layout/Footer.tsx and 1 other location - About 2 hrs to fix
              frontend/src/components/layout/Footer.tsx on lines 42..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 81.

              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

                {
                  title: t("footer.activities"),
                  links: [
                    { title: t("footer.publications"), slug: "/publications" },
                    { title: t("footer.events"), slug: "/events" },
              Severity: Major
              Found in frontend/src/components/layout/Footer.tsx and 1 other location - About 2 hrs to fix
              frontend/src/components/layout/Footer.tsx on lines 25..33

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

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

              export function SidebarSuite() {
                const router = useRouter();
                const { isSettingsOpen, setIsSettingsOpen, drawerWidth } =
                  useSettingsDrawer();
                const [activeTab, setActiveTab] = useState("0");
              Severity: Major
              Found in frontend/src/features/sidebarSuite/SidebarSuite.tsx - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language