alientronics/fleetany-attributes

View on GitHub

Showing 9 of 32 total issues

Function set has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function set(Request $request, $entity_key, $entity_id, $company_id)
    {
        $entity = $this->entity;
        
        $files = [];
Severity: Minor
Found in app/Repositories/ValueRepository.php - 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 set has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function set(Request $request, $entity_key, $entity_id, $company_id)
    {
        $entity = $this->entity;
        
        $files = [];
Severity: Minor
Found in app/Repositories/ValueRepositoryDynamo.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

Method set has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function set(Request $request, $entity_key, $entity_id, $company_id)
    {
        $entity = $this->entity;
        
        $files = [];
Severity: Minor
Found in app/Repositories/ValueRepositoryDynamo.php - About 1 hr to fix

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

        private function searchKeys($company_id, $entity_key, $description)
        {
            $entity = $this->entity;
    
            $Keys = $entity::where('company_id', (int)$company_id);
    Severity: Minor
    Found in app/Repositories/KeyRepositoryDynamo.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

    Method set has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function set(Request $request, $entity_key, $entity_id, $company_id)
        {
            $entity = $this->entity;
            
            $files = [];
    Severity: Minor
    Found in app/Repositories/ValueRepository.php - About 1 hr to fix

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

          protected function seeInDatabase($table, array $data, $onConnection = null)
          {
              if (!empty($data)) {
                  foreach ($data as $index => $element) {
                      if (is_numeric($element) && $index == "value") {
      Severity: Minor
      Found in tests/acceptance/DynamoDbValueTest.php - 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 getRegisterInDatabase has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          private function getRegisterInDatabase($data)
          {
              if (!empty($data)) {
                  foreach ($data as $index => $element) {
                      if (is_numeric($element)) {
      Severity: Minor
      Found in tests/acceptance/DynamoDbKeyTest.php - 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 saveFiles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function saveFiles(Request $request, $files)
          {
              if (!empty($files)) {
                  foreach ($files as $file_attribute) {
                      if ($request->hasFile($file_attribute)) {
      Severity: Minor
      Found in app/Repositories/HelperRepository.php - 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 getDynamoDbLastRecordId has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function getDynamoDbLastRecordId($entity)
          {
              $Keys = $entity::where([]);
              $Keys = $Keys->get();
          
      Severity: Minor
      Found in app/Repositories/HelperRepository.php - 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