elabftw/elabftw

View on GitHub

Showing 356 of 356 total issues

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 pl_PL.js has 419 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    tinymce.addI18n('pl_PL',{
    "Redo": "Powt\u00f3rz",
    "Undo": "Cofnij",
    "Cut": "Wytnij",
    "Copy": "Kopiuj",
    Severity: Minor
    Found in src/js/tinymce-langs/pl_PL.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 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 sk_SK.js has 418 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          tinymce.addI18n('sk_SK',{
          "Redo": "Znova",
          "Undo": "Sp\u00e4\u0165",
          "Cut": "Vystrihn\u00fa\u0165",
          "Copy": "Kop\u00edrova\u0165",
          Severity: Minor
          Found in src/js/tinymce-langs/sk_SK.js - About 6 hrs to fix

            File QueryBuilderVisitor.php has 401 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            /**
             * @author Nicolas CARPi <nico-git@deltablot.email>
             * @author Marcel Bolten <github@marcelbolten.de>
            Severity: Minor
            Found in src/services/advancedSearchQuery/visitors/QueryBuilderVisitor.php - About 5 hrs to fix

              File sl_SI.js has 400 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              tinymce.addI18n('sl_SI',{
              "Redo": "Ponovno uveljavi",
              "Undo": "Razveljavi",
              "Cut": "Izre\u017ei",
              "Copy": "Kopiraj",
              Severity: Minor
              Found in src/js/tinymce-langs/sl_SI.js - About 5 hrs to fix

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

                    public function getCan(array $can): bool
                    {
                        // if base permission is public, we can
                        if ($can['base'] === BasePermissions::Full->value) {
                            return true;
                Severity: Minor
                Found in src/classes/Permissions.php - 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 generateInput has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                Open

                  generateInput(name: string, properties: ExtraFieldProperties): Element {
                    // we don't know yet which kind of element it will be
                    let element: HTMLInputElement|HTMLSelectElement;
                    // generate a unique id for the element so we can associate the label properly
                    const uniqid = this.getRandomId();
                Severity: Minor
                Found in src/ts/Metadata.class.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

                Method create has 130 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function create(): bool
                    {
                        $schema = Update::getRequiredSchema();
                
                        $sql = "INSERT INTO `config` (`conf_name`, `conf_value`) VALUES
                Severity: Major
                Found in src/models/Config.php - About 5 hrs to fix

                  Function exports has 127 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports = (env) => {
                    return {
                      entry: {
                        main: [
                          './src/scss/main.scss',
                  Severity: Major
                  Found in builder.js - About 5 hrs to fix

                    Function generateInput has 124 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      generateInput(name: string, properties: ExtraFieldProperties): Element {
                        // we don't know yet which kind of element it will be
                        let element: HTMLInputElement|HTMLSelectElement;
                        // generate a unique id for the element so we can associate the label properly
                        const uniqid = this.getRandomId();
                    Severity: Major
                    Found in src/ts/Metadata.class.ts - About 4 hrs to fix

                      Function execute has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function execute(InputInterface $input, OutputInterface $output): int
                          {
                              $Db = Db::getConnection();
                      
                              $queryItemsOrExperiment = "SELECT DISTINCT `id`, `body`, `userid`
                      Severity: Minor
                      Found in src/commands/AddMissingLinks.php - 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

                      Function getTinymceBaseConfig has a Cognitive Complexity of 33 (exceeds 5 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: Minor
                      Found in src/ts/tinymce.ts - 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

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

                          source: function(request: Record<string, string>, response: (data) => void): void {
                            ApiC.getJson(`${Model.TeamTags}/?q=${request.term}`).then(json => {
                              const res = [];
                              json.forEach(tag => {
                                res.push(tag.tag);
                      Severity: Major
                      Found in src/ts/misc.ts and 1 other location - About 4 hrs to fix
                      src/ts/misc.ts on lines 431..439

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

                      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

                          source: function(request: Record<string, string>, response: (data) => void): void {
                            ApiC.getJson(`${Model.ExtraFieldsKeys}/?q=${request.term}`).then(json => {
                              const res = [];
                              json.forEach(entry => {
                                res.push(entry.extra_fields_key);
                      Severity: Major
                      Found in src/ts/misc.ts and 1 other location - About 4 hrs to fix
                      src/ts/misc.ts on lines 415..423

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

                      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

                          } else if (el.matches('[data-action="lock-selected-entities"]')) {
                            // get the item id of all checked boxes
                            const checked = getCheckedBoxes();
                            if (checked.length === 0) {
                              notif(nothingSelectedError);
                      Severity: Major
                      Found in src/ts/show.ts and 1 other location - About 4 hrs to fix
                      src/ts/show.ts on lines 379..411

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

                      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

                          } else if (el.matches('[data-action="archive-selected-entities"]')) {
                            // get the item id of all checked boxes
                            const checked = getCheckedBoxes();
                            if (checked.length === 0) {
                              notif(nothingSelectedError);
                      Severity: Major
                      Found in src/ts/show.ts and 1 other location - About 4 hrs to fix
                      src/ts/show.ts on lines 347..411

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

                      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

                        if (document.querySelector('.createTagInputMultiple')) {
                          document.querySelector('.createTagInputMultiple').addEventListener('blur', event => {
                            createTagMultiple(event.target as HTMLInputElement);
                          });
                      
                      
                      Severity: Major
                      Found in src/ts/tags.ts and 2 other locations - About 4 hrs to fix
                      src/ts/tags.ts on lines 33..43
                      src/ts/tags.ts on lines 98..108

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

                      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

                        if (document.querySelector('.createTagInput')) {
                          document.querySelector('.createTagInput').addEventListener('blur', event => {
                            createTag(event.target as HTMLInputElement);
                          });
                      
                      
                      Severity: Major
                      Found in src/ts/tags.ts and 2 other locations - About 4 hrs to fix
                      src/ts/tags.ts on lines 74..84
                      src/ts/tags.ts on lines 98..108

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

                      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