Showing 110 of 172 total issues
Function run
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async run({ bodyText = '', roomName }: CommandOptions) {
if (!roomName) {
throw new Error('Not issue room');
}
- 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 kick
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const kick = async (chatApi: MessengerApi, { id, members }, userToKick?: string) => {
if (!hasPowerToKick(chatApi.getMyId(), members, EXPECTED_POWER)) {
logger.debug(`No power for kick in room with id ${id}`);
return NO_POWER;
- 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 run
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async run({ bodyText, roomName, sender }: CommandOptions) {
const jiraBotUser = this.config.taskTracker.user;
const projectKey = utils.getProjectKeyFromIssueKey(roomName);
const { lead, issueTypes, admins } = await this.taskTracker.getProjectWithAdmins(projectKey);
- 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 composeConfig
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const composeConfig = (baseConfig: any): Config => {
if (!validate(baseConfig)) {
process.exit(1);
}
Function run
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
async run({ key, typeName, projectKey }: InviteNewMembersData): Promise<string[] | false> {
const {
messenger: { bots },
} = this.config;
try {
Function getIssueChanges
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
getIssueChanges: (body): any[] => {
if (isCorrectWebhook(body, 'close')) {
return [{ field: 'status', newValue: RoomViewStateEnum.close }];
}
if (isCorrectWebhook(body, 'reopen')) {
Function run
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async run({ bodyText, roomData }: CommandOptions) {
if (this.chatApi.getCommandRoomName() === roomData.alias) {
if (!this.chatApi.isMaster()) {
logger.warn('Skip operation for not master bot');
Function handleKnownRoom
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async handleKnownRoom({ keepTimestamp, roomId, alias, status }) {
const data = await this.chatApi.getRoomAndClient(roomId);
if (!data) {
logger.debug(`No bot can get room meta by alias ${alias} they are not joined. Try remove it.`);
Function run
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async run({ projectKey, keepTimestamp, status }: ArchiveProjectData): Promise<any> {
try {
logger.info('Start archiving project');
const lastIssueKey = await this.taskTracker.getLastIssueKey(projectKey);
Function saveIncoming
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async saveIncoming({ redisKey, ...restData }) {
try {
let redisValue = restData;
if (redisKey === REDIS_ROOM_KEY) {
const { createRoomData } = restData;
Function run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async run({ bodyText, sender, roomData }: CommandOptions) {
if (!roomData.alias) {
throw new Error('Not issue room');
}
- 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 run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async run({ bodyText, roomData }: CommandOptions) {
if (!this.chatApi.isMaster()) {
logger.warn('Skip operation for not master bot');
return;
- 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 upload
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
async upload(roomId: string, url: string): Promise<string | undefined> {
try {
const mimeTypes = [
'image/apng',
'image/bmp',
Function handleRedisRooms
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async handleRedisRooms(roomsData) {
const roomHandle = async (data: CreateRoomData) => {
try {
await this.actions.run(ActionNames.CreateRoom, data);
Function getHookHandler
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
getHookHandler(type: IssueType) {
const handlers = {
issue: async body => {
const key = this.selectors.getIssueKey(body)!;
const status = await this.getIssueSafety(key);
Function timelineHandler
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async timelineHandler(event: any, room: any, toStartOfTimeline: boolean) {
try {
if (event.getType() !== 'm.room.message' || toStartOfTimeline) {
return;
}
- 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 run
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async run({ bodyText = '', sender, roomData }: CommandOptions) {
const { alias, id } = roomData;
if (!alias) {
return translate('noAlias');
}
- 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 run
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async run({ projectKey, keepTimestamp, status }: ArchiveProjectData): Promise<any> {
try {
logger.info('Start archiving project');
const lastIssueKey = await this.taskTracker.getLastIssueKey(projectKey);
- 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 saveIncoming
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async saveIncoming({ redisKey, ...restData }) {
try {
let redisValue = restData;
if (redisKey === REDIS_ROOM_KEY) {
const { createRoomData } = restData;
- 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 run
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async run({ issueKey, milestoneId, status, user, summary }: PostMilestoneUpdatesData): Promise<string | undefined> {
try {
const issue = await this.taskTracker.getIssue(issueKey);
const milestoneKey = this.taskTracker.selectors.getMilestoneKey(issue, milestoneId)!;
const milestoneRoomId = await this.chatApi.getRoomId(milestoneKey);
- 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"