Browse Source

Cleanup LGTM warnings.

pull/329/head
Sebastian Stehle 7 years ago
parent
commit
731864ec8b
  1. 2
      src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Visitors/FindExtensions.cs
  2. 2
      src/Squidex.Infrastructure/Log/FileChannel.cs
  3. 13
      src/Squidex/Areas/Frontend/Middlewares/WebpackMiddleware.cs
  4. 2
      src/Squidex/Areas/IdentityServer/Views/Account/Consent.cshtml
  5. 5
      src/Squidex/Pipeline/Swagger/SwaggerHelper.cs
  6. 2
      src/Squidex/app/features/api/api-area.component.html
  7. 6
      src/Squidex/app/features/apps/pages/apps-page.component.html
  8. 6
      src/Squidex/app/features/apps/pages/onboarding-dialog.component.html
  9. 2
      src/Squidex/app/features/content/pages/content/content-field.component.html
  10. 2
      src/Squidex/app/features/content/pages/content/content-page.component.html
  11. 6
      src/Squidex/app/features/dashboard/pages/dashboard-page.component.html
  12. 2
      src/Squidex/app/features/rules/pages/rules/actions/medium-action.component.html
  13. 2
      src/Squidex/app/features/rules/pages/rules/rule-element.component.html
  14. 4
      src/Squidex/app/features/rules/pages/rules/rules-page.component.html
  15. 4
      src/Squidex/app/features/schemas/pages/schema/schema-page.component.html
  16. 2
      src/Squidex/app/features/schemas/pages/schema/types/references-validation.component.html
  17. 2
      src/Squidex/app/features/settings/pages/backups/backups-page.component.html
  18. 2
      src/Squidex/app/features/settings/pages/plans/plans-page.component.html
  19. 12
      src/Squidex/app/framework/angular/modals/onboarding-tooltip.component.ts
  20. 6
      src/Squidex/app/framework/utils/immutable-array.ts
  21. 4
      src/Squidex/app/shared/components/asset.component.html
  22. 6
      src/Squidex/app/shared/components/search-form.component.html
  23. 2
      src/Squidex/app/shared/services/help.service.spec.ts
  24. 2
      src/Squidex/app/shared/services/help.service.ts
  25. 2
      src/Squidex/app/shell/pages/internal/internal-area.component.html

2
src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Visitors/FindExtensions.cs

@ -41,7 +41,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents.Visitors
{ {
var value = nodeIn.Rhs.Value; var value = nodeIn.Rhs.Value;
if (value is Instant instant && if (value is Instant &&
!string.Equals(nodeIn.Lhs[0], "mt", StringComparison.OrdinalIgnoreCase) && !string.Equals(nodeIn.Lhs[0], "mt", StringComparison.OrdinalIgnoreCase) &&
!string.Equals(nodeIn.Lhs[0], "ct", StringComparison.OrdinalIgnoreCase)) !string.Equals(nodeIn.Lhs[0], "ct", StringComparison.OrdinalIgnoreCase))
{ {

2
src/Squidex.Infrastructure/Log/FileChannel.cs

@ -13,7 +13,7 @@ namespace Squidex.Infrastructure.Log
{ {
private readonly FileLogProcessor processor; private readonly FileLogProcessor processor;
private readonly object lockObject = new object(); private readonly object lockObject = new object();
private bool isInitialized; private volatile bool isInitialized;
public FileChannel(string path) public FileChannel(string path)
{ {

13
src/Squidex/Areas/Frontend/Middlewares/WebpackMiddleware.cs

@ -7,6 +7,7 @@
using System; using System;
using System.IO; using System.IO;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
@ -76,14 +77,14 @@ namespace Squidex.Areas.Frontend.Middlewares
return response; return response;
} }
var stylesTag = string.Empty; var sb = new StringBuilder();
foreach (var file in Styles) foreach (var file in Styles)
{ {
stylesTag += $"<link href=\"http://{Host}:{Port}/{file}\" rel=\"stylesheet\">"; sb.AppendLine($"<link href=\"http://{Host}:{Port}/{file}\" rel=\"stylesheet\">");
} }
response = response.Replace("</head>", $"{stylesTag}</head>"); response = response.Replace("</head>", $"{sb}</head>");
return response; return response;
} }
@ -95,14 +96,14 @@ namespace Squidex.Areas.Frontend.Middlewares
return response; return response;
} }
var scriptsTag = string.Empty; var sb = new StringBuilder();
foreach (var file in Scripts) foreach (var file in Scripts)
{ {
scriptsTag += $"<script type=\"text/javascript\" src=\"http://{Host}:{Port}/{file}\"></script>"; sb.AppendLine($"<script type=\"text/javascript\" src=\"http://{Host}:{Port}/{file}\"></script>");
} }
response = response.Replace("</body>", $"{scriptsTag}</body>"); response = response.Replace("</body>", $"{sb}</body>");
return response; return response;
} }

