Skip to content

Ignore ILogger as a dependency when checking for SRP #214

Open

Description

@Mayron

Is it possible to ignore ILogger as a dependency when analysing the code for too many dependencies?
I get a warning that the class might be breaking the single responsibility principle but logging is a good practice to have and I don't think it should count as doing too much. It's everywhere in the codebase.

I would prefer to always ignore it so the below constructor could be analysed as having only 3 dependencies instead of 4:
image
image

Activity

  1. MO2k4 commented on May 17, 2024

    @MO2k4
    Owner

    Hey :)

    i don't know how i should feel about this, since this would add a dependency to the plugin itself.

    What could be possible would be some mechanism to exclude by namespace name, but this still does not feel right. In your example the IHttpContextAccessor is also something thats more a less 'static' and will be added to all of your handlers, right? So should this be excluded as well?

    Could u just increase the configuration value for this?

  2. hbrof commented on Aug 14, 2024

    @hbrof

    It's funny; I thought about this as well with some methods that hit their line limits, and logging entries contributed to the counts being over the max. When I dug in a bit, some of these were conditional based on #if DEBUG as well. I would prefer options that didn't include either of these since in the final builds, the logging typically plays a role outside the complexity, and the DEBUG code isn't included. My thought is that changing the configuration value for this without the additional options breaks what we are trying to accomplish related to clean code in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions