eric-chau/jarvis

View on GitHub

Showing 6 of 6 total issues

Method mountHttpComponents has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function mountHttpComponents(Jarvis $app)
    {
        $app['request'] = function (Jarvis $app): Request {
            $request = Request::createFromGlobals();

Severity: Minor
Found in src/Skill/DependencyInjection/ContainerProvider.php - About 1 hr to fix

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

        public function broadcast(string $name, EventInterface $event = null): void
        {
            if (isset($this->permanentEvents[$name])) {
                throw new \LogicException('Permanent event cannot be broadcasted multiple times.');
            }
    Severity: Minor
    Found in src/Skill/EventBroadcaster/BroadcasterTrait.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 resolveArgumentsForClosure has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public function resolveArgumentsForClosure(\Closure $callback, array $rawArgs = []): array
        {
            $result = [];
            $refMethod = new \ReflectionMethod($callback, '__invoke');
            foreach ($refMethod->getParameters() as $refParam) {
    Severity: Minor
    Found in src/Skill/Core/CallbackResolver.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 offsetUnset has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public function offsetUnset($id): void
        {
            if (isset($this->values[$id])) {
                if (is_object($this->values[$id])) {
                    unset($this->factories[$this->values[$id]]);
    Severity: Minor
    Found in src/Skill/DependencyInjection/Container.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 uri has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function uri(string $name, array $params = []): string
        {
            if (!isset($this->routesNames[$name])) {
                throw new \InvalidArgumentException(
                    "Cannot generate URI for '$name' cause it does not exist."
    Severity: Minor
    Found in src/Skill/Routing/Router.php - About 45 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 offsetSet has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function offsetSet($id, $v): void
        {
            parent::offsetSet($id, $v);
    
            if (!($v instanceof \Closure)) {
    Severity: Minor
    Found in src/Jarvis.php - About 35 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