fossasia/engelsystem

View on GitHub
includes/controller/users_controller.php

Summary

Maintainability
D
2 days
Test Coverage

Function user_password_recovery_controller has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

function user_password_recovery_controller() {
  if (isset($_REQUEST['token'])) {
    $user_source = User_by_password_recovery_token($_REQUEST['token']);
    if ($user_source === false)
      engelsystem_error("Unable to load user.");
Severity: Minor
Found in includes/controller/users_controller.php - About 1 day 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 user_password_recovery_controller has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function user_password_recovery_controller() {
  if (isset($_REQUEST['token'])) {
    $user_source = User_by_password_recovery_token($_REQUEST['token']);
    if ($user_source === false)
      engelsystem_error("Unable to load user.");
Severity: Major
Found in includes/controller/users_controller.php - About 2 hrs to fix

    Function user_edit_vouchers_controller has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    function user_edit_vouchers_controller() {
      global $privileges, $user;
    
      if (isset($_REQUEST['user_id'])) {
        $user_source = User($_REQUEST['user_id']);
    Severity: Minor
    Found in includes/controller/users_controller.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 user_delete_controller has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    function user_delete_controller() {
      global $privileges, $user;
    
      if (isset($_REQUEST['user_id'])) {
        $user_source = User($_REQUEST['user_id']);
    Severity: Minor
    Found in includes/controller/users_controller.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 user_delete_controller has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function user_delete_controller() {
      global $privileges, $user;
    
      if (isset($_REQUEST['user_id'])) {
        $user_source = User($_REQUEST['user_id']);
    Severity: Minor
    Found in includes/controller/users_controller.php - About 1 hr to fix

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

      function user_edit_vouchers_controller() {
        global $privileges, $user;
      
        if (isset($_REQUEST['user_id'])) {
          $user_source = User($_REQUEST['user_id']);
      Severity: Minor
      Found in includes/controller/users_controller.php - About 1 hr to fix

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

        function user_controller() {
          global $privileges, $user;
        
          if (isset($_REQUEST['user_id'])) {
            $user_source = User($_REQUEST['user_id']);
        Severity: Minor
        Found in includes/controller/users_controller.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

        Avoid too many return statements within this method.
        Open

              return user_edit_vouchers_controller();
        Severity: Major
        Found in includes/controller/users_controller.php - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status