Address minor code style comments
move code out of `converter/index.ts`. change Converter to be an interface. remove unused function remove commented out import Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2021 Spotify AB
|
||||
*
|
||||
* 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 { FileEntry } from '../jsoncoverage-types';
|
||||
|
||||
export interface Converter {
|
||||
convert(xml: unknown, scmFiles: Array<string>): Array<FileEntry>;
|
||||
}
|
||||
@@ -16,11 +16,11 @@
|
||||
import { BranchHit, FileEntry } from '../jsoncoverage-types';
|
||||
import { CoberturaXML, InnerClass, LineHit } from './types';
|
||||
import { Logger } from 'winston';
|
||||
import { Converter } from '.';
|
||||
import { Converter } from './Converter';
|
||||
|
||||
export class Cobertura extends Converter {
|
||||
export class Cobertura implements Converter {
|
||||
constructor(readonly logger: Logger) {
|
||||
super(logger);
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,11 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Logger } from 'winston';
|
||||
import { FileEntry } from '../jsoncoverage-types';
|
||||
|
||||
export abstract class Converter {
|
||||
constructor(readonly logger: Logger) {}
|
||||
|
||||
abstract convert(xml: any, scmFiles: Array<string>): Array<FileEntry>;
|
||||
}
|
||||
export * from './Converter';
|
||||
export { Cobertura } from './cobertura';
|
||||
export { Jacoco } from './jacoco';
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
import { BranchHit, FileEntry } from '../jsoncoverage-types';
|
||||
import { JacocoSourceFile, JacocoXML } from './types';
|
||||
import { Logger } from 'winston';
|
||||
import { Converter } from '.';
|
||||
import { Converter } from './Converter';
|
||||
|
||||
type ParsedLine = {
|
||||
number: number;
|
||||
@@ -26,9 +26,9 @@ type ParsedLine = {
|
||||
covered_branches: number;
|
||||
};
|
||||
|
||||
export class Jacoco extends Converter {
|
||||
export class Jacoco implements Converter {
|
||||
constructor(readonly logger: Logger) {
|
||||
super(logger);
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user