Skip to content

Commit

Permalink
* fix violation of roslyn analyzer rule RSPEC-2325 @ SaverWithRevis…
Browse files Browse the repository at this point in the history
…ion.cs

@ crawler

* fix violation of roslyn analyzer rule `RSPEC-2325` @ TbmDbContext.cs
@ shared
@ c#

* fix vueuse/vueuse#4216 @ utils/echarts.ts
* fix typescript-eslint/typescript-eslint#9706 @ api/index.ts
* fix violation of eslitn rule `@stylistic/indent` @ pages/posts.vue
@ fe

$ git ls-files -z | xargs -0 sed -i 's/\t/    /g'
  • Loading branch information
n0099 committed Sep 19, 2024
1 parent 694976f commit 3c41563
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 55 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "tbclient.protobuf"]
path = tbclient.protobuf
url = [email protected]:n0099/tbclient.protobuf.git
path = tbclient.protobuf
url = [email protected]:n0099/tbclient.protobuf.git
8 changes: 4 additions & 4 deletions c#/crawler/src/Tieba/Crawl/Saver/SaverWithRevision.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ public partial class SaverWithRevision<TBaseRevision, TRevisionId>
}
public partial class SaverWithRevision<TBaseRevision, TRevisionId>
{
protected abstract NullFieldsBitMask GetRevisionNullFieldBitMask(string fieldName);

protected IEnumerable<ExistingAndNewEntity<TEntity>> SaveNewEntities<TEntity>(
protected static IEnumerable<ExistingAndNewEntity<TEntity>> SaveNewEntities<TEntity>(
CrawlerDbContext db,
IReadOnlyCollection<MaybeExistingAndNewEntity<TEntity>> maybeEntities)
where TEntity : RowVersionedEntity
Expand All @@ -76,7 +74,7 @@ protected IEnumerable<ExistingAndNewEntity<TEntity>> SaveNewEntities<TEntity>(
.Select(entity => new ExistingAndNewEntity<TEntity>(entity.Existing!, entity.New));
}

protected void SaveExistingEntities<TEntity>(
protected static void SaveExistingEntities<TEntity>(
CrawlerDbContext db,
IEnumerable<ExistingAndNewEntity<TEntity>> existingAndNewEntities)
where TEntity : RowVersionedEntity =>
Expand All @@ -103,6 +101,8 @@ on newNavigation.Metadata.Name equals existingNavigation.Metadata.Name
.ForEach(prop => prop.IsModified = false);
});

protected abstract NullFieldsBitMask GetRevisionNullFieldBitMask(string fieldName);

protected void SaveExistingEntityRevisions<TEntity, TRevision>(
CrawlerDbContext db,
Func<TEntity, TRevision> revisionFactory,
Expand Down
6 changes: 3 additions & 3 deletions c#/shared/src/Db/TbmDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ public class TbmDbContext<TModelCacheKeyFactory>(ILogger<TbmDbContext<TModelCach
public DbSet<ImageInReply> ImageInReplies => Set<ImageInReply>();
public DbSet<ReplyContentImage> ReplyContentImages => Set<ReplyContentImage>();

protected static void OnModelCreatingWithFid(ModelBuilder b, uint fid) =>
b.Entity<ReplyContentImage>().ToTable($"tbmc_f{fid}_reply_content_image");

[SuppressMessage("Naming", "CA1725:Parameter names should match base declaration")]
[SuppressMessage("Critical Code Smell", "S927:Parameter names should match base declaration and other partial definitions")]
[SuppressMessage("Style", "IDE0058:Expression value is never used")]
Expand Down Expand Up @@ -176,9 +179,6 @@ protected override void OnModelCreating(ModelBuilder b)
b.Entity<ReplyContentImage>().HasOne(e => e.ImageInReply).WithMany();
}

protected void OnModelCreatingWithFid(ModelBuilder b, uint fid) =>
b.Entity<ReplyContentImage>().ToTable($"tbmc_f{fid}_reply_content_image");

protected virtual void OnConfiguringNpgsql(NpgsqlDbContextOptionsBuilder builder) { }
protected virtual void OnBuildingNpgsqlDataSource(NpgsqlDataSourceBuilder builder) { }

Expand Down
70 changes: 35 additions & 35 deletions c#/tbm.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B0F531C7-9D14-4F81-B809-D6429D4103FC}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
stylecop.json = stylecop.json
GlobalSuppressions.cs = GlobalSuppressions.cs
Directory.Build.props = Directory.Build.props
EndProjectSection
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
stylecop.json = stylecop.json
GlobalSuppressions.cs = GlobalSuppressions.cs
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TbClient", "tbClient\TbClient.csproj", "{4D782E36-9769-4B10-8D5F-F1F3648F8D74}"
EndProject
Expand All @@ -20,32 +20,32 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "tbm.ImagePipeline", "imagePipeline\tbm.ImagePipeline.csproj", "{3DC9F1EC-5F76-4F78-9F00-99908CED450B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D7F086F7-6DBF-4C26-AB68-0093063FF755}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D7F086F7-6DBF-4C26-AB68-0093063FF755}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D7F086F7-6DBF-4C26-AB68-0093063FF755}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D7F086F7-6DBF-4C26-AB68-0093063FF755}.Release|Any CPU.Build.0 = Release|Any CPU
{3DAC21AE-4493-4CF2-B887-203A781C12AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3DAC21AE-4493-4CF2-B887-203A781C12AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DAC21AE-4493-4CF2-B887-203A781C12AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DAC21AE-4493-4CF2-B887-203A781C12AA}.Release|Any CPU.Build.0 = Release|Any CPU
{3DC9F1EC-5F76-4F78-9F00-99908CED450B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3DC9F1EC-5F76-4F78-9F00-99908CED450B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DC9F1EC-5F76-4F78-9F00-99908CED450B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DC9F1EC-5F76-4F78-9F00-99908CED450B}.Release|Any CPU.Build.0 = Release|Any CPU
{4D782E36-9769-4B10-8D5F-F1F3648F8D74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4D782E36-9769-4B10-8D5F-F1F3648F8D74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D782E36-9769-4B10-8D5F-F1F3648F8D74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D782E36-9769-4B10-8D5F-F1F3648F8D74}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A136C5D5-62D8-4451-B139-33124D2A44E5}
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D7F086F7-6DBF-4C26-AB68-0093063FF755}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D7F086F7-6DBF-4C26-AB68-0093063FF755}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D7F086F7-6DBF-4C26-AB68-0093063FF755}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D7F086F7-6DBF-4C26-AB68-0093063FF755}.Release|Any CPU.Build.0 = Release|Any CPU
{3DAC21AE-4493-4CF2-B887-203A781C12AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3DAC21AE-4493-4CF2-B887-203A781C12AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DAC21AE-4493-4CF2-B887-203A781C12AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DAC21AE-4493-4CF2-B887-203A781C12AA}.Release|Any CPU.Build.0 = Release|Any CPU
{3DC9F1EC-5F76-4F78-9F00-99908CED450B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3DC9F1EC-5F76-4F78-9F00-99908CED450B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DC9F1EC-5F76-4F78-9F00-99908CED450B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DC9F1EC-5F76-4F78-9F00-99908CED450B}.Release|Any CPU.Build.0 = Release|Any CPU
{4D782E36-9769-4B10-8D5F-F1F3648F8D74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4D782E36-9769-4B10-8D5F-F1F3648F8D74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D782E36-9769-4B10-8D5F-F1F3648F8D74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D782E36-9769-4B10-8D5F-F1F3648F8D74}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A136C5D5-62D8-4451-B139-33124D2A44E5}
EndGlobalSection
EndGlobal
4 changes: 2 additions & 2 deletions c#/tbm.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/ApplyAutoDetectedRules/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Roslynator/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/ApplyAutoDetectedRules/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Roslynator/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Tieba/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=tesseract/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Spid/@EntryIndexedValue">True</s:Boolean>
Expand Down
6 changes: 0 additions & 6 deletions fe/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ const queryFunctionWithReCAPTCHA = async <TResponse>
export type ApiErrorClass = ApiResponseError | FetchError;
type QueryFunctions = typeof queryFunction | typeof queryFunctionWithReCAPTCHA;
const useApi = <

