mongaku/mongaku

View on GitHub

Showing 151 of 336 total issues

Function render has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    render() {
        const {children} = this.props;
        const {open} = this.state;
        const {options, URL, gettext} = this.context;

Severity: Minor
Found in src/views/Page.js - About 1 hr to fix

    Function search has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            search({params, lang}, res) {
                // Query for the records in Elasticsearch
                const Record = record(params.type);
                Record.search(
                    {
    Severity: Minor
    Found in src/logic/sitemaps.js - About 1 hr to fix

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

          updateSimilarity(callback) {
              const Image = models("Image");
      
              const file = this.getFilePath();
      
      
      Severity: Minor
      Found in src/schemas/UploadImage.js - About 1 hr to fix

        Function processImage has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            processImage(sourceFile, baseDir, callback) {
                let hash;
                let imageFile;
                const existsError = new Error("Already exists.");
        
        
        Severity: Minor
        Found in src/schemas/Image.js - About 1 hr to fix

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

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

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

            module.exports = app => {
                const User = models("User");
            
                // serialize sessions
                passport.serializeUser((user, callback) => callback(null, user._id));
            Severity: Minor
            Found in src/server/passport.js - About 1 hr to fix

              Function breadcrumbs has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  breadcrumbs(value, i18n) {
                      const breadcrumbs = [];
              
                      if (value.heightMin || value.heightMax) {
                          const title = this.options.heightTitle(i18n);
              Severity: Minor
              Found in src/schemas/types/Dimension.js - About 1 hr to fix

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

                    updateSimilarity(callback) {
                        models("Image").findOne(
                            {
                                needsSimilarUpdate: true,
                            },
                Severity: Minor
                Found in src/schemas/Image.js - About 1 hr to fix

                  Function TypeView has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const TypeView = ({
                      value,
                      url,
                      typeSchema,
                  }: {
                  Severity: Minor
                  Found in src/views/Record.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 updateImageSimilarity has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      updateImageSimilarity() {
                          const Image = models("Image");
                          const next = () => setTimeout(update, QUERY_RATE);
                          const update = () =>
                              Image.indexSimilarity((err, success) => {
                  Severity: Minor
                  Found in src/server/cron.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 addResult has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      addResult(file, callback) {
                          /* istanbul ignore if */
                          if (config.NODE_ENV !== "test") {
                              console.log("Adding Image:", path.basename(file));
                          }
                  Severity: Minor
                  Found in src/schemas/ImageImport.js - About 1 hr to fix

                    Function engine has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const engine = (filePath: string, options: Object, callback: Function) => {
                        const urls = urlsLib(options.options);
                        const viewName = path.basename(filePath, ".js");
                        const View = require(filePath);
                    
                    
                    Severity: Minor
                    Found in src/server/react-views.js - About 1 hr to fix

                      Function advance has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          advance(callback) {
                              const state = this.getCurState();
                              const nextState = this.getNextState();
                      
                              if (!this.canAdvance()) {
                      Severity: Minor
                      Found in src/schemas/Import.js - About 1 hr to fix

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

                        module.exports = (args, callback) => {
                            async.eachLimit(
                                Object.keys(options.types),
                                1,
                                (type, callback) => {
                        Severity: Minor
                        Found in src/utils/create-index.js - About 1 hr to fix

                          Function EditRecord has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const EditRecord = (props: Props) => {
                              const {record, mode, title} = props;
                              const postURL = record
                                  ? record._id
                                      ? record.getEditURL
                          Severity: Minor
                          Found in src/views/EditRecord.js - About 1 hr to fix

                            Function getFacets has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                getFacets(i18n, callback) {
                                    const {lang} = i18n;
                            
                                    if (!this.facetCache) {
                                        this.facetCache = {};
                            Severity: Minor
                            Found in src/schemas/Record.js - About 1 hr to fix

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

                              module.exports = app => {
                                  const Source = models("Source");
                              
                                  return {
                                      index({i18n, user}, res) {
                              Severity: Minor
                              Found in src/logic/home.js - About 1 hr to fix

                                Function uploadZipFile has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        uploadZipFile(req, res, next) {
                                            const {source, i18n, lang} = req;
                                
                                            const form = new formidable.IncomingForm();
                                            form.encoding = "utf-8";
                                Severity: Minor
                                Found in src/logic/source-admin.js - About 1 hr to fix

                                  Function facet has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      facet() {
                                          return {
                                              [this.options.name]: {
                                                  title: i18n => this.options.title(i18n),
                                  
                                  
                                  Severity: Minor
                                  Found in src/schemas/types/YearRange.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 addValue has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      addValue(addedValue: string, addedLabel: string) {
                                          const {onChange, value} = this.props;
                                          if ((!value || Array.isArray(value)) && onChange) {
                                              this.labelCache[addedValue] = addedLabel;
                                              onChange(
                                  Severity: Minor
                                  Found in src/views/shared/Select.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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language