feat: make coverage and prettier run

This commit is contained in:
Mats Larsen
2023-02-25 21:40:42 +01:00
parent 8d381a7448
commit e1fcbfc77d
25 changed files with 185 additions and 1275 deletions
+1 -1
View File
@@ -2,9 +2,9 @@
# build generated files
/.node-bin
/.npm-updated
/.nyc_output
/node_modules
/out
/coverage
# generated from opcode docenzier.py scripts
/asm-docs*
-14
View File
@@ -1,14 +0,0 @@
all: true
include:
- lib/**/*.js
- lib/**/*.ts
exclude:
- lib/asm-docs/generated/asm-docs-*
- lib/compilers/fake-for-test.js
- lib/**/*.d.ts
report-dir: ./out/coverage
reporter:
- lcov
require:
- source-map-support/register
- ts-node/register
+1 -1
View File
@@ -4,9 +4,9 @@
# build generated files
/.node-bin
/.npm-updated
/.nyc_output
/node_modules
/out
/coverage
# generated from opcode docenzier.py scripts
/asm-docs*
+1 -1
View File
@@ -17,7 +17,7 @@ rules:
objects: always-multiline
imports: always-multiline
exports: always-multiline
functions: never
functions: always-multiline
eol-last:
- error
- always
+1 -1
View File
@@ -25,7 +25,7 @@
import * as fs from 'fs';
import path from 'path';
import { parse } from './stacktrace.js';
import {parse} from './stacktrace.js';
function check_path(parent: string, directory: string) {
// https://stackoverflow.com/a/45242825/15675011
+2 -2
View File
@@ -24,7 +24,7 @@
import _ from 'underscore';
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
import type {ResultLine} from '../../types/resultline/resultline.interfaces.js';
import {unwrap} from '../assert.js';
@@ -176,7 +176,7 @@ export class GolangCompiler extends BaseCompiler {
collisions: number,
ins: string,
args: string,
usedLabels: Record<string, boolean>
usedLabels: Record<string, boolean>,
): string {
// Check if last argument is a decimal number.
const match = args.match(DECIMAL_RE);
+2 -3
View File
@@ -24,7 +24,6 @@
import path from 'path';
import type {CompilationResult} from '../../types/compilation/compilation.interfaces.js';
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
@@ -64,7 +63,7 @@ export class LLVMMOSCompiler extends ClangCompiler {
demangle,
staticReloc: boolean,
dynamicReloc: boolean,
filters: ParseFiltersAndOutputOptions
filters: ParseFiltersAndOutputOptions,
) {
if (!outputFilename.endsWith('.elf') && (await utils.fileExists(outputFilename + '.elf'))) {
outputFilename = outputFilename + '.elf';
@@ -79,7 +78,7 @@ export class LLVMMOSCompiler extends ClangCompiler {
demangle,
staticReloc,
dynamicReloc,
filters
filters,
);
if (this.compiler.exe.includes('nes')) {
+8 -6
View File
@@ -3,10 +3,12 @@
// | Graceful process exit manager. |
// |----------------------------------------------------------------------|
export type GracefulListener = (signal: string, details?: object)
=> (void | any | Promise<any> | Promise<void> | Promise<Error>)
export type GracefulListener = (
signal: string,
details?: object,
) => void | any | Promise<any> | Promise<void> | Promise<Error>;
export type GracefulSubscription = () => void
export type GracefulSubscription = () => void;
export class Graceful {
private static DEADLY_SIGNALS = ['SIGTERM', 'SIGINT', 'SIGBREAK', 'SIGHUP'];
@@ -27,7 +29,7 @@ export class Graceful {
process.exitCode = 1;
Graceful.onDeadlyEvent('unhandledRejection', event);
};
private static signalsListeners: { [signal: string]: (event: any) => void } = {};
private static signalsListeners: {[signal: string]: (event: any) => void} = {};
public static get captureExceptions() {
return Graceful._captureExceptions;
@@ -60,7 +62,7 @@ export class Graceful {
}
public static on(signal: 'exit', listener: GracefulListener): GracefulSubscription {
if (signal !== 'exit') throw new Error('Only supports \'exit\' signal');
if (signal !== 'exit') throw new Error("Only supports 'exit' signal");
Graceful.listeners.push(listener);
@@ -69,7 +71,7 @@ export class Graceful {
}
public static off(signal: 'exit', listener: GracefulListener) {
if (signal !== 'exit') throw new Error('Only supports \'exit\' signal');
if (signal !== 'exit') throw new Error("Only supports 'exit' signal");
const index = Graceful.listeners.indexOf(listener);
if (index !== -1) Graceful.listeners.splice(index, 1);
+5 -5
View File
@@ -285,7 +285,7 @@ export class LlvmPassDumpParser {
if (name !== '<loop>') {
previousFunction = name;
}
} else if(!header.endsWith('(invalidated)')) {
} else if (!header.endsWith('(invalidated)')) {
// Issue #4195, before SimpleLoopUnswitchPass dumps just the loop but after can dump the full IR if the
// loop is invalidated. The next pass can also be loop-only and should be a loop in the same function
// so we preserve function name.
@@ -325,7 +325,7 @@ export class LlvmPassDumpParser {
affectedFunction: fn,
machine,
lines,
})
}),
);
previousFunction = fn;
} else {
@@ -374,7 +374,7 @@ export class LlvmPassDumpParser {
passesMatch(current_dump.header, next_dump.header),
'',
current_dump.header,
next_dump.header
next_dump.header,
);
assert(current_dump.machine === next_dump.machine);
pass.name = current_dump.header.slice('IR Dump Before '.length);
@@ -474,11 +474,11 @@ export class LlvmPassDumpParser {
process(
output: ResultLine[],
_: ParseFiltersAndOutputOptions,
llvmOptPipelineOptions: LLVMOptPipelineBackendOptions
llvmOptPipelineOptions: LLVMOptPipelineBackendOptions,
) {
// Crop out any junk before the pass dumps (e.g. warnings)
const ir = output.slice(
output.findIndex(line => line.text.match(this.irDumpHeader) || line.text.match(this.machineCodeDumpHeader))
output.findIndex(line => line.text.match(this.irDumpHeader) || line.text.match(this.machineCodeDumpHeader)),
);
const preprocessed_lines = this.applyIrFilters(ir, llvmOptPipelineOptions);
return this.breakdownOutput(preprocessed_lines, llvmOptPipelineOptions);
+2 -2
View File
@@ -23,7 +23,7 @@
// POSSIBILITY OF SUCH DAMAGE.
import * as express from 'express';
import { profanities } from 'profanities';
import {profanities} from 'profanities';
import {logger} from '../logger.js';
import {CompilerProps} from '../properties.js';
@@ -99,7 +99,7 @@ export abstract class StorageBase {
.then(result => {
logger.info(
`Unique subhash '${result.uniqueSubHash}' ` +
`(${result.alreadyPresent ? 'was already present' : 'newly-created'})`
`(${result.alreadyPresent ? 'was already present' : 'newly-created'})`,
);
if (result.alreadyPresent) {
return result;
+141 -1214
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -112,6 +112,7 @@
"@typescript-eslint/parser": "^5.8.0",
"approvals": "https://github.com/approvals/Approvals.NodeJS.git#d3cc041b5b8950e51671038094a3cee3f4eac9be",
"aws-sdk-mock": "^5.5.0",
"c8": "^7.13.0",
"chai": "^4.3.4",
"chai-as-promised": "^7.1.1",
"chai-http": "^4.2.1",
@@ -140,7 +141,6 @@
"mock-fs": "^5.1.2",
"monaco-editor-webpack-plugin": "^7.0.1",
"nock": "^13.2.1",
"nyc": "^15.1.0",
"prettier": "^2.5.1",
"sass": "^1.45.1",
"sass-loader": "^12.4.0",
@@ -164,12 +164,12 @@
},
"scripts": {
"ci-lint": "eslint --format github .",
"ci-test": "nyc npm run test",
"ci-test": "c8 npm run test",
"lint": "eslint --max-warnings=0 . --fix",
"lint-check": "eslint --max-warnings=0 .",
"lint-files": "eslint --max-warnings=0",
"test": "ts-node-esm ./node_modules/.bin/mocha -b 'test/**/*.ts' 'test/**/*.js'",
"test-min": "mocha -b --config .mocharc-min.yml",
"test-min": "ts-node-esm ./node_modules/.bin/mocha -b --config .mocharc-min.yml",
"fix": "npm run lint && npm run format && npm run ts-check",
"check": "npm run ts-check && npm run lint-check && npm run test-min -- --reporter min",
"dev": "cross-env NODE_ENV=DEV ts-node-esm app.ts",
@@ -183,7 +183,7 @@
"format": "prettier --write .",
"format-files": "prettier --write --ignore-unknown",
"ts-compile": "tsc",
"ts-check": "tsc -p ./tsconfig.backend.json --noEmit --module esnext && tsc -p ./tsconfig.frontend.json --noEmit",
"ts-check": "tsc -p ./tsconfig.backend.json --noEmit && tsc -p ./tsconfig.frontend.json --noEmit",
"webpack": "ts-node-esm ./node_modules/.bin/webpack-cli --node-env=production --config webpack.config.esm.ts"
},
"license": "BSD-2-Clause"
+1 -1
View File
@@ -17,7 +17,7 @@ rules:
objects: always-multiline
imports: always-multiline
exports: always-multiline
functions: never
functions: always-multiline
eol-last:
- error
- always
-4
View File
@@ -1,4 +0,0 @@
module.exports = {
...require('../.prettierrc.cjs'),
trailingComma: 'es5',
};
+1 -1
View File
@@ -23,7 +23,7 @@
// POSSIBILITY OF SUCH DAMAGE.
import {isString} from '../lib/common-utils.js';
import { parse } from '../lib/stacktrace.js';
import {parse} from '../lib/stacktrace.js';
// This file defines three assert utilities:
// assert(condition, message?, extra_info...?): asserts condition
+4 -4
View File
@@ -49,14 +49,14 @@ export type EventMap = {
compiler: CompilerInfo | null,
options: string,
editorId: number,
treeId: number
treeId: number,
) => void;
compilerClose: (compilerId: number, treeId: boolean | number) => void;
compileResult: (
compilerId: number,
compiler: CompilerInfo,
result: CompilationResult,
language: Language | undefined
language: Language | undefined,
) => void;
compilerFavoriteChange: (compilerId: number) => void;
compilerFlagsChange: (compilerId: number, options: string) => void;
@@ -82,7 +82,7 @@ export type EventMap = {
compiler: any,
options: string,
editorId: boolean | number,
treeId: boolean | number
treeId: boolean | number,
) => void;
executorClose: (executorId: number) => void;
executorOpen: (executorId: number, editorId: boolean | number) => void;
@@ -128,7 +128,7 @@ export type EventMap = {
colEnd: number,
reveal: boolean,
sender: string,
editorId?: number
editorId?: number,
) => void;
ppViewClosed: (compilerId: number) => void;
ppViewOpened: (compilerId: number) => void;
+2 -2
View File
@@ -60,7 +60,7 @@ type EditorConstructionType<E extends EditorKinds> = E extends monaco.editor.ISt
*/
export function extendConfig<
E extends EditorKinds = monaco.editor.IStandaloneCodeEditor,
T = EditorConstructionType<E>
T = EditorConstructionType<E>,
>(overrides: T, settings?: Pick<SiteSettings, 'editorsFFont' | 'autoIndent' | 'useVim' | 'editorsFLigatures'>): T {
if (settings !== undefined) {
return _.extend(
@@ -72,7 +72,7 @@ export function extendConfig<
vimInUse: settings.useVim,
fontLigatures: settings.editorsFLigatures,
},
overrides
overrides,
);
}
return _.extend({}, DEFAULT_MONACO_CONFIG, overrides);
+1 -1
View File
@@ -22,8 +22,8 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
import {AsmParser} from '../lib/parsers/asm-parser.js';
import {VcAsmParser} from '../lib/parsers/asm-parser-vc.js';
import {AsmParser} from '../lib/parsers/asm-parser.js';
import {AsmRegex} from '../lib/parsers/asmregex.js';
import {makeFakeParseFiltersAndOutputOptions} from './utils.js';
+1 -1
View File
@@ -36,7 +36,7 @@ import {S3Cache} from '../lib/cache/s3.js';
import {fs, path, shouldExist} from './utils.js';
type AWSError = AWSSdk.AWSError
type AWSError = AWSSdk.AWSError;
function newTempDir() {
temp.track(true);
+2 -2
View File
@@ -26,15 +26,15 @@ import path from 'path';
import approvals from 'approvals';
import {AsmParser} from '../lib/parsers/asm-parser.js';
import {CC65AsmParser} from '../lib/parsers/asm-parser-cc65.js';
import {AsmEWAVRParser} from '../lib/parsers/asm-parser-ewavr.js';
import {SassAsmParser} from '../lib/parsers/asm-parser-sass.js';
import {VcAsmParser} from '../lib/parsers/asm-parser-vc.js';
import {AsmParser} from '../lib/parsers/asm-parser.js';
import {fs, resolvePathFromTestRoot} from './utils.js';
approvals.mocha(resolvePathFromTestRoot("filter-cases"));
approvals.mocha(resolvePathFromTestRoot('filter-cases'));
function processAsm(filename, filters) {
const file = fs.readFileSync(filename, 'utf8');
+1 -1
View File
@@ -25,8 +25,8 @@
import cloneDeep from 'lodash.clonedeep';
import {LlvmAstParser} from '../lib/llvm-ast.js';
import * as properties from '../lib/properties.js';
import {PropertyValue} from '../lib/properties.interfaces.js';
import * as properties from '../lib/properties.js';
import * as utils from '../lib/utils.js';
import {fs, should} from './utils.js';
+1 -1
View File
@@ -24,9 +24,9 @@
import path from 'path';
import {FPCCompiler} from '../lib/compilers/pascal.js';
import {PascalUtils} from '../lib/compilers/pascal-utils.js';
import {PascalWinCompiler} from '../lib/compilers/pascal-win.js';
import {FPCCompiler} from '../lib/compilers/pascal.js';
import {PascalDemangler} from '../lib/demangler/index.js';
import * as utils from '../lib/utils.js';
+1 -1
View File
@@ -25,8 +25,8 @@
import fs from 'fs';
import {unwrap} from '../lib/assert.js';
import {loadSponsorsFromString, makeIconSets, parse} from '../lib/sponsors.js';
import {Sponsor} from '../lib/sponsors.interfaces.js';
import {loadSponsorsFromString, makeIconSets, parse} from '../lib/sponsors.js';
import {resolvePathFromTestRoot, should} from './utils.js';
+1 -1
View File
@@ -22,8 +22,8 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
import {ClientState} from '../lib/clientstate.js';
import {ClientStateGoldenifier, ClientStateNormalizer} from '../lib/clientstate-normalizer.js';
import {ClientState} from '../lib/clientstate.js';
import {fs} from './utils.js';
+1 -1
View File
@@ -9,5 +9,5 @@
"strictPropertyInitialization": false,
"lib": ["dom", "es5", "dom.iterable"]
},
"exclude": ["out", "test", "etc", "examples", "app.ts", "compiler-args-app.ts", "lib", "examples"]
"exclude": ["out", "test", "etc", "examples", "app.ts", "compiler-args-app.ts", "lib", "examples", "webpack.config.esm.ts"]
}