grigori-gru/matrix-cli

View on GitHub

Showing 24 of 43 total issues

Function setPower has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    async setPower() {
        const userId = await this._selectUser();

        if (!userId) {
            this.logger.log(chalk.yellow('\nNo user is selected\n'));
Severity: Minor
Found in src/lib/actions.js - About 45 mins to fix

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 inviteUserToRooms has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    async inviteUserToRooms(allRooms, userId) {
        const client = this.client || (await this.getClient());
        const invitedRooms = [];
        const errInvitedRooms = [];

Severity: Minor
Found in src/lib/matrix-service.js - About 45 mins to fix

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 join has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    async join(allRooms) {
        const client = this.client || (await this.getClient());
        const joinedRooms = [];
        const errJoinedRooms = [];

Severity: Minor
Found in src/lib/matrix-service.js - About 45 mins to fix

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 join has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    async join() {
        const { allRooms } = await this.matrixService.getAllRoomsInfo();
        const notJoinedRooms = allRooms.filter(room => !room.members.includes(this.matrixService.userName));
        if (notJoinedRooms.length === 0) {
            this.logger.log(chalk.yellow(`\nAll rooms, where you are invited, you have alredy joned!\n`));
Severity: Minor
Found in src/lib/actions.js - About 25 mins to fix

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

Severity
Category
Status
Source
Language