mongaku/mongaku

View on GitHub

Showing 336 of 336 total issues

Function serializeValue has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

const serializeValue = (i18n: i18nObject, blacklist: Array<string> = []) => (
    value: any,
    key: string,
    object: Object,
) => {
Severity: Minor
Found in src/lib/clone.js - About 1 hr 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 handleInput has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    handleInput(searchValue: string) {
        const {loadOptions, options} = this.props;

        this.setState({
            searchValue,
Severity: Minor
Found in src/views/shared/Select.js - About 1 hr to fix

    Function loadImages has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        loadImages(loadSimilarRecords, callback) {
            async.parallel(
                [
                    callback => {
                        this.getImages((err, images) => {
    Severity: Minor
    Found in src/schemas/Record.js - About 1 hr to fix

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

      module.exports = app => {
          /* istanbul ignore if */
          if (config.NODE_ENV !== "test") {
              // A basic logger for tracking who is accessing the service
              app.use(morgan("dev"));
      Severity: Minor
      Found in src/server/express.js - About 1 hr to fix

        Function fromFile has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            fromFile(file, callback) {
                const UploadImage = models("UploadImage");
        
                const sourceDir = getDirBase();
        
        
        Severity: Minor
        Found in src/schemas/UploadImage.js - About 1 hr to fix

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

              componentDidMount() {
                  this.boundHandleBlur = (e: Event) => this.handleBlur(e);
                  document.addEventListener("focusin", this.boundHandleBlur);
                  document.addEventListener("click", this.boundHandleBlur);
              }
          Severity: Major
          Found in src/views/Page.js and 1 other location - About 1 hr to fix
          src/views/shared/Select.js on lines 98..102

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

          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

                          <a href={recordModel.getURL}>
                              <img
                                  src={imageModel.getThumbURL}
                                  alt={recordModel.getTitle}
                                  title={recordModel.getTitle}
          Severity: Major
          Found in src/views/Upload.js and 1 other location - About 1 hr to fix
          src/views/Record.js on lines 405..412

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

          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

              componentDidMount() {
                  this.boundHandleBlur = (e: Event) => this.handleBlur(e);
                  document.addEventListener("focusin", this.boundHandleBlur);
                  document.addEventListener("click", this.boundHandleBlur);
              }
          Severity: Major
          Found in src/views/shared/Select.js and 1 other location - About 1 hr to fix
          src/views/Page.js on lines 44..48

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

          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

                  <a href={recordModel.getURL}>
                      <img
                          src={recordModel.getThumbURL}
                          alt={recordModel.getTitle}
                          title={recordModel.getTitle}
          Severity: Major
          Found in src/views/Record.js and 1 other location - About 1 hr to fix
          src/views/Upload.js on lines 78..85

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

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

              schema(Schema) {
                  const NameSchema = new Schema({
                      // An ID for the name, computed from the original + name properties
                      // before validation.
                      _id: String,
          Severity: Minor
          Found in src/schemas/types/Name.js - About 1 hr to fix

            Function schema has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                schema(Schema) {
                    const YearRangeSchema = new Schema({
                        // An ID for the year range, computed from the original + start/end
                        // properties before validation.
                        _id: String,
            Severity: Minor
            Found in src/schemas/types/YearRange.js - About 1 hr to fix

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

              module.exports = function(app: express$Application) {
                  const Source = models("Source");
              
                  const cache = require("../server/middlewares/cache");
                  const searchPage = require("./shared/search-page");
              Severity: Minor
              Found in src/logic/search.js - About 1 hr to fix

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

                                        <tr className="plain">
                                            <td />
                                            {records.map(record => (
                                                <Images
                                                    {...props}
                Severity: Major
                Found in src/views/Record.js and 1 other location - About 1 hr to fix
                src/views/Record.js on lines 367..376

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

                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

                                        <tr className="plain">
                                            <th />
                                            {records.map(record => (
                                                <Title
                                                    {...props}
                Severity: Major
                Found in src/views/Record.js and 1 other location - About 1 hr to fix
                src/views/Record.js on lines 377..386

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

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

                    render() {
                        const {success, error, sources} = this.props;
                        const {gettext, URL} = this.context;
                
                        return (
                Severity: Minor
                Found in src/views/ManageSources.js - About 1 hr to fix

                  Function renderCarousel has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      renderCarousel() {
                          const {record} = this.props;
                          const {gettext} = this.context;
                          const {curPos} = this.state;
                          return (
                  Severity: Minor
                  Found in src/views/Record.js - About 1 hr to fix

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

                        searchTitle(value, i18n) {
                            const displayValue = Array.isArray(value) ? value.join(", ") : value;
                    
                            return `${this.options.title(i18n)}: ${displayValue}`;
                        },
                    Severity: Major
                    Found in src/schemas/types/SimpleString.js and 1 other location - About 1 hr to fix
                    src/schemas/types/SimpleNumber.js on lines 27..31

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

                    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="email">{gettext("Username:")}</label>{" "}
                                            <input
                                                type="text"
                                                name="email"
                    Severity: Major
                    Found in src/views/Login.js and 1 other location - About 1 hr to fix
                    src/views/Login.js on lines 46..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 67.

                    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="password">{gettext("Password:")}</label>{" "}
                                            <input
                                                type="password"
                                                name="password"
                    Severity: Major
                    Found in src/views/Login.js and 1 other location - About 1 hr to fix
                    src/views/Login.js on lines 38..45

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

                    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

                        searchTitle(value, i18n) {
                            const displayValue = Array.isArray(value) ? value.join(", ") : value;
                    
                            return `${this.options.title(i18n)}: ${displayValue}`;
                        },
                    Severity: Major
                    Found in src/schemas/types/SimpleNumber.js and 1 other location - About 1 hr to fix
                    src/schemas/types/SimpleString.js on lines 27..31

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

                    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