Inlife/nexrender

View on GitHub

Showing 75 of 75 total issues

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

            try {
                return requireg('@nexrender/provider-' + protocol).download(job, settings, asset.src, asset.dest, asset.params || {});
            } catch (e) {
                if (e.message.indexOf('Could not require module') !== -1) {
                    return Promise.reject(new Error(`Couldn't find module @nexrender/provider-${protocol}, Unknown protocol provided.`))
Severity: Major
Found in packages/nexrender-core/src/tasks/download.js and 1 other location - About 1 hr to fix
packages/nexrender-action-upload/index.js on lines 41..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 60.

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

            try{
                /* try requiring custom providers */
                requirePackage = provider
                return requireg(requirePackage).upload(job, settings, input, params || {}, onProgress, onComplete);

Severity: Major
Found in packages/nexrender-action-upload/index.js and 1 other location - About 1 hr to fix
packages/nexrender-core/src/tasks/download.js on lines 149..157

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

const constructParams = (job, settings, { preset, input, output, params }) => {
    input = input || job.output;

    if (!path.isAbsolute(output)) output = path.join(job.workpath, output);

Severity: Minor
Found in packages/nexrender-action-encode/index.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 uriDigitalOcean has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function uriDigitalOcean(src) {
  const parsed = url.parse(src)
  const result = parsed.host.match(/(([^.]+)\.)?([^.]+)\.digitaloceanspaces\.com/)

  if (!result) {
Severity: Minor
Found in packages/nexrender-provider-s3/src/uri.js - About 1 hr to fix

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

    const upload = (job, settings, src, params) => {
        if (!params.host) throw new Error("SFTP Host not provided.");
        if (!params.port) throw new Error("SFTP Port not provided.");
        if (!params.user) throw new Error("SFTP Username not provided.");
        if (!params.password) throw new Error("SFTP Password not provided.");
    Severity: Minor
    Found in packages/nexrender-provider-sftp/src/index.js - About 1 hr to fix

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

      const upload = async (job, settings, src, params) => {
          if (!params.url) throw new Error('Provider NX: URL not provided.')
      
          const file = fs.createReadStream(src);
          const fileSize = fs.statSync(src).size;
      Severity: Minor
      Found in packages/nexrender-provider-nx/src/index.js - About 1 hr to fix

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

        const upload = (job, settings, src, params, onProgress, onComplete) => {
            const file = fs.createReadStream(src);
        
            if (!params.endpoint && !params.region) {
                return Promise.reject(new Error('S3 region or endpoint not provided.'))
        Severity: Minor
        Found in packages/nexrender-provider-s3/src/index.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 parse has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            const parse = (data) => {
                const string = ('' + data).replace(/;/g, ':'); /* sanitize string */
        
                // Only execute startRegex if project start hasnt been found
                const matchStart = isNaN(parseInt(projectStart)) ? startRegex.exec(string) : false;
        Severity: Minor
        Found in packages/nexrender-core/src/tasks/render.js - About 1 hr to fix

          Function EnhancedScript has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                      dest,
                      src,
                      parameters = [],
                      keyword = "NX",
                      defaults = {
          Severity: Major
          Found in packages/nexrender-core/src/tasks/script/EnhancedScript.js - About 50 mins to fix

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

                    case 'mp4':
                        params = Object.assign(baseParams, {
                            '-acodec': 'aac',
                            '-vcodec': 'libx264',
                            '-pix_fmt' : 'yuv420p',
            Severity: Minor
            Found in packages/nexrender-action-encode/index.js and 1 other location - About 45 mins to fix
            packages/nexrender-action-encode/index.js on lines 122..131

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 50.

            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

                    action(mockJob, mockSettings, params, 'postrender').then((job) => {
                        assert.strictEqual(job, mockJob);
                        done();
                    }).catch(done);
            Severity: Minor
            Found in packages/nexrender-action-copy/test.js and 1 other location - About 45 mins to fix
            packages/nexrender-action-copy/test.js on lines 39..42

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

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

            module.exports = async (req, res) => {
                const release = await mutex.acquire();
            
                try{
                    console.log(`fetching a pickup job for a worker`)
            Severity: Minor
            Found in packages/nexrender-server/src/routes/jobs-pickup.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

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

                if (options.hasOwnProperty('onProgress') && typeof options['onProgress'] == 'function') {
                    onProgress = (job, progress) => options.onProgress(job, progress);
                }
            Severity: Minor
            Found in packages/nexrender-action-upload/index.js and 1 other location - About 45 mins to fix
            packages/nexrender-action-upload/index.js on lines 27..29

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

            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 (options.hasOwnProperty('onComplete') && typeof options['onComplete'] == 'function') {
                    onComplete = (job, file) => options.onComplete(job, file);
                }
            Severity: Minor
            Found in packages/nexrender-action-upload/index.js and 1 other location - About 45 mins to fix
            packages/nexrender-action-upload/index.js on lines 23..25

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

            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

                    action(mockJob, mockSettings, mockParams, 'postrender').then((job) => {
                        assert.strictEqual(job, mockJob);
                        done();
                    }).catch(done);
            Severity: Minor
            Found in packages/nexrender-action-copy/test.js and 1 other location - About 45 mins to fix
            packages/nexrender-action-copy/test.js on lines 32..35

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

            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

                    case 'webm':
                        params = Object.assign(baseParams, {
                            '-acodec': 'libvorbis',
                            '-vcodec': 'libvpx',
                            '-b': '614400',
            Severity: Minor
            Found in packages/nexrender-action-encode/index.js and 1 other location - About 45 mins to fix
            packages/nexrender-action-encode/index.js on lines 101..110

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

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

            module.exports = (job, settings, { input, output, useJobId }, type) => {
                if (type != 'postrender') {
                    throw new Error(`Action ${name} can be only run in postrender mode, you provided: ${type}.`)
                }
            
            
            Severity: Minor
            Found in packages/nexrender-action-copy/index.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

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

                if (asset.src.startsWith('file://')) {
                    settings.logger.log(`> Skipping cache for ${asset.src}; local file protocol is being used`);
                    return;
                }
            Severity: Minor
            Found in packages/nexrender-action-cache/index.js and 1 other location - About 40 mins to fix
            packages/nexrender-action-cache/index.js on lines 50..53

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            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

                if (asset.src.startsWith('file://')) {
                    settings.logger.log(`> Skipping cache for ${asset.src}; local file protocol is being used`);
                    return;
                }
            Severity: Minor
            Found in packages/nexrender-action-cache/index.js and 1 other location - About 40 mins to fix
            packages/nexrender-action-cache/index.js on lines 5..8

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

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Function getCredentials has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            const getCredentials = params => {
                if (params && params.profile) {
                    // will throw if the profile is not configured
                    return new AWS.SharedIniFileCredentials({ profile: params.profile })
                } else if (params && params.accessKeyId && params.secretAccessKey) {
            Severity: Minor
            Found in packages/nexrender-provider-s3/src/index.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

            Severity
            Category
            Status
            Source
            Language