diff --git a/eslint.config.mjs b/eslint.config.mjs index 814e2b83..102bf3c9 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -3,18 +3,14 @@ * Licensed under the MIT License. */ -import eslint from '@eslint/js' -import globals from 'globals' -import tseslint from 'typescript-eslint' -import typescriptParser from '@typescript-eslint/parser' +import eslint from "@eslint/js"; +import globals from "globals"; +import tseslint from "typescript-eslint"; +import typescriptParser from "@typescript-eslint/parser"; export default tseslint.config( { - ignores: [ - '**/*.js', - 'debug/**/*', - 'release/**/*' - ] + ignores: ["**/*.js", "debug/**/*", "release/**/*"], }, eslint.configs.recommended, ...tseslint.configs.strictTypeChecked, @@ -29,325 +25,331 @@ export default tseslint.config( parser: typescriptParser, parserOptions: { ecmaVersion: 2017, - project: './src/task/tsconfig.json', + project: "./src/task/tsconfig.json", }, }, rules: { - '@typescript-eslint/consistent-type-exports': 'error', - '@typescript-eslint/consistent-type-imports': 'error', - '@typescript-eslint/default-param-last': 'error', - '@typescript-eslint/explicit-function-return-type': 'error', - '@typescript-eslint/explicit-member-accessibility': 'error', - '@typescript-eslint/member-ordering': [ - 'error', + "@typescript-eslint/consistent-type-exports": "error", + "@typescript-eslint/consistent-type-imports": "error", + "@typescript-eslint/default-param-last": "error", + "@typescript-eslint/explicit-function-return-type": "error", + "@typescript-eslint/explicit-member-accessibility": "error", + "@typescript-eslint/member-ordering": [ + "error", { - 'default': [ - 'signature', - 'call-signature', - 'public-static-field', - 'protected-static-field', - 'private-static-field', - '#private-static-field', - 'public-decorated-field', - 'protected-decorated-field', - 'private-decorated-field', - 'public-instance-field', - 'protected-instance-field', - 'private-instance-field', - '#private-instance-field', - 'public-abstract-field', - 'protected-abstract-field', - 'public-field', - 'protected-field', - 'private-field', - '#private-field', - 'static-field', - 'instance-field', - 'abstract-field', - 'decorated-field', - 'field', - 'static-initialization', - 'public-constructor', - 'protected-constructor', - 'private-constructor', - 'constructor', - 'public-static-accessor', - 'protected-static-accessor', - 'private-static-accessor', - '#private-static-accessor', - 'public-decorated-accessor', - 'protected-decorated-accessor', - 'private-decorated-accessor', - 'public-instance-accessor', - 'protected-instance-accessor', - 'private-instance-accessor', - '#private-instance-accessor', - 'public-abstract-accessor', - 'protected-abstract-accessor', - 'public-accessor', - 'protected-accessor', - 'private-accessor', - '#private-accessor', - 'static-accessor', - 'instance-accessor', - 'abstract-accessor', - 'decorated-accessor', - 'accessor', - ['public-static-get', 'public-static-set'], - ['protected-static-get', 'protected-static-set'], - ['private-static-get', 'private-static-set'], - ['#private-static-get', '#private-static-set'], - ['public-decorated-get', 'private-decorated-set'], - ['protected-decorated-get', 'protected-decorated-set'], - ['private-decorated-get', 'private-decorated-set'], - ['public-instance-get', 'public-instance-set'], - ['protected-instance-get', 'protected-instance-set'], - ['private-instance-get', 'private-instance-set'], - ['#private-instance-get', '#private-instance-set'], - ['public-abstract-get', 'public-abstract-set'], - ['protected-abstract-get', 'protected-abstract-set'], - ['public-get', 'public-set'], - ['protected-get', 'protected-set'], - ['private-get', 'private-set'], - ['#private-get', '#private-set'], - ['static-get', 'static-set'], - ['instance-get', 'instance-set'], - ['abstract-get', 'abstract-set'], - ['decorated-get', 'decorated-set'], - ['get', 'set'], - 'public-static-method', - 'protected-static-method', - 'private-static-method', - '#private-static-method', - 'public-decorated-method', - 'protected-decorated-method', - 'private-decorated-method', - 'public-instance-method', - 'protected-instance-method', - 'private-instance-method', - '#private-instance-method', - 'public-abstract-method', - 'protected-abstract-method', - 'public-method', - 'protected-method', - 'private-method', - '#private-method', - 'static-method', - 'instance-method', - 'abstract-method', - 'decorated-method', - 'method', + default: [ + "signature", + "call-signature", + "public-static-field", + "protected-static-field", + "private-static-field", + "#private-static-field", + "public-decorated-field", + "protected-decorated-field", + "private-decorated-field", + "public-instance-field", + "protected-instance-field", + "private-instance-field", + "#private-instance-field", + "public-abstract-field", + "protected-abstract-field", + "public-field", + "protected-field", + "private-field", + "#private-field", + "static-field", + "instance-field", + "abstract-field", + "decorated-field", + "field", + "static-initialization", + "public-constructor", + "protected-constructor", + "private-constructor", + "constructor", + "public-static-accessor", + "protected-static-accessor", + "private-static-accessor", + "#private-static-accessor", + "public-decorated-accessor", + "protected-decorated-accessor", + "private-decorated-accessor", + "public-instance-accessor", + "protected-instance-accessor", + "private-instance-accessor", + "#private-instance-accessor", + "public-abstract-accessor", + "protected-abstract-accessor", + "public-accessor", + "protected-accessor", + "private-accessor", + "#private-accessor", + "static-accessor", + "instance-accessor", + "abstract-accessor", + "decorated-accessor", + "accessor", + ["public-static-get", "public-static-set"], + ["protected-static-get", "protected-static-set"], + ["private-static-get", "private-static-set"], + ["#private-static-get", "#private-static-set"], + ["public-decorated-get", "private-decorated-set"], + ["protected-decorated-get", "protected-decorated-set"], + ["private-decorated-get", "private-decorated-set"], + ["public-instance-get", "public-instance-set"], + ["protected-instance-get", "protected-instance-set"], + ["private-instance-get", "private-instance-set"], + ["#private-instance-get", "#private-instance-set"], + ["public-abstract-get", "public-abstract-set"], + ["protected-abstract-get", "protected-abstract-set"], + ["public-get", "public-set"], + ["protected-get", "protected-set"], + ["private-get", "private-set"], + ["#private-get", "#private-set"], + ["static-get", "static-set"], + ["instance-get", "instance-set"], + ["abstract-get", "abstract-set"], + ["decorated-get", "decorated-set"], + ["get", "set"], + "public-static-method", + "protected-static-method", + "private-static-method", + "#private-static-method", + "public-decorated-method", + "protected-decorated-method", + "private-decorated-method", + "public-instance-method", + "protected-instance-method", + "private-instance-method", + "#private-instance-method", + "public-abstract-method", + "protected-abstract-method", + "public-method", + "protected-method", + "private-method", + "#private-method", + "static-method", + "instance-method", + "abstract-method", + "decorated-method", + "method", ], }, ], - '@typescript-eslint/method-signature-style': 'error', - '@typescript-eslint/naming-convention': 'error', - '@typescript-eslint/no-array-constructor': 'error', - '@typescript-eslint/no-invalid-this': 'error', - '@typescript-eslint/no-loop-func': 'error', - '@typescript-eslint/no-magic-numbers': ['error', {'enforceConst': true,'ignore': [0,1], 'ignoreArrayIndexes': true}], - '@typescript-eslint/no-misused-new': 'error', - '@typescript-eslint/no-misused-promises': 'error', - '@typescript-eslint/no-mixed-enums': 'error', - '@typescript-eslint/no-namespace': 'error', - '@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error', - '@typescript-eslint/no-redeclare': 'error', - '@typescript-eslint/no-restricted-imports': 'error', - '@typescript-eslint/no-shadow': 'error', - '@typescript-eslint/no-this-alias': 'error', - '@typescript-eslint/no-unnecessary-parameter-property-assignment': 'error', - '@typescript-eslint/no-unnecessary-qualifier': 'error', - '@typescript-eslint/no-unnecessary-type-constraint': 'error', - '@typescript-eslint/no-unnecessary-type-parameters': 'error', - '@typescript-eslint/no-unsafe-declaration-merging': 'error', - '@typescript-eslint/no-unsafe-enum-comparison': 'error', - '@typescript-eslint/no-unsafe-function-type': 'error', - '@typescript-eslint/no-unsafe-unary-minus': 'error', - '@typescript-eslint/no-unused-expressions': 'error', - '@typescript-eslint/no-use-before-define': 'error', - '@typescript-eslint/no-useless-constructor': 'error', - '@typescript-eslint/no-useless-empty-export': 'error', - '@typescript-eslint/no-wrapper-object-types': 'error', - '@typescript-eslint/parameter-properties': 'error', - '@typescript-eslint/prefer-destructuring': 'error', - '@typescript-eslint/prefer-enum-initializers': 'error', - '@typescript-eslint/prefer-readonly': 'error', - '@typescript-eslint/prefer-reduce-type-parameter': 'error', - '@typescript-eslint/prefer-return-this-type': 'error', - '@typescript-eslint/promise-function-async': 'error', - '@typescript-eslint/require-array-sort-compare': 'error', - '@typescript-eslint/strict-boolean-expressions': 'error', - '@typescript-eslint/switch-exhaustiveness-check': 'error', - '@typescript-eslint/typedef': 'error', - '@typescript-eslint/unbound-method': 'error', - '@typescript-eslint/unified-signatures': 'error', - 'accessor-pairs': 'error', - 'array-callback-return': 'error', - 'arrow-body-style': 'error', - 'block-scoped-var': 'error', - 'capitalized-comments': 'error', - 'complexity': 'error', - 'consistent-return': 'error', - 'consistent-this': 'error', - 'curly': 'error', - 'default-case': 'error', - 'default-case-last': 'error', - 'default-param-last': 'error', - 'eqeqeq': 'error', - 'func-name-matching': 'error', - 'func-names': 'error', - 'func-style': 'error', - 'grouped-accessor-pairs': 'error', - 'guard-for-in': 'error', - 'id-denylist': 'error', - 'id-length': 'error', - 'id-match': 'error', - 'logical-assignment-operators': 'error', - 'max-classes-per-file': 'error', - 'max-depth': 'error', - 'max-nested-callbacks': 'error', - 'new-cap': 'error', - 'no-alert': 'error', - 'no-await-in-loop': 'error', - 'no-bitwise': 'error', - 'no-caller': 'error', - 'no-console': 'error', - 'no-const-assign': 'error', - 'no-constant-binary-expression': 'error', - 'no-constant-condition': 'error', - 'no-constructor-return': 'error', - 'no-control-regex': 'error', - 'no-debugger': 'error', - 'no-div-regex': 'error', - 'no-dupe-args': 'error', - 'no-dupe-class-members': 'error', - 'no-dupe-else-if': 'error', - 'no-dupe-keys': 'error', - 'no-duplicate-case': 'error', - 'no-duplicate-imports': 'error', - 'no-else-return': 'error', - 'no-empty': 'error', - 'no-empty-character-class': 'error', - 'no-empty-pattern': 'error', - 'no-empty-static-block': 'error', - 'no-eq-null': 'error', - 'no-eval': 'error', - 'no-ex-assign': 'error', - 'no-extend-native': 'error', - 'no-extra-bind': 'error', - 'no-extra-boolean-cast': 'error', - 'no-extra-label': 'error', - 'no-fallthrough': 'error', - 'no-func-assign': 'error', - 'no-global-assign': 'error', - 'no-implicit-coercion': 'error', - 'no-implicit-globals': 'error', - 'no-import-assign': 'error', - 'no-inline-comments': 'error', - 'no-inner-declarations': 'error', - 'no-invalid-regexp': 'error', - 'no-irregular-whitespace': 'error', - 'no-iterator': 'error', - 'no-label-var': 'error', - 'no-labels': 'error', - 'no-lone-blocks': 'error', - 'no-lonely-if': 'error', - 'no-loss-of-precision': 'error', - 'no-misleading-character-class': 'error', - 'no-multi-assign': 'error', - 'no-multi-str': 'error', - 'no-negated-condition': 'error', - 'no-nested-ternary': 'error', - 'no-new': 'error', - 'no-new-func': 'error', - 'no-new-native-nonconstructor': 'error', - 'no-new-wrappers': 'error', - 'no-nonoctal-decimal-escape': 'error', - 'no-obj-calls': 'error', - 'no-object-constructor': 'error', - 'no-octal': 'error', - 'no-octal-escape': 'error', - 'no-param-reassign': 'error', - 'no-plusplus': 'error', - 'no-promise-executor-return': 'error', - 'no-proto': 'error', - 'no-prototype-builtins': 'error', - 'no-regex-spaces': 'error', - 'no-restricted-exports': 'error', - 'no-restricted-globals': 'error', - 'no-restricted-properties': 'error', - 'no-restricted-syntax': 'error', - 'no-return-assign': 'error', - 'no-script-url': 'error', - 'no-self-assign': 'error', - 'no-self-compare': 'error', - 'no-sequences': 'error', - 'no-setter-return': 'error', - 'no-shadow-restricted-names': 'error', - 'no-sparse-arrays': 'error', - 'no-template-curly-in-string': 'error', - 'no-this-before-super': 'error', - 'no-undef': 'error', - 'no-undef-init': 'error', - 'no-unexpected-multiline': 'error', - 'no-unmodified-loop-condition': 'error', - 'no-unneeded-ternary': 'error', - 'no-unreachable': 'error', - 'no-unreachable-loop': 'error', - 'no-unsafe-finally': 'error', - 'no-unsafe-negation': 'error', - 'no-unsafe-optional-chaining': 'error', - 'no-unused-labels': 'error', - 'no-unused-private-class-members': 'error', - 'no-useless-backreference': 'error', - 'no-useless-call': 'error', - 'no-useless-catch': 'error', - 'no-useless-computed-key': 'error', - 'no-useless-concat': 'error', - 'no-useless-escape': 'error', - 'no-useless-rename': 'error', - 'no-useless-return': 'error', - 'no-var': 'error', - 'no-void': 'error', - 'no-warning-comments': 'error', - 'no-with': 'error', - 'object-shorthand': 'error', - 'one-var': ['error', 'never'], - 'operator-assignment': 'error', - 'prefer-arrow-callback': 'error', - 'prefer-const': 'error', - 'prefer-exponentiation-operator': 'error', - 'prefer-named-capture-group': 'error', - 'prefer-numeric-literals': 'error', - 'prefer-object-has-own': 'error', - 'prefer-object-spread': 'error', - 'prefer-regex-literals': 'error', - 'prefer-rest-params': 'error', - 'prefer-spread': 'error', - 'prefer-template': 'error', - 'radix': 'error', - 'require-atomic-updates': 'error', - 'require-unicode-regexp': 'error', - 'require-yield': 'error', - 'sort-imports': 'error', - 'sort-keys': 'error', - 'sort-vars': 'error', - 'strict': 'error', - 'symbol-description': 'error', - 'unicode-bom': 'error', - 'use-isnan': 'error', - 'valid-typeof': 'error', - 'vars-on-top': 'error', - 'yoda': 'error', - } + "@typescript-eslint/method-signature-style": "error", + "@typescript-eslint/naming-convention": "error", + "@typescript-eslint/no-array-constructor": "error", + "@typescript-eslint/no-invalid-this": "error", + "@typescript-eslint/no-loop-func": "error", + "@typescript-eslint/no-magic-numbers": [ + "error", + { + enforceConst: true, + ignore: [0, 1], + ignoreArrayIndexes: true, + }, + ], + "@typescript-eslint/no-misused-new": "error", + "@typescript-eslint/no-misused-promises": "error", + "@typescript-eslint/no-mixed-enums": "error", + "@typescript-eslint/no-namespace": "error", + "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error", + "@typescript-eslint/no-redeclare": "error", + "@typescript-eslint/no-restricted-imports": "error", + "@typescript-eslint/no-shadow": "error", + "@typescript-eslint/no-this-alias": "error", + "@typescript-eslint/no-unnecessary-parameter-property-assignment": + "error", + "@typescript-eslint/no-unnecessary-qualifier": "error", + "@typescript-eslint/no-unnecessary-type-constraint": "error", + "@typescript-eslint/no-unnecessary-type-parameters": "error", + "@typescript-eslint/no-unsafe-declaration-merging": "error", + "@typescript-eslint/no-unsafe-enum-comparison": "error", + "@typescript-eslint/no-unsafe-function-type": "error", + "@typescript-eslint/no-unsafe-unary-minus": "error", + "@typescript-eslint/no-unused-expressions": "error", + "@typescript-eslint/no-use-before-define": "error", + "@typescript-eslint/no-useless-constructor": "error", + "@typescript-eslint/no-useless-empty-export": "error", + "@typescript-eslint/no-wrapper-object-types": "error", + "@typescript-eslint/parameter-properties": "error", + "@typescript-eslint/prefer-destructuring": "error", + "@typescript-eslint/prefer-enum-initializers": "error", + "@typescript-eslint/prefer-readonly": "error", + "@typescript-eslint/prefer-reduce-type-parameter": "error", + "@typescript-eslint/prefer-return-this-type": "error", + "@typescript-eslint/promise-function-async": "error", + "@typescript-eslint/require-array-sort-compare": "error", + "@typescript-eslint/strict-boolean-expressions": "error", + "@typescript-eslint/switch-exhaustiveness-check": "error", + "@typescript-eslint/typedef": "error", + "@typescript-eslint/unbound-method": "error", + "@typescript-eslint/unified-signatures": "error", + "accessor-pairs": "error", + "array-callback-return": "error", + "arrow-body-style": "error", + "block-scoped-var": "error", + "capitalized-comments": "error", + complexity: "error", + "consistent-return": "error", + "consistent-this": "error", + curly: "error", + "default-case": "error", + "default-case-last": "error", + "default-param-last": "error", + eqeqeq: "error", + "func-name-matching": "error", + "func-names": "error", + "func-style": "error", + "grouped-accessor-pairs": "error", + "guard-for-in": "error", + "id-denylist": "error", + "id-length": "error", + "id-match": "error", + "logical-assignment-operators": "error", + "max-classes-per-file": "error", + "max-depth": "error", + "max-nested-callbacks": "error", + "new-cap": "error", + "no-alert": "error", + "no-await-in-loop": "error", + "no-bitwise": "error", + "no-caller": "error", + "no-console": "error", + "no-const-assign": "error", + "no-constant-binary-expression": "error", + "no-constant-condition": "error", + "no-constructor-return": "error", + "no-control-regex": "error", + "no-debugger": "error", + "no-div-regex": "error", + "no-dupe-args": "error", + "no-dupe-class-members": "error", + "no-dupe-else-if": "error", + "no-dupe-keys": "error", + "no-duplicate-case": "error", + "no-duplicate-imports": "error", + "no-else-return": "error", + "no-empty": "error", + "no-empty-character-class": "error", + "no-empty-pattern": "error", + "no-empty-static-block": "error", + "no-eq-null": "error", + "no-eval": "error", + "no-ex-assign": "error", + "no-extend-native": "error", + "no-extra-bind": "error", + "no-extra-boolean-cast": "error", + "no-extra-label": "error", + "no-fallthrough": "error", + "no-func-assign": "error", + "no-global-assign": "error", + "no-implicit-coercion": "error", + "no-implicit-globals": "error", + "no-import-assign": "error", + "no-inline-comments": "error", + "no-inner-declarations": "error", + "no-invalid-regexp": "error", + "no-irregular-whitespace": "error", + "no-iterator": "error", + "no-label-var": "error", + "no-labels": "error", + "no-lone-blocks": "error", + "no-lonely-if": "error", + "no-loss-of-precision": "error", + "no-misleading-character-class": "error", + "no-multi-assign": "error", + "no-multi-str": "error", + "no-negated-condition": "error", + "no-nested-ternary": "error", + "no-new": "error", + "no-new-func": "error", + "no-new-native-nonconstructor": "error", + "no-new-wrappers": "error", + "no-nonoctal-decimal-escape": "error", + "no-obj-calls": "error", + "no-object-constructor": "error", + "no-octal": "error", + "no-octal-escape": "error", + "no-param-reassign": "error", + "no-plusplus": "error", + "no-promise-executor-return": "error", + "no-proto": "error", + "no-prototype-builtins": "error", + "no-regex-spaces": "error", + "no-restricted-exports": "error", + "no-restricted-globals": "error", + "no-restricted-properties": "error", + "no-restricted-syntax": "error", + "no-return-assign": "error", + "no-script-url": "error", + "no-self-assign": "error", + "no-self-compare": "error", + "no-sequences": "error", + "no-setter-return": "error", + "no-shadow-restricted-names": "error", + "no-sparse-arrays": "error", + "no-template-curly-in-string": "error", + "no-this-before-super": "error", + "no-undef": "error", + "no-undef-init": "error", + "no-unexpected-multiline": "error", + "no-unmodified-loop-condition": "error", + "no-unneeded-ternary": "error", + "no-unreachable": "error", + "no-unreachable-loop": "error", + "no-unsafe-finally": "error", + "no-unsafe-negation": "error", + "no-unsafe-optional-chaining": "error", + "no-unused-labels": "error", + "no-unused-private-class-members": "error", + "no-useless-backreference": "error", + "no-useless-call": "error", + "no-useless-catch": "error", + "no-useless-computed-key": "error", + "no-useless-concat": "error", + "no-useless-escape": "error", + "no-useless-rename": "error", + "no-useless-return": "error", + "no-var": "error", + "no-void": "error", + "no-warning-comments": "error", + "no-with": "error", + "object-shorthand": "error", + "one-var": ["error", "never"], + "operator-assignment": "error", + "prefer-arrow-callback": "error", + "prefer-const": "error", + "prefer-exponentiation-operator": "error", + "prefer-named-capture-group": "error", + "prefer-numeric-literals": "error", + "prefer-object-has-own": "error", + "prefer-object-spread": "error", + "prefer-regex-literals": "error", + "prefer-rest-params": "error", + "prefer-spread": "error", + "prefer-template": "error", + radix: "error", + "require-atomic-updates": "error", + "require-unicode-regexp": "error", + "require-yield": "error", + "sort-imports": "error", + "sort-keys": "error", + "sort-vars": "error", + strict: "error", + "symbol-description": "error", + "unicode-bom": "error", + "use-isnan": "error", + "valid-typeof": "error", + "vars-on-top": "error", + yoda: "error", + }, }, { - files: [ - '**/*.spec.ts', - ], + files: ["**/*.spec.ts"], rules: { - '@typescript-eslint/no-confusing-void-expression': 'off', - '@typescript-eslint/no-magic-numbers': 'off', + "@typescript-eslint/no-confusing-void-expression": "off", + "@typescript-eslint/no-magic-numbers": "off", }, }, -) +); diff --git a/src/task/src/metrics/codeMetrics.ts b/src/task/src/metrics/codeMetrics.ts index 03f91cf5..e71e0b7a 100644 --- a/src/task/src/metrics/codeMetrics.ts +++ b/src/task/src/metrics/codeMetrics.ts @@ -392,13 +392,17 @@ export default class CodeMetrics { // Condense file and folder names that were renamed, e.g., "F{a => i}leT{b => e}st.d{c => l}l" or "FaleTbst.dcl => FileTest.dll". const fileName: string = elements[2] - .replace(/\{.*? => (?[^}]+?)\}/gu, '$') - .replace(/.*? => (?[^}]+?)/gu, '$') + .replace(/\{.*? => (?[^}]+?)\}/gu, "$") + .replace(/.*? => (?[^}]+?)/gu, "$"); result.push({ fileName, linesAdded: CodeMetrics.parseChangedLines(elements[0], line, "added"), - linesDeleted: CodeMetrics.parseChangedLines(elements[1], line, "deleted"), + linesDeleted: CodeMetrics.parseChangedLines( + elements[1], + line, + "deleted", + ), }); } @@ -451,16 +455,17 @@ export default class CodeMetrics { const indexXL = 4; const size = 5; - const indicators: FixedLengthArrayInterface<(prefix: string) => string, typeof size> = - [ - (): string => - this._runnerInvoker.loc("metrics.codeMetrics.titleSizeXS"), - (): string => this._runnerInvoker.loc("metrics.codeMetrics.titleSizeS"), - (): string => this._runnerInvoker.loc("metrics.codeMetrics.titleSizeM"), - (): string => this._runnerInvoker.loc("metrics.codeMetrics.titleSizeL"), - (prefix: string): string => - this._runnerInvoker.loc("metrics.codeMetrics.titleSizeXL", prefix), - ]; + const indicators: FixedLengthArrayInterface< + (prefix: string) => string, + typeof size + > = [ + (): string => this._runnerInvoker.loc("metrics.codeMetrics.titleSizeXS"), + (): string => this._runnerInvoker.loc("metrics.codeMetrics.titleSizeS"), + (): string => this._runnerInvoker.loc("metrics.codeMetrics.titleSizeM"), + (): string => this._runnerInvoker.loc("metrics.codeMetrics.titleSizeL"), + (prefix: string): string => + this._runnerInvoker.loc("metrics.codeMetrics.titleSizeXL", prefix), + ]; // Calculate the smaller size. if (this._metrics.productCode < this._inputs.baseSize) { diff --git a/src/task/src/metrics/inputs.ts b/src/task/src/metrics/inputs.ts index b5a2fa0d..71bbac1e 100644 --- a/src/task/src/metrics/inputs.ts +++ b/src/task/src/metrics/inputs.ts @@ -297,7 +297,10 @@ export default class Inputs { ): void { this._logger.logDebug("* Inputs.initializeCodeFileExtensions()"); - if (typeof codeFileExtensions !== "undefined" && codeFileExtensions.trim() !== "") { + if ( + typeof codeFileExtensions !== "undefined" && + codeFileExtensions.trim() !== "" + ) { const wildcardStart = "*."; const periodStart = "."; diff --git a/src/task/src/pullRequests/pullRequest.ts b/src/task/src/pullRequests/pullRequest.ts index 24399f94..e945abc3 100644 --- a/src/task/src/pullRequests/pullRequest.ts +++ b/src/task/src/pullRequests/pullRequest.ts @@ -84,7 +84,10 @@ export default class PullRequest { ): string | null { this._logger.logDebug("* PullRequest.getUpdatedDescription()"); - if (typeof currentDescription !== "undefined" && currentDescription.trim() !== "") { + if ( + typeof currentDescription !== "undefined" && + currentDescription.trim() !== "" + ) { return null; } @@ -129,8 +132,10 @@ export default class PullRequest { const completeRegExp = `^${this._runnerInvoker.loc("pullRequests.pullRequest.titleFormat", sizeIndicatorRegExp, "(?.*)")}$`; const prefixRegExp = new RegExp(completeRegExp, "u"); - const prefixRegExpMatches: RegExpMatchArray | null = currentTitle.match(prefixRegExp); - const originalTitle: string = prefixRegExpMatches?.groups?.originalTitle ?? currentTitle; + const prefixRegExpMatches: RegExpMatchArray | null = + currentTitle.match(prefixRegExp); + const originalTitle: string = + prefixRegExpMatches?.groups?.originalTitle ?? currentTitle; return this._runnerInvoker.loc( "pullRequests.pullRequest.titleFormat", sizeIndicator, diff --git a/src/task/src/repos/gitHubReposInvoker.ts b/src/task/src/repos/gitHubReposInvoker.ts index 4d9fac62..02c72eb5 100644 --- a/src/task/src/repos/gitHubReposInvoker.ts +++ b/src/task/src/repos/gitHubReposInvoker.ts @@ -157,8 +157,8 @@ export default class GitHubReposInvoker extends BaseReposInvoker { } public async createComment( - content: string, - fileName: string | null, + content: string, + fileName: string | null, ): Promise { this._logger.logDebug("* GitHubReposInvoker.createComment()"); @@ -275,14 +275,18 @@ export default class GitHubReposInvoker extends BaseReposInvoker { const options: OctokitOptions = { auth: process.env.PR_METRICS_ACCESS_TOKEN, log: { - debug: (message: string): void => - { this._logger.logDebug(`Octokit – ${message}`); }, - error: (message: string): void => - { this._logger.logError(`Octokit – ${message}`); }, - info: (message: string): void => - { this._logger.logInfo(`Octokit – ${message}`); }, - warn: (message: string): void => - { this._logger.logWarning(`Octokit – ${message}`); }, + debug: (message: string): void => { + this._logger.logDebug(`Octokit – ${message}`); + }, + error: (message: string): void => { + this._logger.logError(`Octokit – ${message}`); + }, + info: (message: string): void => { + this._logger.logInfo(`Octokit – ${message}`); + }, + warn: (message: string): void => { + this._logger.logWarning(`Octokit – ${message}`); + }, }, userAgent: "PRMetrics/v1.6.1", }; @@ -324,7 +328,7 @@ export default class GitHubReposInvoker extends BaseReposInvoker { ); } - [, this._repo] = gitHubRepositoryElements + [, this._repo] = gitHubRepositoryElements; return baseUrl; } @@ -348,15 +352,18 @@ export default class GitHubReposInvoker extends BaseReposInvoker { } // Handle GitHub Enterprise invocations. - let baseUrl: string - [, , baseUrl, this._owner, this._repo] = sourceRepositoryUriElements - if (baseUrl !== 'github.com') { - baseUrl = `https://${baseUrl}/api/v3` + let baseUrl: string; + [, , baseUrl, this._owner, this._repo] = sourceRepositoryUriElements; + if (baseUrl !== "github.com") { + baseUrl = `https://${baseUrl}/api/v3`; } - const gitEnding = '.git' + const gitEnding = ".git"; if (this._repo.endsWith(gitEnding)) { - this._repo = this._repo.substring(0, this._repo.length - gitEnding.length) + this._repo = this._repo.substring( + 0, + this._repo.length - gitEnding.length, + ); } return baseUrl; @@ -413,7 +420,9 @@ export default class GitHubReposInvoker extends BaseReposInvoker { if (typeof result.headers.link !== "undefined") { const commitsLink: string = result.headers.link; const matches: RegExpMatchArray | null = - /<.+>; rel="next", <.+?page=(?\d+)>; rel="last"/u.exec(commitsLink); + /<.+>; rel="next", <.+?page=(?\d+)>; rel="last"/u.exec( + commitsLink, + ); if (typeof matches?.groups?.pageNumber === "undefined") { throw new Error( `The regular expression did not match '${commitsLink}'.`, diff --git a/src/task/src/utilities/logger.ts b/src/task/src/utilities/logger.ts index 9ad709bc..bd60772a 100644 --- a/src/task/src/utilities/logger.ts +++ b/src/task/src/utilities/logger.ts @@ -84,7 +84,7 @@ export default class Logger { * @param error The error object to log. */ public logErrorObject(error: Error): void { - const {name} = error; + const { name } = error; const properties: string[] = Object.getOwnPropertyNames(error); const errorRecord: Record = error as unknown as Record< string, diff --git a/src/task/src/utilities/validator.ts b/src/task/src/utilities/validator.ts index f2ddffbc..abe6fbed 100644 --- a/src/task/src/utilities/validator.ts +++ b/src/task/src/utilities/validator.ts @@ -52,7 +52,12 @@ export const validateNumber = ( valueName: string, methodName: string, ): number => { - if (value === null || typeof value === "undefined" || value === 0 || isNaN(value)) { + if ( + value === null || + typeof value === "undefined" || + value === 0 || + isNaN(value) + ) { throw new TypeError( `'${valueName}', accessed within '${methodName}', is invalid, null, or undefined '${Converter.toString(value)}'.`, ); diff --git a/src/task/tests/metrics/codeMetricsCalculator.spec.ts b/src/task/tests/metrics/codeMetricsCalculator.spec.ts index e54c0d20..11451e39 100644 --- a/src/task/tests/metrics/codeMetricsCalculator.spec.ts +++ b/src/task/tests/metrics/codeMetricsCalculator.spec.ts @@ -519,7 +519,11 @@ describe("codeMetricsCalculator.ts", (): void => { logger.logDebug("* CodeMetricsCalculator.updateMetricsComment()"), ).once(); verify( - reposInvoker.createComment("Description", null, CommentThreadStatus.Active), + reposInvoker.createComment( + "Description", + null, + CommentThreadStatus.Active, + ), ).once(); }); diff --git a/src/task/tests/metrics/codeMetricsData.spec.ts b/src/task/tests/metrics/codeMetricsData.spec.ts index 826bf723..e900a6b6 100644 --- a/src/task/tests/metrics/codeMetricsData.spec.ts +++ b/src/task/tests/metrics/codeMetricsData.spec.ts @@ -39,7 +39,8 @@ describe("codeMetricsData.ts", (): void => { const codeMetricsData: CodeMetricsData = new CodeMetricsData(1, 2, 4); // Act - const { productCode, testCode, subtotal, ignoredCode, total } = codeMetricsData; + const { productCode, testCode, subtotal, ignoredCode, total } = + codeMetricsData; // Assert assert.equal(productCode, 1); diff --git a/src/task/tests/repos/azureReposInvoker.spec.ts b/src/task/tests/repos/azureReposInvoker.spec.ts index 443aa613..c3ae4e29 100644 --- a/src/task/tests/repos/azureReposInvoker.spec.ts +++ b/src/task/tests/repos/azureReposInvoker.spec.ts @@ -6,7 +6,12 @@ import "reflect-metadata"; import * as AssertExtensions from "../testUtilities/assertExtensions"; import * as Converter from "../../src/utilities/converter"; -import { type Comment, CommentThreadStatus, type GitPullRequest, type GitPullRequestCommentThread } from 'azure-devops-node-api/interfaces/GitInterfaces' +import { + type Comment, + CommentThreadStatus, + type GitPullRequest, + type GitPullRequestCommentThread, +} from "azure-devops-node-api/interfaces/GitInterfaces"; import { any, anyNumber } from "../testUtilities/mockito"; import { deepEqual, instance, mock, verify, when } from "ts-mockito"; import AzureDevOpsApiWrapper from "../../src/wrappers/azureDevOpsApiWrapper"; diff --git a/src/task/tests/repos/gitHubReposInvoker.spec.ts b/src/task/tests/repos/gitHubReposInvoker.spec.ts index e5ade2dc..dcc66676 100644 --- a/src/task/tests/repos/gitHubReposInvoker.spec.ts +++ b/src/task/tests/repos/gitHubReposInvoker.spec.ts @@ -1246,10 +1246,7 @@ describe("gitHubReposInvoker.ts", (): void => { ); // Act - await gitHubReposInvoker.createComment( - "Content", - "file.ts", - ); + await gitHubReposInvoker.createComment("Content", "file.ts"); // Assert verify(octokitWrapper.initialize(any())).once(); @@ -1310,10 +1307,7 @@ describe("gitHubReposInvoker.ts", (): void => { // Act const func: () => Promise = async () => - gitHubReposInvoker.createComment( - "Content", - "file.ts", - ); + gitHubReposInvoker.createComment("Content", "file.ts"); // Assert await AssertExtensions.toThrowAsync( @@ -1366,10 +1360,7 @@ describe("gitHubReposInvoker.ts", (): void => { ); // Act - await gitHubReposInvoker.createComment( - "Content", - "file.ts", - ); + await gitHubReposInvoker.createComment("Content", "file.ts"); // Assert verify(octokitWrapper.initialize(any())).once(); @@ -1427,10 +1418,7 @@ describe("gitHubReposInvoker.ts", (): void => { // Act const func: () => Promise = async () => - gitHubReposInvoker.createComment( - "Content", - "file.ts", - ); + gitHubReposInvoker.createComment("Content", "file.ts"); // Assert await AssertExtensions.toThrowAsync( @@ -1470,14 +1458,8 @@ describe("gitHubReposInvoker.ts", (): void => { ); // Act - await gitHubReposInvoker.createComment( - "Content", - "file.ts", - ); - await gitHubReposInvoker.createComment( - "Content", - "file.ts", - ); + await gitHubReposInvoker.createComment("Content", "file.ts"); + await gitHubReposInvoker.createComment("Content", "file.ts"); // Assert verify(octokitWrapper.initialize(any())).once(); @@ -1534,10 +1516,7 @@ describe("gitHubReposInvoker.ts", (): void => { ); // Act - await gitHubReposInvoker.createComment( - "Content", - "file.ts", - ); + await gitHubReposInvoker.createComment("Content", "file.ts"); // Assert verify(octokitWrapper.initialize(any())).once(); @@ -1600,10 +1579,7 @@ describe("gitHubReposInvoker.ts", (): void => { ); // Act - await gitHubReposInvoker.createComment( - "Content", - "file.ts", - ); + await gitHubReposInvoker.createComment("Content", "file.ts"); // Assert verify(octokitWrapper.initialize(any())).once(); @@ -1678,10 +1654,7 @@ describe("gitHubReposInvoker.ts", (): void => { // Act const func: () => Promise = async () => - gitHubReposInvoker.createComment( - "Content", - "file.ts", - ); + gitHubReposInvoker.createComment("Content", "file.ts"); // Assert await AssertExtensions.toThrowAsync(func, error.message); @@ -1732,10 +1705,7 @@ describe("gitHubReposInvoker.ts", (): void => { ); // Act - await gitHubReposInvoker.createComment( - "Content", - null, - ); + await gitHubReposInvoker.createComment("Content", null); // Assert verify(octokitWrapper.initialize(any())).once(); diff --git a/src/task/tests/repos/gitHubReposInvokerConstants.ts b/src/task/tests/repos/gitHubReposInvokerConstants.ts index c773d832..027e4a8c 100644 --- a/src/task/tests/repos/gitHubReposInvokerConstants.ts +++ b/src/task/tests/repos/gitHubReposInvokerConstants.ts @@ -18,370 +18,370 @@ export const getPullResponse: GetPullResponse = { data: { _links: { comments: { - href: '', + href: "", }, commits: { - href: '', + href: "", }, html: { - href: '', + href: "", }, issue: { - href: '', + href: "", }, review_comment: { - href: '', + href: "", }, review_comments: { - href: '', + href: "", }, self: { - href: '', + href: "", }, statuses: { - href: '', + href: "", }, }, active_lock_reason: null, additions: 0, assignee: { - avatar_url: '', - events_url: '', - followers_url: '', - following_url: '', - gists_url: '', - gravatar_id: '', - html_url: '', + avatar_url: "", + events_url: "", + followers_url: "", + following_url: "", + gists_url: "", + gravatar_id: "", + html_url: "", id: 0, - login: '', - node_id: '', - organizations_url: '', - received_events_url: '', - repos_url: '', + login: "", + node_id: "", + organizations_url: "", + received_events_url: "", + repos_url: "", site_admin: false, - starred_url: '', - subscriptions_url: '', - type: '', - url: '', + starred_url: "", + subscriptions_url: "", + type: "", + url: "", }, assignees: [], - author_association: 'MEMBER', + author_association: "MEMBER", auto_merge: null, base: { - label: '', - ref: '', + label: "", + ref: "", repo: { - archive_url: '', + archive_url: "", archived: false, - assignees_url: '', - blobs_url: '', - branches_url: '', - clone_url: '', - collaborators_url: '', - comments_url: '', - commits_url: '', - compare_url: '', - contents_url: '', - contributors_url: '', - created_at: '', - default_branch: '', - deployments_url: '', - description: '', + assignees_url: "", + blobs_url: "", + branches_url: "", + clone_url: "", + collaborators_url: "", + comments_url: "", + commits_url: "", + compare_url: "", + contents_url: "", + contributors_url: "", + created_at: "", + default_branch: "", + deployments_url: "", + description: "", disabled: false, - downloads_url: '', - events_url: '', + downloads_url: "", + events_url: "", fork: false, forks: 0, forks_count: 0, - forks_url: '', - full_name: '', - git_commits_url: '', - git_refs_url: '', - git_tags_url: '', - git_url: '', + forks_url: "", + full_name: "", + git_commits_url: "", + git_refs_url: "", + git_tags_url: "", + git_url: "", has_discussions: true, has_downloads: true, has_issues: true, has_pages: false, has_projects: false, has_wiki: false, - homepage: '', - hooks_url: '', - html_url: '', + homepage: "", + hooks_url: "", + html_url: "", id: 0, - issue_comment_url: '', - issue_events_url: '', - issues_url: '', - keys_url: '', - labels_url: '', - language: '', - languages_url: '', + issue_comment_url: "", + issue_events_url: "", + issues_url: "", + keys_url: "", + labels_url: "", + language: "", + languages_url: "", license: { - key: '', - name: '', - node_id: '', - spdx_id: '', + key: "", + name: "", + node_id: "", + spdx_id: "", url: null, }, - merges_url: '', - milestones_url: '', + merges_url: "", + milestones_url: "", mirror_url: null, - name: '', - node_id: '', - notifications_url: '', + name: "", + node_id: "", + notifications_url: "", open_issues: 0, open_issues_count: 0, owner: { - avatar_url: '', - events_url: '', - followers_url: '', - following_url: '', - gists_url: '', - gravatar_id: '', - html_url: '', + avatar_url: "", + events_url: "", + followers_url: "", + following_url: "", + gists_url: "", + gravatar_id: "", + html_url: "", id: 0, - login: '', - node_id: '', - organizations_url: '', - received_events_url: '', - repos_url: '', + login: "", + node_id: "", + organizations_url: "", + received_events_url: "", + repos_url: "", site_admin: false, - starred_url: '', - subscriptions_url: '', - type: '', - url: '', + starred_url: "", + subscriptions_url: "", + type: "", + url: "", }, private: false, - pulls_url: '', - pushed_at: '', - releases_url: '', + pulls_url: "", + pushed_at: "", + releases_url: "", size: 0, - ssh_url: '', + ssh_url: "", stargazers_count: 0, - stargazers_url: '', - statuses_url: '', - subscribers_url: '', - subscription_url: '', - svn_url: '', - tags_url: '', - teams_url: '', - trees_url: '', - updated_at: '', - url: '', + stargazers_url: "", + statuses_url: "", + subscribers_url: "", + subscription_url: "", + svn_url: "", + tags_url: "", + teams_url: "", + trees_url: "", + updated_at: "", + url: "", watchers: 0, watchers_count: 0, }, - sha: '', + sha: "", user: { - avatar_url: '', - events_url: '', - followers_url: '', - following_url: '', - gists_url: '', - gravatar_id: '', - html_url: '', + avatar_url: "", + events_url: "", + followers_url: "", + following_url: "", + gists_url: "", + gravatar_id: "", + html_url: "", id: 0, - login: '', - node_id: '', - organizations_url: '', - received_events_url: '', - repos_url: '', + login: "", + node_id: "", + organizations_url: "", + received_events_url: "", + repos_url: "", site_admin: false, - starred_url: '', - subscriptions_url: '', - type: '', - url: '', + starred_url: "", + subscriptions_url: "", + type: "", + url: "", }, }, - body: 'Description', + body: "Description", changed_files: 0, closed_at: null, comments: 0, - comments_url: '', + comments_url: "", commits: 0, - commits_url: '', - created_at: '', + commits_url: "", + created_at: "", deletions: 0, - diff_url: '', + diff_url: "", draft: false, head: { - label: '', - ref: '', + label: "", + ref: "", repo: { - archive_url: '', + archive_url: "", archived: false, - assignees_url: '', - blobs_url: '', - branches_url: '', - clone_url: '', - collaborators_url: '', - comments_url: '', - commits_url: '', - compare_url: '', - contents_url: '', - contributors_url: '', - created_at: '', - default_branch: '', - deployments_url: '', - description: '', + assignees_url: "", + blobs_url: "", + branches_url: "", + clone_url: "", + collaborators_url: "", + comments_url: "", + commits_url: "", + compare_url: "", + contents_url: "", + contributors_url: "", + created_at: "", + default_branch: "", + deployments_url: "", + description: "", disabled: false, - downloads_url: '', - events_url: '', + downloads_url: "", + events_url: "", fork: false, forks: 0, forks_count: 0, - forks_url: '', - full_name: '', - git_commits_url: '', - git_refs_url: '', - git_tags_url: '', - git_url: '', + forks_url: "", + full_name: "", + git_commits_url: "", + git_refs_url: "", + git_tags_url: "", + git_url: "", has_discussions: true, has_downloads: true, has_issues: true, has_pages: false, has_projects: false, has_wiki: false, - homepage: '', - hooks_url: '', - html_url: '', + homepage: "", + hooks_url: "", + html_url: "", id: 0, - issue_comment_url: '', - issue_events_url: '', - issues_url: '', - keys_url: '', - labels_url: '', - language: '', - languages_url: '', + issue_comment_url: "", + issue_events_url: "", + issues_url: "", + keys_url: "", + labels_url: "", + language: "", + languages_url: "", license: { - key: '', - name: '', - node_id: '', - spdx_id: '', + key: "", + name: "", + node_id: "", + spdx_id: "", url: null, }, - merges_url: '', - milestones_url: '', + merges_url: "", + milestones_url: "", mirror_url: null, - name: '', - node_id: '', - notifications_url: '', + name: "", + node_id: "", + notifications_url: "", open_issues: 0, open_issues_count: 0, owner: { - avatar_url: '', - events_url: '', - followers_url: '', - following_url: '', - gists_url: '', - gravatar_id: '', - html_url: '', + avatar_url: "", + events_url: "", + followers_url: "", + following_url: "", + gists_url: "", + gravatar_id: "", + html_url: "", id: 0, - login: '', - node_id: '', - organizations_url: '', - received_events_url: '', - repos_url: '', + login: "", + node_id: "", + organizations_url: "", + received_events_url: "", + repos_url: "", site_admin: false, - starred_url: '', - subscriptions_url: '', - type: '', - url: '', + starred_url: "", + subscriptions_url: "", + type: "", + url: "", }, private: false, - pulls_url: '', - pushed_at: '', - releases_url: '', + pulls_url: "", + pushed_at: "", + releases_url: "", size: 0, - ssh_url: '', + ssh_url: "", stargazers_count: 0, - stargazers_url: '', - statuses_url: '', - subscribers_url: '', - subscription_url: '', - svn_url: '', - tags_url: '', - teams_url: '', - trees_url: '', - updated_at: '', - url: '', + stargazers_url: "", + statuses_url: "", + subscribers_url: "", + subscription_url: "", + svn_url: "", + tags_url: "", + teams_url: "", + trees_url: "", + updated_at: "", + url: "", watchers: 0, watchers_count: 0, }, - sha: '', + sha: "", user: { - avatar_url: '', - events_url: '', - followers_url: '', - following_url: '', - gists_url: '', - gravatar_id: '', - html_url: '', + avatar_url: "", + events_url: "", + followers_url: "", + following_url: "", + gists_url: "", + gravatar_id: "", + html_url: "", id: 0, - login: '', - node_id: '', - organizations_url: '', - received_events_url: '', - repos_url: '', + login: "", + node_id: "", + organizations_url: "", + received_events_url: "", + repos_url: "", site_admin: false, - starred_url: '', - subscriptions_url: '', - type: '', - url: '', + starred_url: "", + subscriptions_url: "", + type: "", + url: "", }, }, - html_url: '', + html_url: "", id: 0, - issue_url: '', + issue_url: "", labels: [], locked: false, maintainer_can_modify: false, - merge_commit_sha: '', + merge_commit_sha: "", mergeable: true, - mergeable_state: '', + mergeable_state: "", merged: false, merged_at: null, merged_by: null, milestone: null, - node_id: '', + node_id: "", number: 0, - patch_url: '', + patch_url: "", rebaseable: true, requested_reviewers: [], requested_teams: [], - review_comment_url: '', + review_comment_url: "", review_comments: 0, - review_comments_url: '', - state: 'open', - statuses_url: '', - title: 'Title', - updated_at: '', - url: '', + review_comments_url: "", + state: "open", + statuses_url: "", + title: "Title", + updated_at: "", + url: "", user: { - avatar_url: '', - events_url: '', - followers_url: '', - following_url: '', - gists_url: '', - gravatar_id: '', - html_url: '', + avatar_url: "", + events_url: "", + followers_url: "", + following_url: "", + gists_url: "", + gravatar_id: "", + html_url: "", id: 0, - login: '', - node_id: '', - organizations_url: '', - received_events_url: '', - repos_url: '', + login: "", + node_id: "", + organizations_url: "", + received_events_url: "", + repos_url: "", site_admin: false, - starred_url: '', - subscriptions_url: '', - type: '', - url: '', + starred_url: "", + subscriptions_url: "", + type: "", + url: "", }, }, headers: {}, status: StatusCodes.OK, - url: '', -} + url: "", +}; /** * A mock response for the Octokit API call to get the list of commits. @@ -390,88 +390,88 @@ export const listCommitsResponse: ListCommitsResponse = { data: [ { author: { - avatar_url: '', - events_url: '', - followers_url: '', - following_url: '', - gists_url: '', - gravatar_id: '', - html_url: '', + avatar_url: "", + events_url: "", + followers_url: "", + following_url: "", + gists_url: "", + gravatar_id: "", + html_url: "", id: 0, - login: '', - node_id: '', - organizations_url: '', - received_events_url: '', - repos_url: '', + login: "", + node_id: "", + organizations_url: "", + received_events_url: "", + repos_url: "", site_admin: false, - starred_url: '', - subscriptions_url: '', - type: '', - url: '', + starred_url: "", + subscriptions_url: "", + type: "", + url: "", }, - comments_url: '', + comments_url: "", commit: { author: { - date: '', - email: '', - name: '', + date: "", + email: "", + name: "", }, comment_count: 0, committer: { - date: '', - email: '', - name: '', + date: "", + email: "", + name: "", }, - message: '', + message: "", tree: { - sha: '', - url: '', + sha: "", + url: "", }, - url: '', + url: "", verification: { payload: null, - reason: '', + reason: "", signature: null, verified: false, }, }, committer: { - avatar_url: '', - events_url: '', - followers_url: '', - following_url: '', - gists_url: '', - gravatar_id: '', - html_url: '', + avatar_url: "", + events_url: "", + followers_url: "", + following_url: "", + gists_url: "", + gravatar_id: "", + html_url: "", id: 0, - login: '', - node_id: '', - organizations_url: '', - received_events_url: '', - repos_url: '', + login: "", + node_id: "", + organizations_url: "", + received_events_url: "", + repos_url: "", site_admin: false, - starred_url: '', - subscriptions_url: '', - type: '', - url: '', + starred_url: "", + subscriptions_url: "", + type: "", + url: "", }, - html_url: '', - node_id: '', + html_url: "", + node_id: "", parents: [ { - html_url: '', - sha: '', - url: '', + html_url: "", + sha: "", + url: "", }, ], - sha: 'sha54321', - url: '', + sha: "sha54321", + url: "", }, ], headers: {}, status: StatusCodes.OK, - url: '', -} + url: "", +}; /** * A mock response for the Octokit API call to get the issue comments. @@ -479,16 +479,16 @@ export const listCommitsResponse: ListCommitsResponse = { export const getIssueCommentsResponse: GetIssueCommentsResponse = { data: [ { - author_association: 'MEMBER', - created_at: '', - html_url: '', + author_association: "MEMBER", + created_at: "", + html_url: "", id: 1, - issue_url: '', - node_id: '', + issue_url: "", + node_id: "", performed_via_github_app: null, reactions: { - '+1': 0, - '-1': 0, + "+1": 0, + "-1": 0, confused: 0, eyes: 0, heart: 0, @@ -496,36 +496,36 @@ export const getIssueCommentsResponse: GetIssueCommentsResponse = { laugh: 0, rocket: 0, total_count: 0, - url: '', + url: "", }, - updated_at: '', - url: '', + updated_at: "", + url: "", user: { - avatar_url: '', - events_url: '', - followers_url: '', - following_url: '', - gists_url: '', - gravatar_id: '', - html_url: '', + avatar_url: "", + events_url: "", + followers_url: "", + following_url: "", + gists_url: "", + gravatar_id: "", + html_url: "", id: 0, - login: '', - node_id: '', - organizations_url: '', - received_events_url: '', - repos_url: '', + login: "", + node_id: "", + organizations_url: "", + received_events_url: "", + repos_url: "", site_admin: false, - starred_url: '', - subscriptions_url: '', - type: 'User', - url: '', + starred_url: "", + subscriptions_url: "", + type: "User", + url: "", }, }, ], headers: {}, status: StatusCodes.OK, - url: '', -} + url: "", +}; /** * A mock response for the Octokit API call to get the review comments. @@ -535,35 +535,35 @@ export const getReviewCommentsResponse: GetReviewCommentsResponse = { { _links: { html: { - href: '', + href: "", }, pull_request: { - href: '', + href: "", }, self: { - href: '', + href: "", }, }, - author_association: 'MEMBER', - body: 'File Content', - commit_id: '', - created_at: '', - diff_hunk: '', - html_url: '', + author_association: "MEMBER", + body: "File Content", + commit_id: "", + created_at: "", + diff_hunk: "", + html_url: "", id: 2, line: 1, - node_id: '', - original_commit_id: '', + node_id: "", + original_commit_id: "", original_line: 1, original_position: 1, original_start_line: null, - path: 'file.ts', + path: "file.ts", position: 1, pull_request_review_id: 0, - pull_request_url: '', + pull_request_url: "", reactions: { - '+1': 0, - '-1': 0, + "+1": 0, + "-1": 0, confused: 0, eyes: 0, heart: 0, @@ -571,38 +571,38 @@ export const getReviewCommentsResponse: GetReviewCommentsResponse = { laugh: 0, rocket: 0, total_count: 0, - url: '', + url: "", }, - side: 'LEFT', + side: "LEFT", start_line: null, start_side: null, - updated_at: '', - url: '', + updated_at: "", + url: "", user: { - avatar_url: '', - events_url: '', - followers_url: '', - following_url: '', - gists_url: '', - gravatar_id: '', - html_url: '', + avatar_url: "", + events_url: "", + followers_url: "", + following_url: "", + gists_url: "", + gravatar_id: "", + html_url: "", id: 0, - login: '', - node_id: '', - organizations_url: '', - received_events_url: '', - repos_url: '', + login: "", + node_id: "", + organizations_url: "", + received_events_url: "", + repos_url: "", site_admin: false, - starred_url: '', - subscriptions_url: '', - type: '', - url: '', + starred_url: "", + subscriptions_url: "", + type: "", + url: "", }, }, ], headers: {}, status: StatusCodes.OK, - url: '', -} + url: "", +}; /* eslint-enable @typescript-eslint/naming-convention */ diff --git a/src/task/tests/runners/gitHubRunnerInvoker.spec.ts b/src/task/tests/runners/gitHubRunnerInvoker.spec.ts index 02158647..3ded4816 100644 --- a/src/task/tests/runners/gitHubRunnerInvoker.spec.ts +++ b/src/task/tests/runners/gitHubRunnerInvoker.spec.ts @@ -170,8 +170,9 @@ describe("gitHubRunnerInvoker.ts", (): void => { ); // Act - const func: () => void = () => - { gitHubRunnerInvoker.locInitialize(resourcePath); }; + const func: () => void = () => { + gitHubRunnerInvoker.locInitialize(resourcePath); + }; // Assert try { diff --git a/src/task/tests/runners/runnerInvoker.spec.ts b/src/task/tests/runners/runnerInvoker.spec.ts index 43f522c2..8fe0d89d 100644 --- a/src/task/tests/runners/runnerInvoker.spec.ts +++ b/src/task/tests/runners/runnerInvoker.spec.ts @@ -439,7 +439,9 @@ describe("runnerInvoker.ts", (): void => { // Act runnerInvoker.locInitialize("TEST"); - const func: () => void = () => { runnerInvoker.locInitialize("TEST"); }; + const func: () => void = () => { + runnerInvoker.locInitialize("TEST"); + }; // Assert assert.throws(