elabftw/elabftw

View on GitHub

Showing 356 of 356 total issues

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

const t = {
  translation: {
    "click-to-edit": "Clique para editar",
    "cancel": "Cancelar",
    "comment-add": "Adicionar um comentário",
Severity: Major
Found in src/ts/langs/pt_PT.ts and 18 other locations - About 7 hrs to fix
src/ts/langs/ca_ES.ts on lines 3..40
src/ts/langs/cs_CZ.ts on lines 3..40
src/ts/langs/de_DE.ts on lines 3..40
src/ts/langs/en_GB.ts on lines 3..40
src/ts/langs/en_US.ts on lines 3..40
src/ts/langs/es_ES.ts on lines 3..40
src/ts/langs/fr_FR.ts on lines 3..40
src/ts/langs/id_ID.ts on lines 3..40
src/ts/langs/it_IT.ts on lines 3..40
src/ts/langs/ja_JP.ts on lines 3..40
src/ts/langs/ko_KR.ts on lines 3..40
src/ts/langs/nl_BE.ts on lines 3..40
src/ts/langs/pl_PL.ts on lines 3..40
src/ts/langs/pt_BR.ts on lines 3..40
src/ts/langs/ru_RU.ts on lines 3..40
src/ts/langs/sk_SK.ts on lines 3..40
src/ts/langs/sl_SI.ts on lines 3..40
src/ts/langs/zh_CN.ts on lines 3..40

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

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

const t = {
  translation: {
    "click-to-edit": "Click to edit",
    "cancel": "Cancel",
    "comment-add": "Add a comment",
Severity: Major
Found in src/ts/langs/en_US.ts and 18 other locations - About 7 hrs to fix
src/ts/langs/ca_ES.ts on lines 3..40
src/ts/langs/cs_CZ.ts on lines 3..40
src/ts/langs/de_DE.ts on lines 3..40
src/ts/langs/en_GB.ts on lines 3..40
src/ts/langs/es_ES.ts on lines 3..40
src/ts/langs/fr_FR.ts on lines 3..40
src/ts/langs/id_ID.ts on lines 3..40
src/ts/langs/it_IT.ts on lines 3..40
src/ts/langs/ja_JP.ts on lines 3..40
src/ts/langs/ko_KR.ts on lines 3..40
src/ts/langs/nl_BE.ts on lines 3..40
src/ts/langs/pl_PL.ts on lines 3..40
src/ts/langs/pt_BR.ts on lines 3..40
src/ts/langs/pt_PT.ts on lines 3..40
src/ts/langs/ru_RU.ts on lines 3..40
src/ts/langs/sk_SK.ts on lines 3..40
src/ts/langs/sl_SI.ts on lines 3..40
src/ts/langs/zh_CN.ts on lines 3..40

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

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

const t = {
  translation: {
    "click-to-edit": "Cliquer pour modifier",
    "cancel": "Annuler",
    "comment-add": "Ajouter un commentaire",
Severity: Major
Found in src/ts/langs/fr_FR.ts and 18 other locations - About 7 hrs to fix
src/ts/langs/ca_ES.ts on lines 3..40
src/ts/langs/cs_CZ.ts on lines 3..40
src/ts/langs/de_DE.ts on lines 3..40
src/ts/langs/en_GB.ts on lines 3..40
src/ts/langs/en_US.ts on lines 3..40
src/ts/langs/es_ES.ts on lines 3..40
src/ts/langs/id_ID.ts on lines 3..40
src/ts/langs/it_IT.ts on lines 3..40
src/ts/langs/ja_JP.ts on lines 3..40
src/ts/langs/ko_KR.ts on lines 3..40
src/ts/langs/nl_BE.ts on lines 3..40
src/ts/langs/pl_PL.ts on lines 3..40
src/ts/langs/pt_BR.ts on lines 3..40
src/ts/langs/pt_PT.ts on lines 3..40
src/ts/langs/ru_RU.ts on lines 3..40
src/ts/langs/sk_SK.ts on lines 3..40
src/ts/langs/sl_SI.ts on lines 3..40
src/ts/langs/zh_CN.ts on lines 3..40

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

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

const t = {
  translation: {
    "click-to-edit": "Click to edit",
    "cancel": "Cancel",
    "comment-add": "Add a comment",
Severity: Major
Found in src/ts/langs/en_GB.ts and 18 other locations - About 7 hrs to fix
src/ts/langs/ca_ES.ts on lines 3..40
src/ts/langs/cs_CZ.ts on lines 3..40
src/ts/langs/de_DE.ts on lines 3..40
src/ts/langs/en_US.ts on lines 3..40
src/ts/langs/es_ES.ts on lines 3..40
src/ts/langs/fr_FR.ts on lines 3..40
src/ts/langs/id_ID.ts on lines 3..40
src/ts/langs/it_IT.ts on lines 3..40
src/ts/langs/ja_JP.ts on lines 3..40
src/ts/langs/ko_KR.ts on lines 3..40
src/ts/langs/nl_BE.ts on lines 3..40
src/ts/langs/pl_PL.ts on lines 3..40
src/ts/langs/pt_BR.ts on lines 3..40
src/ts/langs/pt_PT.ts on lines 3..40
src/ts/langs/ru_RU.ts on lines 3..40
src/ts/langs/sk_SK.ts on lines 3..40
src/ts/langs/sl_SI.ts on lines 3..40
src/ts/langs/zh_CN.ts on lines 3..40

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

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

export function displayPlasmidViewer(about: DOMStringMap): void {
  /* eslint-disable-next-line */
  const editor: any = {};
  const ApiC = new Api();
  Array.from(document.getElementsByClassName('viewer-ove')).forEach(el => {
Severity: Major
Found in src/ts/ove.ts - About 7 hrs to fix

    File common.ts has 474 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * @author Nicolas CARPi <nico-git@deltablot.email>
     * @copyright 2012 Nicolas CARPi
     * @see https://www.elabftw.net Official website
     * @license AGPL-3.0
    Severity: Minor
    Found in src/ts/common.ts - About 7 hrs to fix

      Function getTinymceBaseConfig has 179 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function getTinymceBaseConfig(page: string): object {
        let plugins = 'accordion advlist anchor autolink autoresize table searchreplace code fullscreen insertdatetime charmap lists save image link pagebreak codesample template mention visualblocks visualchars emoticons';
        let toolbar1 = 'undo redo | styles fontsize bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | superscript subscript | bullist numlist outdent indent | forecolor backcolor | charmap emoticons adddate | codesample | link | sort-table | save';
        let removedMenuItems = 'newdocument, image, anchor';
        if (page === 'edit') {
      Severity: Major
      Found in src/ts/tinymce.ts - About 7 hrs to fix

        File Metadata.class.ts has 456 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * @author Nicolas CARPi <nico-git@deltablot.email>
         * @copyright 2012 Nicolas CARPi
         * @see https://www.elabftw.net Official website
         * @license AGPL-3.0
        Severity: Minor
        Found in src/ts/Metadata.class.ts - About 6 hrs to fix

          Function parseFile has 153 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              async function parseFile(fileContent): Promise<void> {
                const parsedData = await anyToJson(fileContent, {
                  fileName: realName,
                  guessIfProtein: true,
                });
          Severity: Major
          Found in src/ts/ove.ts - About 6 hrs to fix

            Function importRootDataset has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
            Open

                private function importRootDataset(array $dataset): void
                {
                    $createTarget = $this->targetNumber;
                    $title = $this->transformIfNecessary($dataset['name'] ?? _('Untitled'));
            
            
            Severity: Minor
            Found in src/Import/Eln.php - About 6 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 ja_JP.js has 419 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            tinymce.addI18n('ja_JP',{
            "Redo": "\u3084\u308a\u76f4\u3057",
            "Undo": "\u5143\u306b\u623b\u3059",
            "Cut": "\u5207\u308a\u53d6\u308a",
            "Copy": "\u30b3\u30d4\u30fc",
            Severity: Minor
            Found in src/js/tinymce-langs/ja_JP.js - About 6 hrs to fix

              File nl_BE.js has 419 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              tinymce.addI18n('nl_BE',{
              "Redo": "Opnieuw uitvoeren",
              "Undo": "Ongedaan maken",
              "Cut": "Knippen",
              "Copy": "Kopi\u00ebren",
              Severity: Minor
              Found in src/js/tinymce-langs/nl_BE.js - About 6 hrs to fix

                File ca_ES.js has 419 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                tinymce.addI18n('ca_ES',{
                "Redo": "Refer",
                "Undo": "Desfer",
                "Cut": "Retalla",
                "Copy": "Copia",
                Severity: Minor
                Found in src/js/tinymce-langs/ca_ES.js - About 6 hrs to fix

                  File ru_RU.js has 419 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  tinymce.addI18n('ru_RU',{
                  "Redo": "\u0412\u0435\u0440\u043d\u0443\u0442\u044c",
                  "Undo": "\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c",
                  "Cut": "\u0412\u044b\u0440\u0435\u0437\u0430\u0442\u044c",
                  "Copy": "\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c",
                  Severity: Minor
                  Found in src/js/tinymce-langs/ru_RU.js - About 6 hrs to fix

                    File fr_FR.js has 419 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    tinymce.addI18n('fr_FR',{
                    "Redo": "R\u00e9tablir",
                    "Undo": "Annuler",
                    "Cut": "Couper",
                    "Copy": "Copier",
                    Severity: Minor
                    Found in src/js/tinymce-langs/fr_FR.js - About 6 hrs to fix

                      File pt_BR.js has 419 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      tinymce.addI18n('pt_BR',{
                      "Redo": "Refazer",
                      "Undo": "Desfazer",
                      "Cut": "Cortar",
                      "Copy": "Copiar",
                      Severity: Minor
                      Found in src/js/tinymce-langs/pt_BR.js - About 6 hrs to fix

                        File pt_PT.js has 419 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        tinymce.addI18n('pt_PT',{
                        "Redo": "Refazer",
                        "Undo": "Anular",
                        "Cut": "Cortar",
                        "Copy": "Copiar",
                        Severity: Minor
                        Found in src/js/tinymce-langs/pt_PT.js - About 6 hrs to fix

                          File it_IT.js has 419 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          tinymce.addI18n('it_IT',{
                          "Redo": "Ripristina",
                          "Undo": "Annulla",
                          "Cut": "Taglia",
                          "Copy": "Copia",
                          Severity: Minor
                          Found in src/js/tinymce-langs/it_IT.js - About 6 hrs to fix

                            File id_ID.js has 419 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            tinymce.addI18n('id_ID',{
                            "Redo": "Ulang",
                            "Undo": "Batalkan",
                            "Cut": "Potong",
                            "Copy": "Salin",
                            Severity: Minor
                            Found in src/js/tinymce-langs/id_ID.js - About 6 hrs to fix

                              File zh_CN.js has 419 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              tinymce.addI18n('zh_CN',{
                              "Redo": "\u91cd\u505a",
                              "Undo": "\u64a4\u9500",
                              "Cut": "\u526a\u5207",
                              "Copy": "\u590d\u5236",
                              Severity: Minor
                              Found in src/js/tinymce-langs/zh_CN.js - About 6 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language