Sleepness/UberFrontendValidationBundle

View on GitHub

Showing 7 of 22 total issues

Function UberLengthValidationConstraint has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

function UberLengthValidationConstraint(field) {
    this.message = 'Field {{ field_name }} should have more than {{ min }} characters and less than {{ max }} characters.';

    this.validate = function () {
        var error = '',
Severity: Minor
Found in Resources/public/js/constraints/Length.js - About 2 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 prepareConstraintsAttributes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    private function prepareConstraintsAttributes($fieldName, $entityMetadata, $validationGroups)
    {
        $result = array();
        preg_match("/\[([^\]]*)\]/", $fieldName, $matches);
        $parsedFieldName = $matches[1];
Severity: Minor
Found in Form/Extension/UberFrontendValidationFormExtension.php - 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 UberLengthValidationConstraint has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function UberLengthValidationConstraint(field) {
    this.message = 'Field {{ field_name }} should have more than {{ min }} characters and less than {{ max }} characters.';

    this.validate = function () {
        var error = '',
Severity: Minor
Found in Resources/public/js/constraints/Length.js - About 1 hr to fix

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

        this.validate = function () {
            var error = '',
                definedDataMin = field.attr('data-min'),
                definedDataMax = field.attr('data-max'),
                fieldName = parse_field_name(field.attr('name')),
    Severity: Minor
    Found in Resources/public/js/constraints/Length.js - About 1 hr to fix

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

      function UberFileValidationConstraint(field) {
          this.message = 'Field {{ field_name }} should be a file.';
      
          this.validate = function () {
              var field_id = field.attr('id'),
      Severity: Minor
      Found in Resources/public/js/constraints/File.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 UberImageValidationConstraint has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function UberImageValidationConstraint(field) {
          this.message = 'Field {{ field_name }} is not an image.';
      
          this.validate = function () {
              var error = '';
      Severity: Minor
      Found in Resources/public/js/constraints/Image.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 UberEqualToValidationConstraint has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function UberEqualToValidationConstraint(field) {
          this.message = 'Field {{ field_name }} should be equal to {{ compared_value }}.';
      
          this.validate = function () {
              var error = '';
      Severity: Minor
      Found in Resources/public/js/constraints/EqualTo.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