Skip to content

Commit

Permalink
* fix all violations of Roslyn analyzer rules and ReSharper inspectio…
Browse files Browse the repository at this point in the history
…ns @ c#/crawler
  • Loading branch information
n0099 committed May 10, 2024
1 parent c2bf8f8 commit 3834e6b
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions c#/crawler/src/Db/Post/BasePost.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// ReSharper disable UnusedMemberInSuper.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
namespace tbm.Crawler.Db.Post;

public abstract class BasePost : TimestampedEntity, ICloneable
Expand Down
1 change: 1 addition & 0 deletions c#/crawler/src/Db/Post/PostContent.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ReSharper disable PropertyCanBeMadeInitOnly.Global
namespace tbm.Crawler.Db.Post;

public abstract class PostContent : RowVersionedEntity
Expand Down
1 change: 1 addition & 0 deletions c#/crawler/src/Db/Revision/ForumScopedRevision.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ReSharper disable PropertyCanBeMadeInitOnly.Global
namespace tbm.Crawler.Db.Revision;

public abstract class ForumScopedRevision : RowVersionedEntity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// ReSharper disable UnusedMemberInSuper.Global
// ReSharper disable PropertyCanBeMadeInitOnly.Global
namespace tbm.Crawler.Db.Revision.Splitting;

public abstract class BaseRevisionWithSplitting : RowVersionedEntity
Expand Down
2 changes: 1 addition & 1 deletion c#/crawler/src/Tieba/Crawl/CrawlPost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ private Action<Exception> SaveThreadMissingFirstReply
existingEntity.Excerpt = newEntity.Excerpt;
existingEntity.LastSeenAt = newEntity.LastSeenAt;
}
_ = db.SaveChangesForUpdate();
transaction.Commit();
};
Expand Down
1 change: 1 addition & 0 deletions c#/crawler/src/Tieba/Crawl/Facade/CrawlFacade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public virtual void Dispose()
locks.ReleaseRange(lockId, _lockingPages);
}

[SuppressMessage("Major Bug", "S1751:Loops with at most one iteration should be refactored")]
public SaverChangeSet<TPost>? SaveCrawled(CancellationToken stoppingToken = default)
{
var db = DbContextFactory(Fid);
Expand Down
8 changes: 4 additions & 4 deletions c#/crawler/src/Tieba/Crawl/Facade/ICrawlFacade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ namespace tbm.Crawler.Tieba.Crawl.Facade;
public interface ICrawlFacade<TPost> : IDisposable
where TPost : BasePost
{
public delegate void ExceptionHandler(Exception ex);

public ICrawlFacade<TPost> AddExceptionHandler(ExceptionHandler handler);

public SaverChangeSet<TPost>? SaveCrawled(CancellationToken stoppingToken = default);

public Task<ICrawlFacade<TPost>> CrawlPageRange(
Expand All @@ -14,8 +18,4 @@ public interface ICrawlFacade<TPost> : IDisposable
IReadOnlyList<Page> pages,
Func<Page, FailureCount> failureCountSelector,
CancellationToken stoppingToken = default);

public ICrawlFacade<TPost> AddExceptionHandler(ExceptionHandler handler);

public delegate void ExceptionHandler(Exception ex);
}
2 changes: 1 addition & 1 deletion c#/imagePipeline/src/Db/ImageMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// ReSharper disable UnusedMemberInSuper.Global
using System.ComponentModel;
using SixLabors.ImageSharp.PixelFormats;
using Point = NetTopologySuite.Geometries.Point;
using EntityWithImageIdAsKey = tbm.Shared.Db.EntityWithImageId.AsKey;
using Point = NetTopologySuite.Geometries.Point;

namespace tbm.ImagePipeline.Db;

Expand Down

0 comments on commit 3834e6b

Please sign in to comment.