gios-asu/nectary

View on GitHub

Showing 26 of 26 total issues

Avoid too many return statements within this method.
Open

            return ''; }
Severity: Major
Found in src/utilities/dao-utilities.php - About 30 mins to fix

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

        private function get_named_arguments() : array {
            // name the parameters
            $named_arguments = [];
    
            if ( array_key_exists( 'expects', $this->routes[ $this->__method_name ] ) ) {
    Severity: Minor
    Found in src/routers/router.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 resolve_dependencies has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private function resolve_dependencies( array $reflector_parameters, array $named_arguments = [] ) : array {
            // map the named_arguments to the reflector_parameters
            $dependencies = [];
    
            foreach ( $reflector_parameters as $parameters ) {
    Severity: Minor
    Found in src/factories/implementations/dependency-injection-factory.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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function __construct( $view_root = '', $path_to_views = null ) {
            if ( false === $view_root ) {
                // False means we are not loading from a template!
                $loader       = new StringLoader();
                $this->engine = new Handlebars( array( 'loader' => $loader ) );
    Severity: Minor
    Found in src/view/extensions/handlebars-view.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 to_title_case has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        function to_title_case( $title ) {
            $title = (string) $title;
            // Our array of 'small words' which shouldn't be capitalised if
            // they aren't the first word. Add your own words to taste.
            $small_words = array(
    Severity: Minor
    Found in src/utilities/string-utilities.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 validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function validate( $error_callback ) {
            $rules = $this->validation_rules();
    
            foreach ( $rules as $name => $check ) {
                if ( true !== $check ) {
    Severity: Minor
    Found in src/requests/fail-fast-request.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