mongaku/mongaku

View on GitHub

Showing 336 of 336 total issues

Function renderMenu has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    renderMenu() {
        const {create} = this.props;
        const {searchValue, options, error} = this.state;
        const {gettext, format} = this.context;

Severity: Major
Found in src/views/shared/Select.js - About 3 hrs to fix

    Function addUsers has 85 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            addUsers(req, res, next) {
                const {lang, i18n} = req;
    
                let createdOrUpdated = 0;
                const failed = [];
    Severity: Major
    Found in src/logic/admin.js - About 3 hrs to fix

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

                  [`${this.options.name}.height`]: {
                      title: i18n => this.options.heightTitle(i18n),
      
                      facet: () => ({
                          range: {
      Severity: Major
      Found in src/schemas/types/Dimension.js and 1 other location - About 3 hrs to fix
      src/schemas/types/Dimension.js on lines 258..269

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

      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

                  [`${this.options.name}.width`]: {
                      title: i18n => this.options.widthTitle(i18n),
      
                      facet: () => ({
                          range: {
      Severity: Major
      Found in src/schemas/types/Dimension.js and 1 other location - About 3 hrs to fix
      src/schemas/types/Dimension.js on lines 271..282

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

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

      module.exports = type => {
          if (records[type]) {
              return records[type];
          }
      
      
      Severity: Major
      Found in src/lib/record.js - About 3 hrs to fix

        Function exports has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = (options: Options) => {
            const genURL = (lang: ?string, urlBase: string, origPath: string) => {
                let suffix = "";
                let base = urlBase;
                let path = origPath;
        Severity: Minor
        Found in src/lib/urls.js - About 3 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 3 locations. Consider refactoring.
        Open

                const endInside = {
                    bool: {
                        must: [
                            {
                                range: {
        Severity: Major
        Found in src/schemas/types/YearRange.js and 2 other locations - About 3 hrs to fix
        src/schemas/types/YearRange.js on lines 67..87
        src/schemas/types/YearRange.js on lines 111..131

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

        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

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

        type ImportResults = {
            models: Array<Result>,
            unprocessed: Array<Result>,
            created: Array<Result>,
            changed: Array<Result>,
        Severity: Major
        Found in src/views/ImportImages.js and 1 other location - About 3 hrs to fix
        src/views/ImportRecords.js 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 100.

        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

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

        type ImportResults = {
            models: Array<Result>,
            unprocessed: Array<Result>,
            created: Array<Result>,
            changed: Array<Result>,
        Severity: Major
        Found in src/views/ImportRecords.js and 1 other location - About 3 hrs to fix
        src/views/ImportImages.js on lines 24..32

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

        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

                const startInside = {
                    bool: {
                        must: [
                            {
                                range: {
        Severity: Major
        Found in src/schemas/types/YearRange.js and 2 other locations - About 3 hrs to fix
        src/schemas/types/YearRange.js on lines 89..109
        src/schemas/types/YearRange.js on lines 111..131

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

        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

                const contains = {
                    bool: {
                        must: [
                            {
                                range: {
        Severity: Major
        Found in src/schemas/types/YearRange.js and 2 other locations - About 3 hrs to fix
        src/schemas/types/YearRange.js on lines 67..87
        src/schemas/types/YearRange.js on lines 89..109

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

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

        module.exports = function(app) {
            return {
                index({lang}, res) {
                    const sitemaps = [];
        
        
        Severity: Major
        Found in src/logic/sitemaps.js - About 3 hrs to fix

          Function clusterImages has 81 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const clusterImages = (records: Array<RecordType>) => {
              const sourceRecord = records[0];
              const rows = [
                  {
                      record: sourceRecord,
          Severity: Major
          Found in src/views/Record.js - About 3 hrs to fix

            File RecordImport.js has 301 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            const async = require("async");
            
            const record = require("../lib/record");
            const models = require("../lib/models");
            const db = require("../lib/db");
            Severity: Minor
            Found in src/schemas/RecordImport.js - About 3 hrs to fix

              File Page.js has 294 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              // @flow
              
              const React = require("react");
              
              import type {Context} from "./types.js";
              Severity: Minor
              Found in src/views/Page.js - About 3 hrs to fix

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

                const YearRangeView = ({value, url}: Props) => {
                    return (
                        <span>
                            {value.map((date, i) => (
                                <YearRange key={date._id} date={date} url={url[i]} />
                Severity: Major
                Found in src/views/types/view/YearRange.js and 1 other location - About 3 hrs to fix
                src/views/types/view/Name.js on lines 30..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 96.

                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 NameView = ({value, url}: Props) => {
                    return (
                        <div>
                            {value.map((name, i) => (
                                <Name key={name._id} value={name} url={url[i]} />
                Severity: Major
                Found in src/views/types/view/Name.js and 1 other location - About 3 hrs to fix
                src/views/types/view/YearRange.js on lines 44..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 96.

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

                // @flow
                
                const React = require("react");
                
                const Select = require("./shared/Select.js");
                Severity: Minor
                Found in src/views/SearchForm.js - About 2 hrs to fix

                  File express_v4.x.x.js has 286 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  // NOTE(jeresig): This is a modified version of the Express flow types
                  // from flow-typed, modified to include the custom properties on the
                  // request object. Theoretically it should be possible to extend this
                  // according to this diff, but I can't figure it out:
                  // https://github.com/flowtype/flow-typed/pull/508
                  Severity: Minor
                  Found in types/express_v4.x.x.js - About 2 hrs to fix

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

                                    <a
                                        className="right carousel-control"
                                        href="javascript: void 0"
                                        role="button"
                                        onClick={() => this.toggleImage(curPos + 1)}
                    Severity: Major
                    Found in src/views/Record.js and 1 other location - About 2 hrs to fix
                    src/views/Record.js on lines 149..160

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

                    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