furkandeveloper/EasyPermissionManagement

View on GitHub

Showing 7 of 7 total issues

Method OnModelCreating has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
 
modelBuilder.Entity<Permission>(entity =>

    Method ApplyEasyPermission has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    public static void ApplyEasyPermission(this IApplicationBuilder app)
    {
    var type = typeof(PermissionProvider);
    var service = AppDomain.CurrentDomain.GetAssemblies().SelectMany(s => s.GetTypes())
    .Where(p => type.IsAssignableFrom(p) && !p.IsInterface)

      Method ConfigureServices has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      public void ConfigureServices(IServiceCollection services)
      {
      services.AddControllers();
      services.AddEasyPermission();
       
       
      Severity: Minor
      Found in sample/EasyPermissionManagement.Web/Startup.cs - About 1 hr to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        public virtual async Task<T> InsertAsync<T>(T entity) where T : class
        {
        var entry = Entry(entity);
        entry.State = EntityState.Added;
        await SaveChangesAsync();
        src/EasyPermissionManagement.EntityFrameworkCore/EasyPermissionCoreDbContext.cs on lines 188..194

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        public virtual async Task<T> UpdateAsync<T>(T entity) where T : class
        {
        var entry = Entry(entity);
        entry.State = EntityState.Modified;
        await SaveChangesAsync();
        src/EasyPermissionManagement.EntityFrameworkCore/EasyPermissionCoreDbContext.cs on lines 168..174

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        var service = AppDomain.CurrentDomain.GetAssemblies().SelectMany(s => s.GetTypes())
        .Where(p => type.IsAssignableFrom(p) && !p.IsInterface)
        .Where(c => c.GetCustomAttribute<RegisterIdentifierAttribute>().Provider == provider)
        src/EasyPermissionManagement.Core/Extensions/ApplicationBuilderExtension.cs on lines 28..30

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        var service = AppDomain.CurrentDomain.GetAssemblies().SelectMany(s => s.GetTypes())
        .Where(p => type.IsAssignableFrom(p) && !p.IsInterface)
        .FirstOrDefault();
        src/EasyPermissionManagement.Core/Extensions/ServiceProviderExtension.cs on lines 38..40
        Severity
        Category
        Status
        Source
        Language