mongaku/mongaku

View on GitHub

Showing 336 of 336 total issues

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

                <a
                    className="left 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 161..172

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

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

                <div className="form-inline">
                    <div className="form-group">
                        <input
                            type="file"
                            name="zipField"
Severity: Major
Found in src/views/SourceAdmin.js and 1 other location - About 2 hrs to fix
src/views/SourceAdmin.js on lines 299..312

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

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

                <div className="form-inline">
                    <div className="form-group">
                        <input
                            type="text"
                            name="directory"
Severity: Major
Found in src/views/SourceAdmin.js and 1 other location - About 2 hrs to fix
src/views/SourceAdmin.js on lines 241..254

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

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

    filter(value) {
        // NOTE(jeresig): There has got to be a better way to handle this.
        const start = value.start || -10000;
        const end = value.end || new Date().getYear() + 1900;

Severity: Major
Found in src/schemas/types/YearRange.js - About 2 hrs to fix

    Function paramFilter has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    const paramFilter = (values, keepSecondary) => {
        const all = {};
        const primary = [];
        const secondary = {};
        const type = values.type || Object.keys(options.types)[0];
    Severity: Minor
    Found in src/logic/shared/param-filter.js - 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 render has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        render() {
            const {mode, type, globalFacets, dynamicValues} = this.props;
            const {gettext, options} = this.context;
            const {model} = options.types[type];
            const types = Object.keys(model);
    Severity: Major
    Found in src/views/EditRecord.js - About 2 hrs to fix

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

                          <div className="form-group">
                              <label htmlFor="shortName">
                                  {gettext("Short Name (required)")}
                              </label>
                              <input
      Severity: Major
      Found in src/views/AddSource.js and 1 other location - About 2 hrs to fix
      src/views/AddSource.js on lines 41..53

      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

                          image.save(err => {
                              /* istanbul ignore if */
                              if (err) {
                                  console.error(err);
                                  return callback(err);
      Severity: Major
      Found in src/schemas/Image.js and 1 other location - About 2 hrs to fix
      src/schemas/Record.js on lines 762..777

      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

                          <div className="form-group">
                              <label htmlFor="name">
                                  {gettext("Full Name (required)")}
                              </label>
                              <input
      Severity: Major
      Found in src/views/AddSource.js and 1 other location - About 2 hrs to fix
      src/views/AddSource.js on lines 54..66

      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

                      record.updateSimilarity(err => {
                          /* istanbul ignore if */
                          if (err) {
                              console.error(err);
                              return callback(err);
      Severity: Major
      Found in src/schemas/Record.js and 1 other location - About 2 hrs to fix
      src/schemas/Image.js on lines 477..492

      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

          return (
              <tr>
                  <td>
                      <a href={batch.getURL}>{batch.fileName}</a>
                  </td>
      Severity: Major
      Found in src/views/SourceAdmin.js and 1 other location - About 2 hrs to fix
      src/views/SourceAdmin.js on lines 78..86

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

      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

          return (
              <tr>
                  <td>
                      <a href={batch.getURL}>{batch.fileName}</a>
                  </td>
      Severity: Major
      Found in src/views/SourceAdmin.js and 1 other location - About 2 hrs to fix
      src/views/SourceAdmin.js on lines 354..362

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

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

      const pd = require("parse-dimensions");
      
      const numRange = bucket =>
          bucket.to
              ? `${bucket.from || 0}-${bucket.to}${bucket.unit}`
      Severity: Minor
      Found in src/schemas/types/Dimension.js - About 2 hrs to fix

        Function updateSimilarity has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            updateSimilarity(callback) {
                this.getImages((err, images) => {
                    /* istanbul ignore if */
                    if (err) {
                        return callback(err);
        Severity: Major
        Found in src/schemas/Record.js - About 2 hrs to fix

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

                  if (value.widthMin) {
                      filters.push({
                          range: {
                              [`${this.options.name}.width`]: {
                                  gte: pd.convertNumber(
          Severity: Major
          Found in src/schemas/types/Dimension.js and 3 other locations - About 2 hrs to fix
          src/schemas/types/Dimension.js on lines 170..182
          src/schemas/types/Dimension.js on lines 184..196
          src/schemas/types/Dimension.js on lines 198..210

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

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

                  if (value.widthMax) {
                      filters.push({
                          range: {
                              [`${this.options.name}.width`]: {
                                  lte: pd.convertNumber(
          Severity: Major
          Found in src/schemas/types/Dimension.js and 3 other locations - About 2 hrs to fix
          src/schemas/types/Dimension.js on lines 156..168
          src/schemas/types/Dimension.js on lines 184..196
          src/schemas/types/Dimension.js on lines 198..210

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

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

                  if (value.heightMax) {
                      filters.push({
                          range: {
                              [`${this.options.name}.height`]: {
                                  lte: pd.convertNumber(
          Severity: Major
          Found in src/schemas/types/Dimension.js and 3 other locations - About 2 hrs to fix
          src/schemas/types/Dimension.js on lines 156..168
          src/schemas/types/Dimension.js on lines 170..182
          src/schemas/types/Dimension.js on lines 184..196

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

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

                  if (value.heightMin) {
                      filters.push({
                          range: {
                              [`${this.options.name}.height`]: {
                                  gte: pd.convertNumber(
          Severity: Major
          Found in src/schemas/types/Dimension.js and 3 other locations - About 2 hrs to fix
          src/schemas/types/Dimension.js on lines 156..168
          src/schemas/types/Dimension.js on lines 170..182
          src/schemas/types/Dimension.js on lines 198..210

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

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

              facet() {
                  const defaultUnit = this.defaultUnit;
                  const unit = this.defaultSearchUnit || this.defaultUnit;
          
                  const formatFacetBucket = bucket => {
          Severity: Major
          Found in src/schemas/types/Dimension.js - About 2 hrs to fix

            Function importRecords has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                importRecords(callback) {
                    const Record = record(this.type);
                    const Source = models("Source");
            
                    async.eachLimit(
            Severity: Major
            Found in src/schemas/RecordImport.js - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language