Inlife/nexrender

View on GitHub

Showing 75 of 75 total issues

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

module.exports = actionType => (job, settings) => {
    settings.logger.log(`[${job.uid}] applying ${actionType} actions...`);

    return PromiseSerial((job.actions[actionType] || []).map(action => () => {
        settings.track(`Job Action Started`, {
Severity: Minor
Found in packages/nexrender-core/src/tasks/actions.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

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

module.exports.getJob = async id => {
    console.warn("`getJob()` has been deprecated and will be removed in a future version. Please use `resumeJob()` instead.")
    return module.exports.resumeJob(id)
}
Severity: Minor
Found in packages/nexrender-api/src/job.js and 1 other location - About 35 mins to fix
packages/nexrender-api/src/job.js on lines 72..75

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 (args['--help']) {
    console.error(chalk`
  {bold.cyan nexrender-worker} - nexrender render worker
  {bold.cyan version} - v${version}

Severity: Minor
Found in packages/nexrender-worker/src/bin.js and 1 other location - About 35 mins to fix
packages/nexrender-server/src/bin.js on lines 28..67

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

module.exports.removejob = async id => {
    console.warn("`removejob()` has been deprecated and will be removed in a future version. Please use `removeJob()` instead.")
    return module.exports.removeJob(id)
}
Severity: Minor
Found in packages/nexrender-api/src/job.js and 1 other location - About 35 mins to fix
packages/nexrender-api/src/job.js on lines 76..79

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 (args['--help']) {
    console.error(chalk`
  {bold.cyan nexrender-server} - nexrender api server
  {bold.cyan version} - v${version}

Severity: Minor
Found in packages/nexrender-server/src/bin.js and 1 other location - About 35 mins to fix
packages/nexrender-worker/src/bin.js on lines 64..181

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

        case 'ogg':
            params = Object.assign(baseParams, {
                '-acodec': 'libvorbis',
                '-vcodec': 'libtheora',
                '-r': '25',
Severity: Minor
Found in packages/nexrender-action-encode/index.js and 1 other location - About 30 mins to fix
packages/nexrender-action-encode/index.js on lines 141..149

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

Avoid too many return statements within this function.
Open

        return { accessKeyId: process.env.AWS_ACCESS_KEY, secretAccessKey: process.env.AWS_SECRET_KEY }
Severity: Major
Found in packages/nexrender-provider-s3/src/index.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                    return requireg('@nexrender/provider-' + protocol).download(job, settings, asset.src, asset.dest, asset.params || {});
    Severity: Major
    Found in packages/nexrender-core/src/tasks/download.js - About 30 mins to fix

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

              case 'm4a':
                  params = Object.assign(baseParams, {
                      '-acodec': 'aac',
                      '-ab': '64k',
                      '-strict': '-2',
      Severity: Minor
      Found in packages/nexrender-action-encode/index.js and 1 other location - About 30 mins to fix
      packages/nexrender-action-encode/index.js on lines 112..120

      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

      Avoid too many return statements within this function.
      Open

          return new Promise((resolve, reject) => {
              file.on('error', (err) => reject(err))
      
              const awsParams = {
                  Bucket: params.bucket,
      Severity: Major
      Found in packages/nexrender-provider-s3/src/index.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                            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 - About 30 mins to fix

          Function predownload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          const predownload = async (job, settings, { cacheDirectory, ttl, cacheAssets }) => {
              // Job template
              await findValidateCache(job.template, settings, cacheDirectory, ttl);
          
              if(cacheAssets){
          Severity: Minor
          Found in packages/nexrender-action-cache/index.js - About 25 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 getBinary has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          const getBinary = (job, settings) => {
              return new Promise((resolve, reject) => {
                  const {version} = pkg['ffmpeg-static']
                  const filename = `ffmpeg-${version}${process.platform == 'win32' ? '.exe' : ''}`
                  const fileurl = `https://github.com/eugeneware/ffmpeg-static/releases/download/${version}/${process.platform}-x64`
          Severity: Minor
          Found in packages/nexrender-action-encode/index.js - About 25 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 parseMethodWithArgs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              EnhancedScript.prototype.parseMethodWithArgs = function (parameter) {
                  let value = parameter.value;
                  const methodArgs = [...parameter.value.matchAll(getSearchUsageByMethodRegex(this.keyword, 'arg', "gm"))];
          
                  if (methodArgs.length > 0 ) {
          Severity: Minor
          Found in packages/nexrender-core/src/tasks/script/EnhancedScript.js - About 25 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 postdownload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          const postdownload = async (job, settings, { cacheDirectory, cacheAssets }) => {
              // Job template
              await saveCache(job.template, settings, job.workpath, cacheDirectory);
          
              if(cacheAssets){
          Severity: Minor
          Found in packages/nexrender-action-cache/index.js - About 25 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