wyvern8/akamai-nginx

View on GitHub

Showing 26 of 28 total issues

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

export class CriteriaQueryStringParameter extends Criteria {

    constructor(options, valueMap) {
        super();
        this.options = options;
Severity: Major
Found in src/criteria/queryStringParameter.js and 2 other locations - About 2 hrs to fix
src/criteria/requestCookie.js on lines 3..16
src/criteria/requestHeader.js on lines 3..16

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

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

export class CriteriaRequestHeader extends Criteria {

    constructor(options, valueMap) {
        super();
        this.options = options;
Severity: Major
Found in src/criteria/requestHeader.js and 2 other locations - About 2 hrs to fix
src/criteria/queryStringParameter.js on lines 3..16
src/criteria/requestCookie.js on lines 3..16

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

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

export class CriteriaRequestCookie extends Criteria {

    constructor(options, valueMap) {
        super();
        this.options = options;
Severity: Major
Found in src/criteria/requestCookie.js and 2 other locations - About 2 hrs to fix
src/criteria/queryStringParameter.js on lines 3..16
src/criteria/requestHeader.js on lines 3..16

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

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

export class CriteriaContentType extends Criteria {

    constructor(options, valueMap) {
        super();
        this.options = options;
Severity: Major
Found in src/criteria/contentType.js and 6 other locations - About 2 hrs to fix
src/criteria/fileExtension.js on lines 3..16
src/criteria/filename.js on lines 3..16
src/criteria/hostname.js on lines 3..16
src/criteria/requestMethod.js on lines 3..16
src/criteria/requestProtocol.js on lines 3..16
src/criteria/userAgent.js on lines 3..16

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

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

export class CriteriaFileExtension extends Criteria {

    constructor(options, valueMap) {
        super();
        this.options = options;
Severity: Major
Found in src/criteria/fileExtension.js and 6 other locations - About 2 hrs to fix
src/criteria/contentType.js on lines 3..16
src/criteria/filename.js on lines 3..16
src/criteria/hostname.js on lines 3..16
src/criteria/requestMethod.js on lines 3..16
src/criteria/requestProtocol.js on lines 3..16
src/criteria/userAgent.js on lines 3..16

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

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

export class CriteriaHostname extends Criteria {

    constructor(options, valueMap) {
        super();
        this.options = options;
Severity: Major
Found in src/criteria/hostname.js and 6 other locations - About 2 hrs to fix
src/criteria/contentType.js on lines 3..16
src/criteria/fileExtension.js on lines 3..16
src/criteria/filename.js on lines 3..16
src/criteria/requestMethod.js on lines 3..16
src/criteria/requestProtocol.js on lines 3..16
src/criteria/userAgent.js on lines 3..16

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

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

export class CriteriaUserAgent extends Criteria {

    constructor(options, valueMap) {
        super();
        this.options = options;
Severity: Major
Found in src/criteria/userAgent.js and 6 other locations - About 2 hrs to fix
src/criteria/contentType.js on lines 3..16
src/criteria/fileExtension.js on lines 3..16
src/criteria/filename.js on lines 3..16
src/criteria/hostname.js on lines 3..16
src/criteria/requestMethod.js on lines 3..16
src/criteria/requestProtocol.js on lines 3..16

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

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

export class CriteriaRequestProtocol extends Criteria {

    constructor(options, valueMap) {
        super();
        this.options = options;
Severity: Major
Found in src/criteria/requestProtocol.js and 6 other locations - About 2 hrs to fix
src/criteria/contentType.js on lines 3..16
src/criteria/fileExtension.js on lines 3..16
src/criteria/filename.js on lines 3..16
src/criteria/hostname.js on lines 3..16
src/criteria/requestMethod.js on lines 3..16
src/criteria/userAgent.js on lines 3..16

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

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

export class CriteriaFilename extends Criteria {

    constructor(options, valueMap) {
        super();
        this.options = options;
Severity: Major
Found in src/criteria/filename.js and 6 other locations - About 2 hrs to fix
src/criteria/contentType.js on lines 3..16
src/criteria/fileExtension.js on lines 3..16
src/criteria/hostname.js on lines 3..16
src/criteria/requestMethod.js on lines 3..16
src/criteria/requestProtocol.js on lines 3..16
src/criteria/userAgent.js on lines 3..16

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

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

export class CriteriaRequestMethod extends Criteria {

    constructor(options, valueMap) {
        super();
        this.options = options;
Severity: Major
Found in src/criteria/requestMethod.js and 6 other locations - About 2 hrs to fix
src/criteria/contentType.js on lines 3..16
src/criteria/fileExtension.js on lines 3..16
src/criteria/filename.js on lines 3..16
src/criteria/hostname.js on lines 3..16
src/criteria/requestProtocol.js on lines 3..16
src/criteria/userAgent.js on lines 3..16

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

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

export class BehaviorAllowPost extends Behavior {

    constructor(options, valueMap) {
        super();
        this.options = options;
Severity: Major
Found in src/behaviors/allowPost.js and 1 other location - About 1 hr to fix
src/behaviors/allowPut.js on lines 3..14

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

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

export class BehaviorAllowPut extends Behavior {

    constructor(options, valueMap) {
        super();
        this.options = options;
Severity: Major
Found in src/behaviors/allowPut.js and 1 other location - About 1 hr to fix
src/behaviors/allowPost.js on lines 3..14

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

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

    setVariableLua(options) {

        let lua = ['local result'];

        if (options.valueSource === 'EXPRESSION') {
Severity: Minor
Found in src/behaviors/setVariable.js - About 1 hr to fix

    Function process has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        process() {
    
            let expires = this.expires();
    
            let lua = this.switchByVal({
    Severity: Minor
    Found in src/behaviors/downstreamCache.js - About 1 hr to fix

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

              if (this.options.matchOperator === 'IS_BETWEEN') {
                  return ('(' + this.checkVar + ' > tonumber("' + this.options.lowerBound + '") and ' +
                      this.checkVar + ' < tonumber("' + this.options.upperBound + '"))');
      
              } else if (this.options.matchOperator === 'IS_NOT_BETWEEN') {
      Severity: Major
      Found in src/criteria/matchVariable.js and 1 other location - About 1 hr to fix
      src/criteria/matchVariable.js on lines 45..51

      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

              } else if (this.options.matchOperator === 'IS_NOT_BETWEEN') {
                  return ('(' + this.checkVar + ' < tonumber("' + this.options.lowerBound + '") or ' +
                      this.checkVar + ' > tonumber("' + this.options.upperBound + '"))');
      
              } else {
      Severity: Major
      Found in src/criteria/matchVariable.js and 1 other location - About 1 hr to fix
      src/criteria/matchVariable.js on lines 41..51

      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

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

          process() {
      
              let result = '\n' + this.pad(this.depth) + '-- ' + this.name + ' rule ####';
              let criteriaNames = this.criteriaNames(this.criteria) ? this.criteriaNames(this.criteria) : 'none';
              result += '\n'  + this.pad(this.depth) + '-- criteria: ' + criteriaNames;
      Severity: Minor
      Found in src/rule.js - About 1 hr to fix

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

            processHeaderOptions(luaMapName, comment, capture) {
                let headerName = this.switchByVal({
                    'MODIFY': this.getHeaderName('standardModifyHeaderName'),
                    'ADD': this.getHeaderName('standardAddHeaderName'),
                    'REMOVE': this.getHeaderName('standardRemoveHeaderName'),
        Severity: Minor
        Found in src/behavior.js - About 1 hr to fix

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

              constructor(options, valueMap) {
                  super();
                  this.options = options;
                  this.valueMap = valueMap;
          
          
          Severity: Minor
          Found in src/criteria/matchVariable.js - About 1 hr to fix

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

                process(usePattern, valueSuffix) {
            
                    if (['EXISTS', 'IS_NOT_EMPTY', 'DOES_NOT_EXIST', 'IS_EMPTY'].includes(this.options.matchOperator)) {
            
                        return this.checkVar + this.matchOperatorCompare() + 'nil' +
            Severity: Minor
            Found in src/criteria.js - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language