Showing 15 of 71 total issues
PnutRepositoryImpl
has 55 functions (exceeds 20 allowed). Consider refactoring. Open
export class PnutRepositoryImpl implements PnutRepository {
constructor(private readonly axios: NuxtAxiosInstance) {}
updateAvatar(file: File): Promise<PnutResponse<User>> {
const fd = new FormData()
fd.append('avatar', file)
- Create a ticketCreate a ticket
Function createCompose
has 138 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createCompose(composeOptions: ComposeOptions) {
@Component
class ComposeAbstract extends Mixins(textCount) {
@Prop({
type: String,
- Create a ticketCreate a ticket
File pnutRepositoryImpl.ts
has 326 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { NuxtAxiosInstance } from '@nuxtjs/axios'
import { PnutRepository } from '~/plugins/domain/repository/pnutRepository'
import { PnutResponse } from '~/entity/pnut-response'
import { Post } from '~/entity/post'
import {
- Create a ticketCreate a ticket
Function createCompose
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
export function createCompose(composeOptions: ComposeOptions) {
@Component
class ComposeAbstract extends Mixins(textCount) {
@Prop({
type: String,
- Read upRead up
- Create a ticketCreate a ticket
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 getHtmlMeta
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getHtmlMeta(post?: Post) {
if (!post || !post.user || !post.content) return
const name = post.user.name
? `${post.user.name}(@${post.user.username})`
: `@${post.user?.username}`
- Create a ticketCreate a ticket
Function getDefaultSubscriptionIds
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getDefaultSubscriptionIds(connection_id: string) {
const subscribedChannelPromise = this.pnutRepository.getSubscribedChannels({
connection_id,
include_read: false,
})
- Create a ticketCreate a ticket
Function bind
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function bind(context: Context) {
container
.register(PnutRepository.token, {
useValue: new PnutRepositoryImpl(context.$axios),
})
- Create a ticketCreate a ticket
Function createSettingsMenu
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createSettingsMenu(): MenuItem[] {
return [
{ type: 'heading', label: 'User' },
{
label: 'Profile',
- Create a ticketCreate a ticket
Function createListInfo
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function createListInfo<T>(
getPnutResponse: GetPnutResponse<T>
): Promise<ListInfo<T>> {
const { meta: initialMeta, data: initialData } = await getPnutResponse()
const olderMeta = {
- Create a ticketCreate a ticket
Function run
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
async run(input: Input): Promise<Output> {
const title = getTitle({ q: input.params?.q, type: input.type })
const commonDefaultParams: Input['params'] = {
order: 'id',
}
- Create a ticketCreate a ticket
Function createVideoEmbedRaw
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createVideoEmbedRaw(text: string): OEmbed.Video[] {
return detectGenerators
.reduce<ResObj[]>((rawHtmls, detectGenerator) => {
let matcher
while ((matcher = detectGenerator.regexp.exec(text)) !== null) {
- Create a ticketCreate a ticket
Function insertText
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
insertText(text: string) {
const textarea = this.$refs.textarea
const selection = (document as any).selection
if (selection) {
textarea.focus()
- Create a ticketCreate a ticket
Function messageHandler
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async messageHandler(input: Input, obj: object) {
if (isConnection(obj)) {
const { subscriptionMap, unreads } = await this.getDefaultSubscriptionIds(
obj.meta.connection_id
)
- Read upRead up
- Create a ticketCreate a ticket
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 sendPostNotification
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function sendPostNotification(posts: Post[]) {
const enabled = localStorage.getItem('notification:posts') === 'true'
if (!enabled || !isEnabledNotification()) return
if (posts.length === 1) {
const [post] = posts
- Read upRead up
- Create a ticketCreate a ticket
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 getHtmlMeta
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function getHtmlMeta(post?: Post) {
if (!post || !post.user || !post.content) return
const name = post.user.name
? `${post.user.name}(@${post.user.username})`
: `@${post.user?.username}`
- Read upRead up
- Create a ticketCreate a ticket
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"