Showing 8 of 16 total issues
Function main
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function main (): Promise<number> {
const [[regA, metaA, verA], [regB, metaB, verB]] = await Promise.all([getMetadata(ws1), getMetadata(ws2)]);
const a = metaA.asLatest;
const b = metaB.asLatest;
Function logArray
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function logArray (pad: number, title: string, pre: string, arr: string[], chunkSize: number) {
Function log
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function log (pad: number, title: string, pre: string, text: string, post?: string) {
Function cmdSubmit
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
export default async function cmdSubmit (account: string, blocks: number | undefined, endpoint = '', tx: string | undefined, [txName, ...params]: string[]): Promise<void> {
Function createLog
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function createLog (pad: number, title: string, pre: string, text: string, post?: string): string {
Function cmdSendOffline
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
export default async function cmdSendOffline (account: string, blocks: number | undefined, endpoint = '', nonce: number | undefined | Index, [tx, ...params]: string[]): Promise<void> {
Function cmdSendOffline
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
export default async function cmdSendOffline (account: string, blocks: number | undefined, endpoint = '', nonce: number | undefined | Index, [tx, ...params]: string[]): Promise<void> {
const provider = new WsProvider(endpoint);
const api = await ApiPromise.create({ provider });
const options: Partial<SignerOptions> = { signer: new RawSigner() };
- 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 calculateAtOne
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
function calculateAtOne (atOffset: number, test: string[], address: string): GeneratorCalculation {
return {
count: test.reduce((count, c, index): number => {
if (index === count) {
count += (c === '?' || c === address.charAt(index + atOffset)) ? 1 : 0;
- 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"