2
src/Squidex/Areas/IdentityServer/Views/Account/Consent.cshtml

@ -52,7 +52,7 @@
I understand and agree that Squidex has integrated Google Analytics (with the anonymizer function). Google Analytics is a web analytics service to gather and analyse data about the behavior of users. I understand and agree that Squidex has integrated Google Analytics (with the anonymizer function). Google Analytics is a web analytics service to gather and analyse data about the behavior of users.
</p> </p>
<p> <p>
I accept the <a href="@Model.PrivacyUrl" target="_blank">privacy policies</a>. I accept the <a href="@Model.PrivacyUrl" target="_blank" rel="noopener">privacy policies</a>.
</p> </p>
</div> </div>
</div> </div>

5
src/Squidex/Pipeline/Swagger/SwaggerHelper.cs

@ -28,11 +28,12 @@ namespace Squidex.Pipeline.Swagger
using (var resourceStream = assembly.GetManifestResourceStream($"Squidex.Docs.{name}.md")) using (var resourceStream = assembly.GetManifestResourceStream($"Squidex.Docs.{name}.md"))
{ {
var streamReader = new StreamReader(resourceStream); using (var streamReader = new StreamReader(resourceStream))
{
return streamReader.ReadToEnd(); return streamReader.ReadToEnd();
} }
} }
}
public static SwaggerDocument CreateApiDocument(HttpContext context, MyUrlsOptions urlOptions, string appName) public static SwaggerDocument CreateApiDocument(HttpContext context, MyUrlsOptions urlOptions, string appName)
{ {

2
src/Squidex/app/features/api/api-area.component.html

@ -14,7 +14,7 @@
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="/api/content/{{appsState.appName}}/docs" target="_blank"> <a class="nav-link" href="/api/content/{{appsState.appName}}/docs" target="_blank" rel="noopener">
Swagger Swagger
</a> </a>
</li> </li>

6
src/Squidex/app/features/apps/pages/apps-page.component.html

@ -52,7 +52,7 @@
<div class="card-text"> <div class="card-text">
<div>Start with our ready to use blog.</div> <div>Start with our ready to use blog.</div>
<div> <div>
Sample Code: <a href="https://github.com/Squidex/squidex-samples/tree/master/csharp/Sample.Blog" (click)="$event.stopPropagation()" target="_blank">C#</a> Sample Code: <a href="https://github.com/Squidex/squidex-samples/tree/master/csharp/Sample.Blog" (click)="$event.stopPropagation()" target="_blank" rel="noopener">C#</a>
</div> </div>
</div> </div>
</div> </div>
@ -69,7 +69,7 @@
<div class="card-text"> <div class="card-text">
<div>Create your profile page.</div> <div>Create your profile page.</div>
<div> <div>
Sample Code: <a href="https://github.com/Squidex/squidex-samples/tree/master/csharp/Sample.Profile" (click)="$event.stopPropagation()" target="_blank">C#</a> Sample Code: <a href="https://github.com/Squidex/squidex-samples/tree/master/csharp/Sample.Profile" (click)="$event.stopPropagation()" target="_blank" rel="noopener">C#</a>
</div> </div>
</div> </div>
</div> </div>
@ -86,7 +86,7 @@
<div class="card-text"> <div class="card-text">
<div>Create app for Squidex Identity.</div> <div>Create app for Squidex Identity.</div>
<div> <div>
<a href="https://github.com/Squidex/squidex-identity" (click)="$event.stopPropagation()" target="_blank">Project</a> <a href="https://github.com/Squidex/squidex-identity" (click)="$event.stopPropagation()" target="_blank" rel="noopener">Project</a>
</div> </div>
</div> </div>
</div> </div>

6
src/Squidex/app/features/apps/pages/onboarding-dialog.component.html

@ -125,18 +125,18 @@
<h1>Awesome, now you know the basics!</h1> <h1>Awesome, now you know the basics!</h1>
<p> <p>
But that's not all of the support we can provide. <br />You can go to <a href="https://docs.squidex.io/" target="_blank">https://docs.squidex.io/</a> to read more. But that's not all of the support we can provide. <br />You can go to <a href="https://docs.squidex.io/" target="_blank" rel="noopener">https://docs.squidex.io/</a> to read more.
</p> </p>
<p> <p>
Do you want to join our community? Do you want to join our community?
</p> </p>
<div> <div>
<a class="btn btn-success" href="https://support.squidex.io" target="_blank"> <a class="btn btn-success" href="https://support.squidex.io" target="_blank" rel="noopener">
Join our Forum Join our Forum
</a> &nbsp; </a> &nbsp;
<a class="btn btn-success" href="https://github.com/squidex/squidex" target="_blank"> <a class="btn btn-success" href="https://github.com/squidex/squidex" target="_blank" rel="noopener">
Join us on Github Join us on Github
</a> </a>
</div> </div>

2
src/Squidex/app/features/content/pages/content/content-field.component.html

@ -8,7 +8,7 @@
</sqx-language-selector> </sqx-language-selector>
</div> </div>
<sqx-onboarding-tooltip id="languages" [for]="buttonLanguages" position="topRight" after="120000"> <sqx-onboarding-tooltip helpId="languages" [for]="buttonLanguages" position="topRight" after="120000">
Please remember to check all languages when you see validation errors. Please remember to check all languages when you see validation errors.
</sqx-onboarding-tooltip> </sqx-onboarding-tooltip>
</ng-container> </ng-container>

2
src/Squidex/app/features/content/pages/content/content-page.component.html

@ -125,7 +125,7 @@
<i class="icon-time"></i> <i class="icon-time"></i>
</a> </a>
<sqx-onboarding-tooltip id="history" [for]="linkHistory" position="leftTop" after="120000"> <sqx-onboarding-tooltip helpId="history" [for]="linkHistory" position="leftTop" after="120000">
The sidebar navigation contains useful context specific links. Here you can view the history how this schema has changed over time. The sidebar navigation contains useful context specific links. Here you can view the history how this schema has changed over time.
</sqx-onboarding-tooltip> </sqx-onboarding-tooltip>
</ng-container> </ng-container>

6
src/Squidex/app/features/dashboard/pages/dashboard-page.component.html

@ -26,7 +26,7 @@
</div> </div>
</a> </a>
<a class="card card-href" href="/api/docs" target="_blank"> <a class="card card-href" href="/api/docs" target="_blank" rel="noopener">
<div class="card-body"> <div class="card-body">
<div class="card-image"> <div class="card-image">
<img src="/images/dashboard-api.png" /> <img src="/images/dashboard-api.png" />
@ -40,7 +40,7 @@
</div> </div>
</a> </a>
<a class="card card-href" href="https://support.squidex.io" target="_blank"> <a class="card card-href" href="https://support.squidex.io" target="_blank" rel="noopener">
<div class="card-body"> <div class="card-body">
<div class="card-image"> <div class="card-image">
<img src="/images/dashboard-feedback.png" /> <img src="/images/dashboard-feedback.png" />
@ -54,7 +54,7 @@
</div> </div>
</a> </a>
<a class="card card-href" href="https://github.com/squidex/squidex" target="_blank"> <a class="card card-href" href="https://github.com/squidex/squidex" target="_blank" rel="noopener">
<div class="card-body"> <div class="card-body">
<div class="card-image"> <div class="card-image">
<img src="/images/dashboard-github.png" /> <img src="/images/dashboard-github.png" />

2
src/Squidex/app/features/rules/pages/rules/actions/medium-action.component.html

@ -8,7 +8,7 @@
<input type="text" class="form-control" id="accessToken" formControlName="accessToken" /> <input type="text" class="form-control" id="accessToken" formControlName="accessToken" />
<small class="form-text text-muted"> <small class="form-text text-muted">
The self issued access token. Can be created under <a target="_blank" href="https://medium.com/me/settings">https://medium.com/me/settings</a>. The self issued access token. Can be created under <a target="_blank" rel="noopener" href="https://medium.com/me/settings">https://medium.com/me/settings</a>.
</small> </small>
</div> </div>
</div> </div>

2
src/Squidex/app/features/rules/pages/rules/rule-element.component.html

@ -25,7 +25,7 @@
</div> </div>
<div class="large-link" *ngIf="element.readMore"> <div class="large-link" *ngIf="element.readMore">
<a [href]="element.readMore" target="_blank">Read More</a> <a [href]="element.readMore" target="_blank" rel="noopener">Read More</a>
</div> </div>
</div> </div>
</div> </div>

4
src/Squidex/app/features/rules/pages/rules/rules-page.component.html

@ -84,8 +84,8 @@
<i class="icon-help"></i> <i class="icon-help"></i>
</a> </a>
<sqx-onboarding-tooltip id="help" [for]="linkHelp" position="leftTop" after="180000"> <sqx-onboarding-tooltip helpId="help" [for]="linkHelp" position="leftTop" after="180000">
Click the help icon to show a context specific help page. Go to <a href="https://docs.squidex.io" target="_blank">https://docs.squidex.io</a> for the full documentation. Click the help icon to show a context specific help page. Go to <a href="https://docs.squidex.io" target="_blank" rel="noopener">https://docs.squidex.io</a> for the full documentation.
</sqx-onboarding-tooltip> </sqx-onboarding-tooltip>
</ng-container> </ng-container>
</sqx-panel> </sqx-panel>

4
src/Squidex/app/features/schemas/pages/schema/schema-page.component.html

@ -41,11 +41,11 @@
</div> </div>
</div> </div>
<sqx-onboarding-tooltip id="history" [for]="buttonOptions" position="bottomRight" after="60000"> <sqx-onboarding-tooltip helpId="history" [for]="buttonOptions" position="bottomRight" after="60000">
Open the context menu to delete the schema or to create some scripts for content changes. Open the context menu to delete the schema or to create some scripts for content changes.
</sqx-onboarding-tooltip> </sqx-onboarding-tooltip>
<sqx-onboarding-tooltip id="history" [for]="buttonPublish" position="bottomRight" after="240000"> <sqx-onboarding-tooltip helpId="history" [for]="buttonPublish" position="bottomRight" after="240000">
Note, that you have to publish the schema before you can add content to it. Note, that you have to publish the schema before you can add content to it.
</sqx-onboarding-tooltip> </sqx-onboarding-tooltip>
</ng-container> </ng-container>

2
src/Squidex/app/features/schemas/pages/schema/types/references-validation.component.html

@ -1,6 +1,6 @@
<div [formGroup]="editForm"> <div [formGroup]="editForm">
<div class="form-group row"> <div class="form-group row">
<label for="{{field.fieldId}}_field-placeholder" class="col col-3 col-form-label" for="{{field.fieldId}}_fieldSchemaId">Schema</label> <label class="col col-3 col-form-label" for="{{field.fieldId}}_fieldSchemaId">Schema</label>
<div class="col col-6"> <div class="col col-6">
<select class="form-control" id="{{field.fieldId}}_fieldSchemaId" formControlName="schemaId"> <select class="form-control" id="{{field.fieldId}}_fieldSchemaId" formControlName="schemaId">

2
src/Squidex/app/features/settings/pages/backups/backups-page.component.html

@ -73,7 +73,7 @@
<div *ngIf="backup.stopped && !backup.isFailed"> <div *ngIf="backup.stopped && !backup.isFailed">
Download: Download:
<a href="{{backup | sqxBackupDownloadUrl}}" target="_blank"> <a href="{{backup | sqxBackupDownloadUrl}}" target="_blank" rel="noopener">
Ready Ready
</a> </a>
</div> </div>

2
src/Squidex/app/features/settings/pages/plans/plans-page.component.html

@ -72,7 +72,7 @@
</div> </div>
<div *ngIf="plansState.hasPortal | async" class="billing-portal-link"> <div *ngIf="plansState.hasPortal | async" class="billing-portal-link">
Go to <a target="_blank" href="{{portalUrl}}">Billing Portal</a> for payment history and subscription overview. Go to <a target="_blank" rel="noopener" href="{{portalUrl}}">Billing Portal</a> for payment history and subscription overview.
</div> </div>
</ng-container> </ng-container>
</ng-container> </ng-container>

12
src/Squidex/app/framework/angular/modals/onboarding-tooltip.component.ts

@ -34,7 +34,7 @@ export class OnboardingTooltipComponent implements OnDestroy, OnInit {
public for: any; public for: any;
@Input() @Input()
public id: string; public helpId: string;
@Input() @Input()
public after = 1000; public after = 1000;
@ -62,9 +62,9 @@ export class OnboardingTooltipComponent implements OnDestroy, OnInit {
} }
public ngOnInit() { public ngOnInit() {
if (this.for && this.id && Types.isFunction(this.for.addEventListener)) { if (this.for && this.helpId && Types.isFunction(this.for.addEventListener)) {
this.showTimer = setTimeout(() => { this.showTimer = setTimeout(() => {
if (this.onboardingService.shouldShow(this.id)) { if (this.onboardingService.shouldShow(this.helpId)) {
const forRect = this.for.getBoundingClientRect(); const forRect = this.for.getBoundingClientRect();
const x = forRect.left + 0.5 * forRect.width; const x = forRect.left + 0.5 * forRect.width;
@ -81,14 +81,14 @@ export class OnboardingTooltipComponent implements OnDestroy, OnInit {
this.hideThis(); this.hideThis();
}, 10000); }, 10000);
this.onboardingService.disable(this.id); this.onboardingService.disable(this.helpId);
} }
} }
}, this.after); }, this.after);
this.forMouseDownListener = this.forMouseDownListener =
this.renderer.listen(this.for, 'mousedown', () => { this.renderer.listen(this.for, 'mousedown', () => {
this.onboardingService.disable(this.id); this.onboardingService.disable(this.helpId);
this.hideThis(); this.hideThis();
}); });
@ -106,7 +106,7 @@ export class OnboardingTooltipComponent implements OnDestroy, OnInit {
} }
public hideThis() { public hideThis() {
this.onboardingService.disable(this.id); this.onboardingService.disable(this.helpId);
this.ngOnDestroy(); this.ngOnDestroy();
} }

