[AAE-10461] Fix license header checker (#7823)

* [AAE-10461] Fix license header checker

* trigger travis

* fix license headers for cli lib

* rebase
This commit is contained in:
Tomasz Gnyp
2022-09-12 19:07:27 +02:00
committed by GitHub
parent 88beaf3535
commit b7e8abc529
74 changed files with 589 additions and 286 deletions

View File

@@ -30,7 +30,8 @@
"plugins": [ "plugins": [
"eslint-plugin-unicorn", "eslint-plugin-unicorn",
"eslint-plugin-rxjs", "eslint-plugin-rxjs",
"ban" "ban",
"license-header"
], ],
"rules": { "rules": {
"ban/ban": [ "ban/ban": [
@@ -130,7 +131,8 @@
"allowShortCircuit": true, "allowShortCircuit": true,
"allowTernary": true "allowTernary": true
} }
] ],
"license-header/header": ["error", "./license-community.txt"]
} }
}, },
{ {

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from '@angular/router';
import { CloudLayoutService } from './services/cloud-layout.service'; import { CloudLayoutService } from './services/cloud-layout.service';

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { import {
AuthenticationService, AuthenticationService,
AppConfigService, AppConfigService,

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* SystemJS module definition */ /* SystemJS module definition */
declare const module: NodeModule; declare const module: NodeModule;
interface NodeModule { interface NodeModule {

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PluginTarget } from './plugins/plugin-model'; import { PluginTarget } from './plugins/plugin-model';
import { CheckEnv } from './plugins/check-env'; import { CheckEnv } from './plugins/check-env';
import program = require('commander'); import program = require('commander');

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const alfrescoApi = require('@alfresco/js-api'); const alfrescoApi = require('@alfresco/js-api');
const program = require('commander'); const program = require('commander');
const fs = require ('fs'); const fs = require ('fs');

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const alfrescoApi = require('@alfresco/js-api'); const alfrescoApi = require('@alfresco/js-api');
const program = require('commander'); const program = require('commander');
const fs = require ('fs'); const fs = require ('fs');

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { logger } from './logger'; import { logger } from './logger';
import { exec } from './exec'; import { exec } from './exec';

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { logger } from './../logger'; import { logger } from './../logger';
import alfrescoApi = require('@alfresco/js-api'); import alfrescoApi = require('@alfresco/js-api');

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PluginInterface } from './plugin-model'; import { PluginInterface } from './plugin-model';
import { GovernanceHealth } from './governance-health'; import { GovernanceHealth } from './governance-health';

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/naming-convention */
import { logger } from '../logger'; import { logger } from '../logger';

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PluginInterface } from './plugin-model'; import { PluginInterface } from './plugin-model';
import { logger } from '../logger'; import { logger } from '../logger';

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
export enum PluginTarget { export enum PluginTarget {
processService = 'processService', processService = 'processService',

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/naming-convention */
import { PluginInterface } from './plugin-model'; import { PluginInterface } from './plugin-model';

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PluginInterface } from './plugin-model'; import { PluginInterface } from './plugin-model';
import { logger } from '../logger'; import { logger } from '../logger';
import { PluginConfiguration } from './plugin-config'; import { PluginConfiguration } from './plugin-config';

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/naming-convention */
import { PluginInterface } from './plugin-model'; import { PluginInterface } from './plugin-model';

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PluginInterface } from './plugin-model'; import { PluginInterface } from './plugin-model';
import { logger } from '../logger'; import { logger } from '../logger';
import { PluginConfiguration } from './plugin-config'; import { PluginConfiguration } from './plugin-config';

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AlfrescoApi, PeopleApi, NodesApi, GroupsApi, SitesApi, SearchApi, AlfrescoApiConfig } from '@alfresco/js-api'; import { AlfrescoApi, PeopleApi, NodesApi, GroupsApi, SitesApi, SearchApi, AlfrescoApiConfig } from '@alfresco/js-api';
import program from 'commander'; import program from 'commander';
import { logger } from './logger'; import { logger } from './logger';

View File

@@ -14,4 +14,5 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export * from './new-version-uploader.model'; export * from './new-version-uploader.model';

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { MinimalNodeEntryEntity, Version, NodeChildAssociation, Node } from '@alfresco/js-api'; import { MinimalNodeEntryEntity, Version, NodeChildAssociation, Node } from '@alfresco/js-api';
import { NodeEntityEvent } from '../../document-list'; import { NodeEntityEvent } from '../../document-list';

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { DomSanitizer } from '@angular/platform-browser'; import { DomSanitizer } from '@angular/platform-browser';
export const domSanitizerMock = { export const domSanitizerMock = {

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MatIconRegistry } from '@angular/material/icon'; import { MatIconRegistry } from '@angular/material/icon';
export const matIconRegistryMock = { export const matIconRegistryMock = {

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './activiti/activiti-client.types'; export * from './activiti/activiti-client.types';
export * from './alfresco-js-clients.module'; export * from './alfresco-js-clients.module';
export * from './discovery/discovery-client.types'; export * from './discovery/discovery-client.types';

View File

@@ -1,2 +1,19 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './public-api'; export * from './public-api';

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './api-client.factory'; export * from './api-client.factory';
export * from './api-clients.service'; export * from './api-clients.service';
export * from './clients'; export * from './clients';

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { API_CLIENT_FACTORY_TOKEN } from '@alfresco/adf-core/api'; import { API_CLIENT_FACTORY_TOKEN } from '@alfresco/adf-core/api';
import { LegacyClientFactory } from './legacy-api-client.factory'; import { LegacyClientFactory } from './legacy-api-client.factory';

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { Component, Input, SecurityContext } from '@angular/core'; import { Component, Input, SecurityContext } from '@angular/core';
import { animate, style, transition, trigger } from '@angular/animations'; import { animate, style, transition, trigger } from '@angular/animations';
import { DomSanitizer } from '@angular/platform-browser'; import { DomSanitizer } from '@angular/platform-browser';

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { ComponentRef, Directive, ElementRef, HostListener, Input, OnDestroy, OnInit } from '@angular/core'; import { ComponentRef, Directive, ElementRef, HostListener, Input, OnDestroy, OnInit } from '@angular/core';
import { Overlay, OverlayPositionBuilder, OverlayRef } from '@angular/cdk/overlay'; import { Overlay, OverlayPositionBuilder, OverlayRef } from '@angular/cdk/overlay';
import { ComponentPortal } from '@angular/cdk/portal'; import { ComponentPortal } from '@angular/cdk/portal';

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { DebugElement } from '@angular/core'; import { DebugElement } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FormFieldTypes } from '../core/form-field-types'; import { FormFieldTypes } from '../core/form-field-types';
import { FormFieldModel } from '../core/form-field.model'; import { FormFieldModel } from '../core/form-field.model';

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const mockTabText = `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam urna odio, sagittis vel nulla vel, condimentum egestas dolor. export const mockTabText = `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam urna odio, sagittis vel nulla vel, condimentum egestas dolor.
Interdum et malesuada fames ac ante ipsum primis in faucibus. Mauris eu hendrerit lectus. Aliquam et ex imperdiet, sodales tellus finibus, malesuada eros. Interdum et malesuada fames ac ante ipsum primis in faucibus. Mauris eu hendrerit lectus. Aliquam et ex imperdiet, sodales tellus finibus, malesuada eros.
Vestibulum aliquet eros sed diam euismod tincidunt. Vestibulum aliquet eros sed diam euismod tincidunt.

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { DataColumn } from '../datatable/data/data-column.model'; import { DataColumn } from '../datatable/data/data-column.model';
export const getDataColumnMock = <T = unknown>(column: Partial<DataColumn<T>> = {}): DataColumn<T> => ({ export const getDataColumnMock = <T = unknown>(column: Partial<DataColumn<T>> = {}): DataColumn<T> => ({

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { DomSanitizer } from '@angular/platform-browser'; import { DomSanitizer } from '@angular/platform-browser';
export const domSanitizerMock = { export const domSanitizerMock = {

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { LanguageServiceInterface } from '../services/language.service.interface'; import { LanguageServiceInterface } from '../services/language.service.interface';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs'; import { BehaviorSubject } from 'rxjs';

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MatIconRegistry } from '@angular/material/icon'; import { MatIconRegistry } from '@angular/material/icon';
export const matIconRegistryMock = { export const matIconRegistryMock = {

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export class IdentityRoleModel { export class IdentityRoleModel {
id: string; id: string;
name: string; name: string;

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { Pipe, PipeTransform } from '@angular/core'; import { Pipe, PipeTransform } from '@angular/core';
import moment, { Moment } from 'moment'; import moment, { Moment } from 'moment';

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { Pipe, PipeTransform } from '@angular/core'; import { Pipe, PipeTransform } from '@angular/core';
import moment, { Moment } from 'moment'; import moment, { Moment } from 'moment';

View File

@@ -1,6 +1,6 @@
/*! /*!
* @license * @license
* Copyright 2022 Alfresco Software, Ltd. * Copyright 2019 Alfresco Software, Ltd.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@@ -1,6 +1,6 @@
/*! /*!
* @license * @license
* Copyright 2022 Alfresco Software, Ltd. * Copyright 2019 Alfresco Software, Ltd.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { Meta, moduleMetadata, Story } from '@storybook/angular'; import { Meta, moduleMetadata, Story } from '@storybook/angular';
import { ErrorContentComponent } from './error-content.component'; import { ErrorContentComponent } from './error-content.component';
import { CoreStoryModule } from '../../testing/core.story.module'; import { CoreStoryModule } from '../../testing/core.story.module';

View File

@@ -1,4 +1,6 @@
/* Copyright 2012 Mozilla Foundation /*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { Directive, HostListener, Output, EventEmitter, OnInit, OnDestroy, ElementRef } from '@angular/core'; import { Directive, HostListener, Output, EventEmitter, OnInit, OnDestroy, ElementRef } from '@angular/core';
import { ProcessCloudService } from '../services/process-cloud.service'; import { ProcessCloudService } from '../services/process-cloud.service';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { Component, SimpleChange, ViewChild } from '@angular/core'; import { Component, SimpleChange, ViewChild } from '@angular/core';
import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing'; import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { DataColumn, DataRow, ObjectDataTableAdapter } from '@alfresco/adf-core'; import { DataColumn, DataRow, ObjectDataTableAdapter } from '@alfresco/adf-core';
import { ProcessListDataColumnCustomData, PROCESS_LIST_CUSTOM_VARIABLE_COLUMN } from '../../../models/data-column-custom-data'; import { ProcessListDataColumnCustomData, PROCESS_LIST_CUSTOM_VARIABLE_COLUMN } from '../../../models/data-column-custom-data';
import { ProcessInstanceCloudListViewModel } from '../models/perocess-instance-cloud-view.model'; import { ProcessInstanceCloudListViewModel } from '../models/perocess-instance-cloud-view.model';

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
export enum ProcessListCloudPreferences { export enum ProcessListCloudPreferences {
columnOrder = 'processes-cloud-list-columns-order', columnOrder = 'processes-cloud-list-columns-order',

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { fakeAsync, TestBed } from '@angular/core/testing'; import { fakeAsync, TestBed } from '@angular/core/testing';
import { setupTestBed, AlfrescoApiService } from '@alfresco/adf-core'; import { setupTestBed, AlfrescoApiService } from '@alfresco/adf-core';
import { ProcessListCloudService } from './process-list-cloud.service'; import { ProcessListCloudService } from './process-list-cloud.service';

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { AlfrescoApiService, AppConfigService, LogService } from '@alfresco/adf-core'; import { AlfrescoApiService, AppConfigService, LogService } from '@alfresco/adf-core';
import { ProcessQueryCloudRequestModel } from '../models/process-cloud-query-request.model'; import { ProcessQueryCloudRequestModel } from '../models/process-cloud-query-request.model';

View File

@@ -2,14 +2,14 @@
* @license * @license
* Copyright 2019 Alfresco Software, Ltd. * Copyright 2019 Alfresco Software, Ltd.
* *
* Licensed under the Apache License, Version 2.0 (the 'License'); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.

View File

@@ -2,14 +2,14 @@
* @license * @license
* Copyright 2019 Alfresco Software, Ltd. * Copyright 2019 Alfresco Software, Ltd.
* *
* Licensed under the Apache License, Version 2.0 (the 'License'); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { Component, ContentChildren, ViewChild } from '@angular/core'; import { Component, ContentChildren, ViewChild } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { setupTestBed } from '@alfresco/adf-core'; import { setupTestBed } from '@alfresco/adf-core';

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { Directive, Input, HostListener, Output, EventEmitter, OnInit } from '@angular/core'; import { Directive, Input, HostListener, Output, EventEmitter, OnInit } from '@angular/core';
import { IdentityUserService } from '../../people/services/identity-user.service'; import { IdentityUserService } from '../../people/services/identity-user.service';
import { TaskCloudService } from '../services/task-cloud.service'; import { TaskCloudService } from '../services/task-cloud.service';

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { Component, ViewChild, ContentChildren } from '@angular/core'; import { Component, ViewChild, ContentChildren } from '@angular/core';
import { CompleteTaskDirective } from './complete-task.directive'; import { CompleteTaskDirective } from './complete-task.directive';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { Directive, Input, HostListener, Output, EventEmitter, OnInit } from '@angular/core'; import { Directive, Input, HostListener, Output, EventEmitter, OnInit } from '@angular/core';
import { TaskCloudService } from '../services/task-cloud.service'; import { TaskCloudService } from '../services/task-cloud.service';

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { Component, ContentChildren, ViewChild } from '@angular/core'; import { Component, ContentChildren, ViewChild } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { setupTestBed } from '@alfresco/adf-core'; import { setupTestBed } from '@alfresco/adf-core';

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { Directive, Input, HostListener, Output, EventEmitter, OnInit } from '@angular/core'; import { Directive, Input, HostListener, Output, EventEmitter, OnInit } from '@angular/core';
import { TaskCloudService } from '../services/task-cloud.service'; import { TaskCloudService } from '../services/task-cloud.service';

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation, OnDestroy, ViewChild } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation, OnDestroy, ViewChild } from '@angular/core';
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core'; import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
import moment, { Moment } from 'moment'; import moment, { Moment } from 'moment';

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export class StartTaskCloudRequestModel { export class StartTaskCloudRequestModel {
name: string; name: string;

View File

@@ -1,3 +1,20 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
export enum TasksListCloudPreferences { export enum TasksListCloudPreferences {
columnOrder = 'tasks-list-cloud-columns-order', columnOrder = 'tasks-list-cloud-columns-order',

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { ElementFinder, protractor } from 'protractor'; import { ElementFinder, protractor } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions'; import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility'; import { BrowserVisibility } from '../../../core/utils/browser-visibility';

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { browser, ElementFinder } from 'protractor'; import { browser, ElementFinder } from 'protractor';
import * as path from 'path'; import * as path from 'path';

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { browser, $$, $, by, element } from 'protractor'; import { browser, $$, $, by, element } from 'protractor';
import { EditProcessFilterDialogPage } from './dialog/edit-process-filter-dialog.page'; import { EditProcessFilterDialogPage } from './dialog/edit-process-filter-dialog.page';
import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserVisibility } from '../../core/utils/browser-visibility';

View File

@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { Logger } from '../../core/utils/logger'; import { Logger } from '../../core/utils/logger';
import { ApiService } from '../../../shared/api/api.service'; import { ApiService } from '../../../shared/api/api.service';
import { ModelsApi } from '@alfresco/js-api'; import { ModelsApi } from '@alfresco/js-api';

9
package-lock.json generated
View File

@@ -29033,6 +29033,15 @@
} }
} }
}, },
"eslint-plugin-license-header": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-license-header/-/eslint-plugin-license-header-0.6.0.tgz",
"integrity": "sha512-IEywStBWaDBDMkogYoKUAdaOuomZ+YaQmdoSD2vHmXobekM+XuP6SWLlvwUUhIbdocn3MTlb5CUJ8E4VHz1c/w==",
"dev": true,
"requires": {
"requireindex": "^1.2.0"
}
},
"eslint-plugin-prefer-arrow": { "eslint-plugin-prefer-arrow": {
"version": "1.2.3", "version": "1.2.3",
"resolved": "https://registry.npmjs.org/eslint-plugin-prefer-arrow/-/eslint-plugin-prefer-arrow-1.2.3.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-prefer-arrow/-/eslint-plugin-prefer-arrow-1.2.3.tgz",

View File

@@ -153,6 +153,7 @@
"eslint-plugin-ban": "^1.6.0", "eslint-plugin-ban": "^1.6.0",
"eslint-plugin-import": "2.26.0", "eslint-plugin-import": "2.26.0",
"eslint-plugin-jsdoc": "39.3.3", "eslint-plugin-jsdoc": "39.3.3",
"eslint-plugin-license-header": "0.6.0",
"eslint-plugin-prefer-arrow": "1.2.3", "eslint-plugin-prefer-arrow": "1.2.3",
"eslint-plugin-rxjs": "^5.0.2", "eslint-plugin-rxjs": "^5.0.2",
"eslint-plugin-unicorn": "^43.0.1", "eslint-plugin-unicorn": "^43.0.1",

View File

@@ -1,46 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path = require("path");
const Lint = require("tslint");
const minimatch = require("minimatch");
const fs = require("fs");
class Rule extends Lint.Rules.AbstractRule {
apply(sourceFile) {
return this.applyWithWalker(new ADFEnterpriseLicenseBannerRule(sourceFile, this.getOptions()));
}
}
Rule.metadata = {
ruleName: 'adf-enterprise-license-banner',
type: 'maintainability',
description: ``,
descriptionDetails: ``,
rationale: ``,
options: null,
optionsDescription: `Not configurable.`,
typescriptOnly: true,
};
Rule.FAILURE_STRING = 'Missing license header in this TypeScript ' +
'file Every TypeScript file of the library needs to have the Alfresco license banner at the top.';
exports.Rule = Rule;
class ADFEnterpriseLicenseBannerRule extends Lint.RuleWalker {
constructor(sourceFile, options) {
super(sourceFile, options);
const fileGlobs = options.ruleArguments;
this.licensePath = options.ruleArguments[1];
const relativeFilePath = path.relative(process.cwd(), sourceFile.fileName);
this._enabled = fileGlobs.some(p => minimatch(relativeFilePath, p));
}
visitSourceFile(sourceFile) {
if (!this._enabled) {
return;
}
const fileContent = sourceFile.getFullText();
const licenseBanner = fs.readFileSync(this.licensePath, 'utf8');
const licenseCommentPos = fileContent.indexOf(licenseBanner);
const tslintFix = Lint.Replacement.appendText(0, licenseBanner + '\n\n');
if (licenseCommentPos !== 0) {
return this.addFailureAt(0, 0, Rule.FAILURE_STRING, tslintFix);
}
super.visitSourceFile(sourceFile);
}
}

View File

@@ -1,69 +0,0 @@
import * as path from 'path';
import * as ts from 'typescript';
import * as Lint from 'tslint';
import * as minimatch from 'minimatch';
import * as fs from 'fs';
/**
* Rule that walks through all TypeScript files of public packages and shows failures if a
* file does not have the license banner at the top of the file.
*/
export class Rule extends Lint.Rules.AbstractRule {
public static metadata: Lint.IRuleMetadata = {
ruleName: 'adf-enterprise-license-banner',
type: 'maintainability',
description: ``,
descriptionDetails: ``,
rationale: ``,
options: null,
optionsDescription: `Not configurable.`,
typescriptOnly: true,
};
static FAILURE_STRING: string = 'Missing license header in this TypeScript ' +
'file Every TypeScript file of the library needs to have the Alfresco license banner at the top.';
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
return this.applyWithWalker(
new ADFEnterpriseLicenseBannerRule(sourceFile,
this.getOptions()));
}
}
class ADFEnterpriseLicenseBannerRule extends Lint.RuleWalker {
/** Whether the walker should check the current source file. */
private _enabled: boolean;
private licensePath: string;
constructor(sourceFile: ts.SourceFile, options: Lint.IOptions) {
super(sourceFile, options);
// Globs that are used to determine which files to lint.
const fileGlobs = options.ruleArguments;
this.licensePath = options.ruleArguments[1];
// Relative path for the current TypeScript source file.
const relativeFilePath = path.relative(process.cwd(), sourceFile.fileName);
// Whether the file should be checked at all.
this._enabled = fileGlobs.some(p => minimatch(relativeFilePath, p));
}
visitSourceFile(sourceFile: ts.SourceFile) {
if (!this._enabled) {
return;
}
const fileContent = sourceFile.getFullText();
const licenseBanner = fs.readFileSync(this.licensePath,'utf8');
const licenseCommentPos = fileContent.indexOf(licenseBanner);
const tslintFix = Lint.Replacement.appendText(0, licenseBanner + '\n\n');
if (licenseCommentPos !== 0) {
return this.addFailureAt(0, 0, Rule.FAILURE_STRING, tslintFix);
}
super.visitSourceFile(sourceFile);
}
}

View File

@@ -1,46 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path = require("path");
const Lint = require("tslint");
const minimatch = require("minimatch");
const fs = require("fs");
class Rule extends Lint.Rules.AbstractRule {
apply(sourceFile) {
return this.applyWithWalker(new ADFLicenseBannerRule(sourceFile, this.getOptions()));
}
}
Rule.metadata = {
ruleName: 'adf-license-banner',
type: 'maintainability',
description: ``,
descriptionDetails: ``,
rationale: ``,
options: null,
optionsDescription: `Not configurable.`,
typescriptOnly: true,
};
Rule.FAILURE_STRING = 'Missing license header in this TypeScript ' +
'file Every TypeScript file of the library needs to have the Alfresco license banner at the top.';
exports.Rule = Rule;
class ADFLicenseBannerRule extends Lint.RuleWalker {
constructor(sourceFile, options) {
super(sourceFile, options);
const fileGlobs = options.ruleArguments;
this.licensePath = options.ruleArguments[1];
const relativeFilePath = path.relative(process.cwd(), sourceFile.fileName);
this._enabled = fileGlobs.some(p => minimatch(relativeFilePath, p));
}
visitSourceFile(sourceFile) {
if (!this._enabled) {
return;
}
const fileContent = sourceFile.getFullText();
const licenseBanner = fs.readFileSync(this.licensePath, 'utf8');
const licenseCommentPos = fileContent.indexOf(licenseBanner);
const tslintFix = Lint.Replacement.appendText(0, licenseBanner + '\n\n');
if (licenseCommentPos !== 0) {
return this.addFailureAt(0, 0, Rule.FAILURE_STRING, tslintFix);
}
super.visitSourceFile(sourceFile);
}
}

View File

@@ -1,69 +0,0 @@
import * as path from 'path';
import * as ts from 'typescript';
import * as Lint from 'tslint';
import * as minimatch from 'minimatch';
import * as fs from 'fs';
/**
* Rule that walks through all TypeScript files of public packages and shows failures if a
* file does not have the license banner at the top of the file.
*/
export class Rule extends Lint.Rules.AbstractRule {
public static metadata: Lint.IRuleMetadata = {
ruleName: 'adf-license-banner',
type: 'maintainability',
description: ``,
descriptionDetails: ``,
rationale: ``,
options: null,
optionsDescription: `Not configurable.`,
typescriptOnly: true,
};
static FAILURE_STRING: string = 'Missing license header in this TypeScript ' +
'file Every TypeScript file of the library needs to have the Alfresco license banner at the top.';
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
return this.applyWithWalker(
new ADFLicenseBannerRule(sourceFile,
this.getOptions()));
}
}
class ADFLicenseBannerRule extends Lint.RuleWalker {
/** Whether the walker should check the current source file. */
private _enabled: boolean;
private licensePath: string;
constructor(sourceFile: ts.SourceFile, options: Lint.IOptions) {
super(sourceFile, options);
// Globs that are used to determine which files to lint.
const fileGlobs = options.ruleArguments;
this.licensePath = options.ruleArguments[1];
// Relative path for the current TypeScript source file.
const relativeFilePath = path.relative(process.cwd(), sourceFile.fileName);
// Whether the file should be checked at all.
this._enabled = fileGlobs.some(p => minimatch(relativeFilePath, p));
}
visitSourceFile(sourceFile: ts.SourceFile) {
if (!this._enabled) {
return;
}
const fileContent = sourceFile.getFullText();
const licenseBanner = fs.readFileSync(this.licensePath,'utf8');
const licenseCommentPos = fileContent.indexOf(licenseBanner);
const tslintFix = Lint.Replacement.appendText(0, licenseBanner + '\n\n');
if (licenseCommentPos !== 0) {
return this.addFailureAt(0, 0, Rule.FAILURE_STRING, tslintFix);
}
super.visitSourceFile(sourceFile);
}
}

View File

@@ -6,6 +6,4 @@ var adfFileNameRule_1 = require("./adfFileNameRule");
exports.ADFComponentSelectorRule = adfFileNameRule_1.Rule; exports.ADFComponentSelectorRule = adfFileNameRule_1.Rule;
var adfPrefixNameRule_1 = require("./adfPrefixNameRule"); var adfPrefixNameRule_1 = require("./adfPrefixNameRule");
exports.ADFOutputPrefixNameRule = adfPrefixNameRule_1.Rule; exports.ADFOutputPrefixNameRule = adfPrefixNameRule_1.Rule;
var adfLicenseBannerRule_1 = require("./adfLicenseBannerRule");
exports.ADFLicenseBannerRule = adfLicenseBannerRule_1.Rule;
exports.rulesDirectory = '.'; exports.rulesDirectory = '.';

View File

@@ -1,6 +1,5 @@
export { Rule as ADFClassNameRule } from './adfClassNameRule'; export { Rule as ADFClassNameRule } from './adfClassNameRule';
export { Rule as ADFComponentSelectorRule } from './adfFileNameRule'; export { Rule as ADFComponentSelectorRule } from './adfFileNameRule';
export { Rule as ADFOutputPrefixNameRule } from './adfPrefixNameRule'; export { Rule as ADFOutputPrefixNameRule } from './adfPrefixNameRule';
export { Rule as ADFLicenseBannerRule } from './adfLicenseBannerRule';
export const rulesDirectory = '.'; export const rulesDirectory = '.';