packages/platform-irc/src/index.ts
File index.ts
has 425 lines of code (exceeds 250 allowed). Consider refactoring. Wontfix
Wontfix
/**
* This is a platform for Sockethub implementing IRC functionality.
*
* Developed by Nick Jennings (https://github.com/silverbucket)
*
Function ircConnect
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
Wontfix
private ircConnect(
key: string,
credentials: PlatformIrcCredentialsObject,
cb: GetClientCallback,
) {
Function ircConnect
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Wontfix
Wontfix
private ircConnect(
key: string,
credentials: PlatformIrcCredentialsObject,
cb: GetClientCallback,
) {
- 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 send
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
Wontfix
send(job: ActivityStream, done: PlatformCallback) {
this.debug(
"send() called for " + job.actor.id + " target: " + job.target.id,
);
this.getClient(job.actor.id, false, (err, client) => {
Function getClient
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
Wontfix
private getClient(
key: string,
credentials: PlatformIrcCredentialsObject | false,
cb: GetClientCallback,
) {
Function update
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
Wontfix
update(
job: ActivityStream,
credentials: PlatformIrcCredentialsObject,
done: PlatformCallback,
) {
Function registerListeners
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
Wontfix
private registerListeners(server: string) {
this.irc2as = new IRC2AS({ server: server });
this.client.on("data", (data: never) => {
this.irc2as.input(data);
});