scripts/generate-matchers/index.ts
Function getMetadata
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const getMetadata = (filePath): FileMeta => {
const sourceFile = program.getSourceFile(filePath);
const result: FileMeta = {
filePath,
inputs: [],
Function getMetadata
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
const getMetadata = (filePath): FileMeta => {
const sourceFile = program.getSourceFile(filePath);
const result: FileMeta = {
filePath,
inputs: [],
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function visitNode
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const visitNode = (node) => {
if (node.jsDoc) {
const [jsDocComment] = node.jsDoc;
result.jsDoc.description = unwrap(jsDocComment.comment);
jsDocComment.tags.forEach(({ comment, name, tagName }) => {
Array type using 'Array<t>' is forbidden. Use 'T[]' instead.</t> Open
Open
params: Array<{
name: string;
exampleValue: string;
}>;
- Read upRead up
- Exclude checks
Rule: array-type
Requires using either 'T[]' or 'Array<t>' for arrays.</t>
Notes
- TypeScript Only
- Has Fix
Config
One of the following arguments must be provided:
-
"array"
enforces use ofT[]
for all types T. -
"generic"
enforces use ofArray<T>
for all types T. -
"array-simple"
enforces use ofT[]
ifT
is a simple type (primitive or type reference).
Examples
"array-type": true,array
"array-type": true,generic
"array-type": true,array-simple
Schema
{
"type": "string",
"enum": [
"array",
"generic",
"array-simple"
]
}
For more information see this page.