6
src/Squidex/app/framework/utils/immutable-array.ts

@ -138,21 +138,21 @@ export class ImmutableArray<T> implements Iterable<T> {
} }
public pushFront(...items: T[]): ImmutableArray<T> { public pushFront(...items: T[]): ImmutableArray<T> {
if (!items || items.length === 0) { if (items.length === 0) {
return this; return this;
} }
return new ImmutableArray<T>([...freeze(items), ...this.items]); return new ImmutableArray<T>([...freeze(items), ...this.items]);
} }
public push(...items: T[]): ImmutableArray<T> { public push(...items: T[]): ImmutableArray<T> {
if (!items || items.length === 0) { if (items.length === 0) {
return this; return this;
} }
return new ImmutableArray<T>([...this.items, ...freeze(items)]); return new ImmutableArray<T>([...this.items, ...freeze(items)]);
} }
public remove(...items: T[]): ImmutableArray<T> { public remove(...items: T[]): ImmutableArray<T> {
if (!items || items.length === 0) { if (items.length === 0) {
return this; return this;
} }

4
src/Squidex/app/shared/components/asset.component.html

@ -17,7 +17,7 @@
<div class="overlay-background"></div> <div class="overlay-background"></div>
<div class="overlay-menu"> <div class="overlay-menu">
<a class="file-download" [attr.href]="asset | sqxAssetUrl" target="_blank" (click)="$event.stopPropagation()"> <a class="file-download" [attr.href]="asset | sqxAssetUrl" target="_blank" rel="noopener" (click)="$event.stopPropagation()">
<i class="icon-download"></i> <i class="icon-download"></i>
</a> </a>
@ -115,7 +115,7 @@
<img class="user-picture" [attr.title]="asset.lastModifiedBy | sqxUserNameRef" [attr.src]="asset.lastModifiedBy | sqxUserPictureRef" /> <img class="user-picture" [attr.title]="asset.lastModifiedBy | sqxUserNameRef" [attr.src]="asset.lastModifiedBy | sqxUserPictureRef" />
</div> </div>
<div class="col col-actions text-right"> <div class="col col-actions text-right">
<a class="btn btn-link btn-secondary" [attr.href]="asset | sqxAssetUrl" target="_blank" (click)="$event.stopPropagation()"> <a class="btn btn-link btn-secondary" [attr.href]="asset | sqxAssetUrl" target="_blank" rel="noopener" (click)="$event.stopPropagation()">
<i class="icon-download"></i> <i class="icon-download"></i>
</a> </a>
</div> </div>

6
src/Squidex/app/shared/components/search-form.component.html

@ -10,7 +10,7 @@
<i class="icon-caret-down"></i> <i class="icon-caret-down"></i>
</a> </a>
<sqx-onboarding-tooltip id="contentArchive" [for]="expand" position="bottomRight" after="60000"> <sqx-onboarding-tooltip helpId="contentArchive" [for]="expand" position="bottomRight" after="60000">
Click this icon to show the advanced search menu and to show the archive! Click this icon to show the advanced search menu and to show the archive!
</sqx-onboarding-tooltip> </sqx-onboarding-tooltip>
</ng-container> </ng-container>
@ -30,7 +30,7 @@
</ng-container> </ng-container>
</form> </form>
<sqx-onboarding-tooltip id="contentFind" [for]="inputFind" position="bottomRight" after="120000"> <sqx-onboarding-tooltip helpId="contentFind" [for]="inputFind" position="bottomRight" after="120000">
Search for content using full text search over all fields and languages! Search for content using full text search over all fields and languages!
</sqx-onboarding-tooltip> </sqx-onboarding-tooltip>
@ -70,7 +70,7 @@
</div> </div>
<div class="link"> <div class="link">
Read more about filtering in the <a href="https://docs.squidex.io/04-guides/02-api.html" target="_blank">Documentation</a>. Read more about filtering in the <a href="https://docs.squidex.io/04-guides/02-api.html" target="_blank" rel="noopener">Documentation</a>.
</div> </div>
</div> </div>
</div> </div>

2
src/Squidex/app/shared/services/help.service.spec.ts

@ -58,7 +58,7 @@ describe('AppClientsService', () => {
[ [
'A test content with', 'A test content with',
'A test content with a <a href="https://squidex.io">A Link</a>', 'A test content with a <a href="https://squidex.io">A Link</a>',
'A test content with a <a target="_blank" href="https://docs.squidex.io/GLOSSARY.html#content">Glossary Link</a>' 'A test content with a <a target="_blank" rel="noopener" href="https://docs.squidex.io/GLOSSARY.html#content">Glossary Link</a>'
]); ]);
})); }));

2
src/Squidex/app/shared/services/help.service.ts

@ -25,7 +25,7 @@ export class HelpService {
const result: string[] = []; const result: string[] = [];
for (let section of response.sections) { for (let section of response.sections) {
const content = section.content.replace(/href="\.\.\/GLOSSARY\.html/g, 'target="_blank" href="https://docs.squidex.io/GLOSSARY.html'); const content = section.content.replace(/href="\.\.\/GLOSSARY\.html/g, 'target="_blank" rel="noopener" href="https://docs.squidex.io/GLOSSARY.html');
result.push(content); result.push(content);
} }

2
src/Squidex/app/shell/pages/internal/internal-area.component.html

@ -22,7 +22,7 @@
<router-outlet></router-outlet> <router-outlet></router-outlet>
</div> </div>
<a class="support-button row no-gutters" href="https://support.squidex.io" target="_blank"> <a class="support-button row no-gutters" href="https://support.squidex.io" target="_blank" rel="noopener">
<div class="col col-auto support-icon"> <div class="col col-auto support-icon">
<i class="icon-support"></i> <i class="icon-support"></i>
</div> </div>

Loading…
Cancel
Save