// https://github.com/typescript-eslint/typescript-eslint/issues/9706
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
TApi extends Api<TResponse, TQueryParam>,
TResponse = TApi['response'],
TQueryParam extends ObjUnknown = TApi['queryParam']>
Expand Down Expand Up @@ -128,9 +125,6 @@ const useApi = <
return ret;
};
const useApiWithCursor = <

// https://github.com/typescript-eslint/typescript-eslint/issues/9706
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
TApi extends Api<TResponse, TQueryParam>,
TResponse extends CursorPagination = TApi['response'],
TQueryParam extends ObjUnknown = TApi['queryParam']>
Expand Down
4 changes: 2 additions & 2 deletions fe/src/pages/posts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ watch([dataUpdatedAt, errorUpdatedAt], async (updatedAt: UnixTimestamp[]) => {
const postCount = _.sum(Object.values(fetchedPage?.pages.matchQueryPostCount ?? {}));
notyShow('success', `已加载${postCount}条记录
${isQueryCached
? '使用前端本地缓存'
: `
? '使用前端本地缓存'
: `
前端耗时${_.round(renderDuration / 1000, 2)}s
${isQueriedBySSR ? '使用服务端渲染预请求' : ''}
后端+网络耗时${_.round(networkDuration / 1000, 2)}s`}`);
Expand Down
2 changes: 1 addition & 1 deletion fe/src/utils/echarts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as echarts from 'echarts/core';
import type { ColorPaletteOptionMixin } from 'echarts/types/src/util/types.d.ts';

export const useResizeableEcharts = (el: Parameters<typeof useResizeObserver>[0]) =>
useResizeObserver(el, _.debounce((entries: Parameters<Parameters<typeof useResizeObserver>[1]>[0]) => { // https://github.com/vueuse/vueuse/issues/4216
useResizeObserver(el, _.debounce((entries: readonly ResizeObserverEntry[]) => {
entries.forEach(entry => {
echarts.getInstanceByDom(entry.target as HTMLElement)?.resize();
});
Expand Down

0 comments on commit 3c41563

Please sign in to comment.