bcgov/common-object-management-service

View on GitHub
app/src/controllers/object.js

Summary

Maintainability
F
2 wks
Test Coverage
F
41%

File object.js has 793 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const Problem = require('api-problem');
const cors = require('cors');
const { v4: uuidv4, NIL: SYSTEM_USER } = require('uuid');

const {
Severity: Major
Found in app/src/controllers/object.js - About 1 day to fix

    Function updateObject has 116 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async updateObject(req, res, next) {
        try {
          const userId = await userService.getCurrentUserId(getCurrentIdentity(req.currentUser, SYSTEM_USER));
    
          // Preflight existence check for bucketId
    Severity: Major
    Found in app/src/controllers/object.js - About 4 hrs to fix

      Function createObject has 110 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async createObject(req, res, next) {
          try {
            const userId = await userService.getCurrentUserId(getCurrentIdentity(req.currentUser, SYSTEM_USER));
      
            // Preflight CREATE permission check if bucket scoped and OIDC authenticated
      Severity: Major
      Found in app/src/controllers/object.js - About 4 hrs to fix

        Function updateObject has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

          async updateObject(req, res, next) {
            try {
              const userId = await userService.getCurrentUserId(getCurrentIdentity(req.currentUser, SYSTEM_USER));
        
              // Preflight existence check for bucketId
        Severity: Minor
        Found in app/src/controllers/object.js - 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 createObject has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

          async createObject(req, res, next) {
            try {
              const userId = await userService.getCurrentUserId(getCurrentIdentity(req.currentUser, SYSTEM_USER));
        
              // Preflight CREATE permission check if bucket scoped and OIDC authenticated
        Severity: Minor
        Found in app/src/controllers/object.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

        Function deleteMetadata has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async deleteMetadata(req, res, next) {
            try {
              const bucketId = req.currentObject?.bucketId;
              const objId = addDashesToUuid(req.params.objectId);
              const objPath = req.currentObject?.path;
        Severity: Major
        Found in app/src/controllers/object.js - About 2 hrs to fix

          Function addMetadata has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async addMetadata(req, res, next) {
              try {
                const bucketId = req.currentObject?.bucketId;
                const objId = addDashesToUuid(req.params.objectId);
                const objPath = req.currentObject?.path;
          Severity: Major
          Found in app/src/controllers/object.js - About 2 hrs to fix

            Function replaceMetadata has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              async replaceMetadata(req, res, next) {
                try {
                  const bucketId = req.currentObject?.bucketId;
                  const objId = addDashesToUuid(req.params.objectId);
                  const objPath = req.currentObject?.path;
            Severity: Major
            Found in app/src/controllers/object.js - About 2 hrs to fix

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

                async addTags(req, res, next) {
                  try {
                    const bucketId = req.currentObject?.bucketId;
                    const objId = addDashesToUuid(req.params.objectId);
                    const objPath = req.currentObject?.path;
              Severity: Minor
              Found in app/src/controllers/object.js - About 1 hr to fix

                Function deleteTags has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  async deleteTags(req, res, next) {
                    try {
                      const bucketId = req.currentObject?.bucketId;
                      const objId = addDashesToUuid(req.params.objectId);
                      const objPath = req.currentObject?.path;
                Severity: Minor
                Found in app/src/controllers/object.js - About 1 hr to fix

                  Function deleteObject has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    async deleteObject(req, res, next) {
                      try {
                        const objId = addDashesToUuid(req.params.objectId);
                        const userId = await userService.getCurrentUserId(getCurrentIdentity(req.currentUser, SYSTEM_USER));
                  
                  
                  Severity: Minor
                  Found in app/src/controllers/object.js - About 1 hr to fix

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

                      async readObject(req, res, next) {
                        try {
                          const objId = addDashesToUuid(req.params.objectId);
                    
                          // target S3 version
                    Severity: Minor
                    Found in app/src/controllers/object.js - About 1 hr to fix

                      Function searchObjects has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        async searchObjects(req, res, next) {
                          // TODO: Consider support for filtering by set of permissions?
                          // TODO: handle additional parameters. Eg: deleteMarker, latest
                          try {
                            const bucketIds = mixedQueryToArray(req.query.bucketId);
                      Severity: Minor
                      Found in app/src/controllers/object.js - About 1 hr to fix

                        Function dbResponse has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              const dbResponse = await utils.trxWrapper(async (trx) => {
                                // Update Object
                                const object = await objectService.update({
                                  ...data,
                                  userId: userId,
                        Severity: Minor
                        Found in app/src/controllers/object.js - About 1 hr to fix

                          Function _processS3Headers has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            _processS3Headers(s3Resp, res) {
                              // TODO: Consider adding 'x-coms-public' and 'x-coms-path' headers into API spec?
                              const exposedHeaders = [];
                          
                              if (s3Resp.ContentLength) res.set('Content-Length', s3Resp.ContentLength);
                          Severity: Minor
                          Found in app/src/controllers/object.js - About 1 hr to fix

                            Function readObject has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                              async readObject(req, res, next) {
                                try {
                                  const objId = addDashesToUuid(req.params.objectId);
                            
                                  // target S3 version
                            Severity: Minor
                            Found in app/src/controllers/object.js - About 55 mins 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 deleteObject has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                              async deleteObject(req, res, next) {
                                try {
                                  const objId = addDashesToUuid(req.params.objectId);
                                  const userId = await userService.getCurrentUserId(getCurrentIdentity(req.currentUser, SYSTEM_USER));
                            
                            
                            Severity: Minor
                            Found in app/src/controllers/object.js - About 45 mins 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 searchObjects has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                              async searchObjects(req, res, next) {
                                // TODO: Consider support for filtering by set of permissions?
                                // TODO: handle additional parameters. Eg: deleteMarker, latest
                                try {
                                  const bucketIds = mixedQueryToArray(req.query.bucketId);
                            Severity: Minor
                            Found in app/src/controllers/object.js - About 35 mins 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 _processS3Headers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                              _processS3Headers(s3Resp, res) {
                                // TODO: Consider adding 'x-coms-public' and 'x-coms-path' headers into API spec?
                                const exposedHeaders = [];
                            
                                if (s3Resp.ContentLength) res.set('Content-Length', s3Resp.ContentLength);
                            Severity: Minor
                            Found in app/src/controllers/object.js - About 35 mins 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

                            TODO found
                            Open

                                      // TODO: Add in sync operation to update object record in COMS DB?
                            Severity: Minor
                            Found in app/src/controllers/object.js by fixme

                            TODO found
                            Open

                                  // TODO: Proper 304 caching logic (with If-Modified-Since header support)
                            Severity: Minor
                            Found in app/src/controllers/object.js by fixme

                            TODO found
                            Open

                                    // TODO: Proper 304 caching logic (with If-Modified-Since header support)
                            Severity: Minor
                            Found in app/src/controllers/object.js by fixme

                            TODO found
                            Open

                                    // TODO: Consider if we need a HEAD operation first before doing the actual read on large files
                            Severity: Minor
                            Found in app/src/controllers/object.js by fixme

                            TODO found
                            Open

                                // TODO: handle additional parameters. Eg: deleteMarker, latest
                            Severity: Minor
                            Found in app/src/controllers/object.js by fixme

                            TODO found
                            Open

                                    // TODO: use req.currentObject.bucketId
                            Severity: Minor
                            Found in app/src/controllers/object.js by fixme

                            TODO found
                            Open

                                  // TODO: sync with current versions in S3
                            Severity: Minor
                            Found in app/src/controllers/object.js by fixme

                            TODO found
                            Open

                                // TODO: Consider adding 'x-coms-public' and 'x-coms-path' headers into API spec?
                            Severity: Minor
                            Found in app/src/controllers/object.js by fixme

                            TODO found
                            Open

                                // TODO: Consider support for filtering by set of permissions?
                            Severity: Minor
                            Found in app/src/controllers/object.js by fixme

                            TODO found
                            Open

                                    // TODO: Implement if/when we proceed with version-scoped public permission management
                            Severity: Minor
                            Found in app/src/controllers/object.js by fixme

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

                                  await utils.trxWrapper(async (trx) => {
                                    // create or update version (if a non-versioned object)
                                    const version = s3Response.VersionId ?
                                      await versionService.copy(
                                        sourceS3VersionId, s3Response.VersionId, objId, s3Response.CopyObjectResult?.ETag,
                            Severity: Major
                            Found in app/src/controllers/object.js and 2 other locations - About 1 day to fix
                            app/src/controllers/object.js on lines 149..170
                            app/src/controllers/object.js on lines 456..476

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

                            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

                                  await utils.trxWrapper(async (trx) => {
                                    // create or update version in DB(if a non-versioned object)
                                    const version = s3Response.VersionId ?
                                      await versionService.copy(
                                        sourceS3VersionId, s3Response.VersionId, objId, s3Response.CopyObjectResult?.ETag,
                            Severity: Major
                            Found in app/src/controllers/object.js and 2 other locations - About 1 day to fix
                            app/src/controllers/object.js on lines 149..170
                            app/src/controllers/object.js on lines 847..868

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

                            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

                                  await utils.trxWrapper(async (trx) => {
                                    // create or update version in DB (if a non-versioned object)
                                    const version = s3Response.VersionId ?
                                      await versionService.copy(
                                        sourceS3VersionId, s3Response.VersionId, objId, s3Response.CopyObjectResult?.ETag,
                            Severity: Major
                            Found in app/src/controllers/object.js and 2 other locations - About 1 day to fix
                            app/src/controllers/object.js on lines 456..476
                            app/src/controllers/object.js on lines 847..868

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

                            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

                                    if (req.currentUpload.contentLength < MAXCOPYOBJECTLENGTH) {
                                      log.debug('Uploading with putObject', {
                                        contentLength: req.currentUpload.contentLength,
                                        function: 'createObject',
                                        uploadMethod: 'putObject'
                            Severity: Major
                            Found in app/src/controllers/object.js and 1 other location - About 7 hrs to fix
                            app/src/controllers/object.js on lines 1050..1069

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

                            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

                                    if (req.currentUpload.contentLength < MAXCOPYOBJECTLENGTH) {
                                      log.debug('Uploading with putObject', {
                                        contentLength: req.currentUpload.contentLength,
                                        function: 'createObject',
                                        uploadMethod: 'putObject'
                            Severity: Major
                            Found in app/src/controllers/object.js and 1 other location - About 7 hrs to fix
                            app/src/controllers/object.js on lines 325..344

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

                            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 params = {
                                    bucketIds: bucketIds ? bucketIds.map(id => addDashesToUuid(id)) : bucketIds,
                                    objId: objIds ? objIds.map(id => addDashesToUuid(id)) : objIds,
                                    metadata: metadata && Object.keys(metadata).length ? metadata : undefined
                                  };
                            Severity: Major
                            Found in app/src/controllers/object.js and 1 other location - About 2 hrs to fix
                            app/src/controllers/object.js on lines 652..656

                            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

                                  const params = {
                                    bucketIds: bucketIds ? bucketIds.map(id => addDashesToUuid(id)) : bucketIds,
                                    objectIds: objIds ? objIds.map(id => addDashesToUuid(id)) : objIds,
                                    tagset: tagset && Object.keys(tagset).length ? tagset : undefined,
                                  };
                            Severity: Major
                            Found in app/src/controllers/object.js and 1 other location - About 2 hrs to fix
                            app/src/controllers/object.js on lines 623..627

                            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

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

                                  Object.entries(s3Resp.Metadata).forEach(([key, value]) => {
                                    const metadata = `x-amz-meta-${key}`;
                                    res.set(metadata, value);
                                    exposedHeaders.push(metadata);
                                  });
                            Severity: Major
                            Found in app/src/controllers/object.js and 1 other location - About 1 hr to fix
                            app/src/controllers/bucket.js on lines 48..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 71.

                            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

                                    const version = await versionService.create({
                                      ...data,
                                      etag: s3Response.ETag,
                                      s3VersionId: s3VersionId,
                                      isLatest: true,
                            Severity: Major
                            Found in app/src/controllers/object.js and 1 other location - About 1 hr to fix
                            app/src/controllers/object.js on lines 1113..1119

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

                            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 data = {
                                    bucketId,
                                    copySource: objPath,
                                    filePath: objPath,
                                    metadata: newMetadata,
                            Severity: Major
                            Found in app/src/controllers/object.js and 1 other location - About 1 hr to fix
                            app/src/controllers/object.js on lines 439..452

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

                            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

                                      version = await versionService.create({
                                        ...data,
                                        etag: s3Response.ETag,
                                        s3VersionId: s3VersionId,
                                        isLatest: true,
                            Severity: Major
                            Found in app/src/controllers/object.js and 1 other location - About 1 hr to fix
                            app/src/controllers/object.js on lines 362..368

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

                            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 data = {
                                    bucketId: bucketId,
                                    copySource: objPath,
                                    filePath: objPath,
                                    metadata: metadata,
                            Severity: Major
                            Found in app/src/controllers/object.js and 1 other location - About 1 hr to fix
                            app/src/controllers/object.js on lines 831..844

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

                            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

                                    if (data.metadata && Object.keys(data.metadata).length) {
                                      await metadataService.associateMetadata(version.id, getKeyValue(data.metadata), userId, trx);
                                    }
                            Severity: Major
                            Found in app/src/controllers/object.js and 1 other location - About 1 hr to fix
                            app/src/controllers/object.js on lines 372..374

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

                            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

                                    if (data.metadata && Object.keys(data.metadata).length) {
                                      await metadataService.associateMetadata(version.id, getKeyValue(data.metadata), userId, trx);
                                    }
                            Severity: Major
                            Found in app/src/controllers/object.js and 1 other location - About 1 hr to fix
                            app/src/controllers/object.js on lines 1131..1133

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

                            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

                                    if (data.tags && Object.keys(data.tags).length) {
                                      await tagService.associateTags(version.id, getKeyValue(data.tags), userId, trx);
                                    }
                            Severity: Major
                            Found in app/src/controllers/object.js and 1 other location - About 1 hr to fix
                            app/src/controllers/object.js on lines 1136..1138

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

                            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

                                    if (data.tags && Object.keys(data.tags).length) {
                                      await tagService.replaceTags(version.id, getKeyValue(data.tags), userId, trx);
                                    }
                            Severity: Major
                            Found in app/src/controllers/object.js and 1 other location - About 1 hr to fix
                            app/src/controllers/object.js on lines 377..379

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

                            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 newTags = Object.entries({ ...req.query.tagset }).map(([k, v]) => ({ Key: k, Value: v }));
                            Severity: Major
                            Found in app/src/controllers/object.js and 1 other location - About 1 hr to fix
                            app/src/controllers/object.js on lines 194..194

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

                            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 newTags = Object.entries({ ...req.query.tagset }).map(([k, v]) => ({ Key: k, Value: v }));
                            Severity: Major
                            Found in app/src/controllers/object.js and 1 other location - About 1 hr to fix
                            app/src/controllers/object.js on lines 890..890

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

                            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 sourceTags = Object.assign({},
                                    ...(sourceObject.TagSet?.map(item => ({ [item.Key]: item.Value })) ?? [])
                                  );
                            Severity: Major
                            Found in app/src/controllers/object.js and 2 other locations - About 55 mins to fix
                            app/src/controllers/object.js on lines 127..129
                            app/src/controllers/object.js on lines 435..437

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

                            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 sourceTags = Object.assign({},
                                    ...(sourceObject.TagSet?.map(item => ({ [item.Key]: item.Value })) ?? [])
                                  );
                            Severity: Major
                            Found in app/src/controllers/object.js and 2 other locations - About 55 mins to fix
                            app/src/controllers/object.js on lines 435..437
                            app/src/controllers/object.js on lines 825..827

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

                            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 sourceTags = Object.assign({},
                                    ...(sourceObject.TagSet?.map(item => ({ [item.Key]: item.Value })) ?? [])
                                  );
                            Severity: Major
                            Found in app/src/controllers/object.js and 2 other locations - About 55 mins to fix
                            app/src/controllers/object.js on lines 127..129
                            app/src/controllers/object.js on lines 825..827

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

                            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 s3Head = await storageService.headObject({
                                    filePath: joinPath(bucketKey, req.currentUpload.filename),
                                    bucketId: bucketId
                                  }).catch(() => ({}));
                            Severity: Minor
                            Found in app/src/controllers/object.js and 1 other location - About 55 mins to fix
                            app/src/controllers/object.js on lines 1096..1099

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

                            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 s3Head = await storageService.headObject({
                                    filePath: joinPath(bucketKey, req.currentUpload.filename),
                                    bucketId: bucketId
                                  }).catch(() => ({}));
                            Severity: Minor
                            Found in app/src/controllers/object.js and 1 other location - About 55 mins to fix
                            app/src/controllers/object.js on lines 347..350

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

                            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

                                    if (err.$metadata?.httpStatusCode !== 404) {
                                      throw new Problem(502, {
                                        detail: 'Bucket communication error',
                                        instance: req.originalUrl
                                      });
                            Severity: Minor
                            Found in app/src/controllers/object.js and 1 other location - About 35 mins to fix
                            app/src/controllers/object.js on lines 1042..1047

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

                            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

                                    if (headResponse.$metadata?.httpStatusCode !== 200) {
                                      throw new Problem(502, {
                                        detail: 'Bucket communication error',
                                        instance: req.originalUrl
                                      });
                            Severity: Minor
                            Found in app/src/controllers/object.js and 1 other location - About 35 mins to fix
                            app/src/controllers/object.js on lines 317..322

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

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

                                if (s3Resp.VersionId) {
                                  const s3VersionId = 'x-amz-version-id';
                                  res.set(s3VersionId, s3Resp.VersionId);
                                  exposedHeaders.push(s3VersionId);
                                }
                            Severity: Major
                            Found in app/src/controllers/object.js and 5 other locations - About 30 mins to fix
                            app/src/controllers/bucket.js on lines 41..45
                            app/src/controllers/bucket.js on lines 56..60
                            app/src/controllers/bucket.js on lines 61..65
                            app/src/controllers/object.js on lines 62..66
                            app/src/controllers/object.js on lines 76..80

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

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

                                if (s3Resp.ETag) {
                                  const etag = 'ETag';
                                  res.set(etag, s3Resp.ETag);
                                  exposedHeaders.push(etag);
                                }
                            Severity: Major
                            Found in app/src/controllers/object.js and 5 other locations - About 30 mins to fix
                            app/src/controllers/bucket.js on lines 41..45
                            app/src/controllers/bucket.js on lines 56..60
                            app/src/controllers/bucket.js on lines 61..65
                            app/src/controllers/object.js on lines 76..80
                            app/src/controllers/object.js on lines 81..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 45.

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

                                if (s3Resp.ServerSideEncryption) {
                                  const sse = 'x-amz-server-side-encryption';
                                  res.set(sse, s3Resp.ServerSideEncryption);
                                  exposedHeaders.push(sse);
                                }
                            Severity: Major
                            Found in app/src/controllers/object.js and 5 other locations - About 30 mins to fix
                            app/src/controllers/bucket.js on lines 41..45
                            app/src/controllers/bucket.js on lines 56..60
                            app/src/controllers/bucket.js on lines 61..65
                            app/src/controllers/object.js on lines 62..66
                            app/src/controllers/object.js on lines 81..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 45.

                            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

                            There are no issues that match your filters.

                            Category
                            Status