File crypto_explore_certificate.ts
has 457 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* @module node_opcua_crypto
*/
// ---------------------------------------------------------------------------------------------------------------------
// node-opcua-crypto
Function readTbsCertificate
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function readTbsCertificate(buffer: Buffer, block: BlockInfo): TbsCertificate {
const blocks = _readStruct(buffer, block);
let version, serialNumber, signature, issuer, validity, subject, subjectFingerPrint, extensions;
let subjectPublicKeyInfo: SubjectPublicKeyInfo;
Function _readAuthorityKeyIdentifier
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function _readAuthorityKeyIdentifier(buffer: Buffer): AuthorityKeyIdentifier {
/**
* where a CA distributes its public key in the form of a "self-signed"
* certificate, the authority key identifier MAY be omitted. Th
* signature on a self-signed certificate is generated with the private
- 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 _readAuthorityKeyIdentifier
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _readAuthorityKeyIdentifier(buffer: Buffer): AuthorityKeyIdentifier {
/**
* where a CA distributes its public key in the form of a "self-signed"
* certificate, the authority key identifier MAY be omitted. Th
* signature on a self-signed certificate is generated with the private
Function _readExtension
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function _readExtension(buffer: Buffer, block: BlockInfo): { identifier: { oid: string; name: string }; value: any } {
const inner_blocks = _readStruct(buffer, block);
if (inner_blocks.length === 3) {
assert(inner_blocks[1].tag === TagType.BOOLEAN);
Function _readGeneralNames
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _readGeneralNames(buffer: Buffer, block: BlockInfo) {
const _data: { [key: number]: { name: string; type: string } } = {
1: { name: "rfc822Name", type: "IA5String" },
2: { name: "dNSName", type: "IA5String" },
3: { name: "x400Address", type: "ORAddress" },
Function readTbsCertificate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function readTbsCertificate(buffer: Buffer, block: BlockInfo): TbsCertificate {
const blocks = _readStruct(buffer, block);
let version, serialNumber, signature, issuer, validity, subject, subjectFingerPrint, extensions;
let subjectPublicKeyInfo: SubjectPublicKeyInfo;
- 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 _readGeneralNames
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function _readGeneralNames(buffer: Buffer, block: BlockInfo) {
const _data: { [key: number]: { name: string; type: string } } = {
1: { name: "rfc822Name", type: "IA5String" },
2: { name: "dNSName", type: "IA5String" },
3: { name: "x400Address", type: "ORAddress" },
- 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"