Showing 3,313 of 3,313 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (isTranscriptionPayloadSuccess(payload) && payload.vttFile) {
attaches[`payload[vttFile]`] = payload.vttFile
payloadWithoutFiles = omit(payloadWithoutFiles as TranscriptionSuccess, [ 'vttFile' ])
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 59.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
socket.on('unsubscribe', params => {
const videoId = params.videoId + ''
if (!isIdValid(videoId)) return
/* eslint-disable @typescript-eslint/no-floating-promises */
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 59.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (this.linkType === 'external') {
this.routerLink = null
this.playlistHref = this.playlist.url
this.playlistTarget = '_blank'
return
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 59.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
async addReplyToLastThread (options: OverrideCommandOptions & {
text: string
}) {
return this.addReply({ ...options, videoId: this.lastVideoId, toCommentId: this.lastThreadId })
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 59.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function getStats
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async getStats (strategy: VideoRedundancyStrategyWithManual) {
const actor = await getServerActor()
const sql = `WITH "tmp" AS ` +
`(` +
Function toActivityPubObject
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
toActivityPubObject (this: MVideoRedundancyAP): CacheFileObject {
if (this.VideoStreamingPlaylist) {
return {
id: this.url,
type: 'CacheFile' as 'CacheFile',
Function acceptRegistration
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function acceptRegistration (req: express.Request, res: express.Response) {
const registration = res.locals.userRegistration
const body: UserRegistrationUpdateState = req.body
const userToCreate = buildUser({
Function areValidationErrors
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function areValidationErrors (
req: express.Request,
res: express.Response,
options: {
omitLog?: boolean
Function onExternalUserAuthenticated
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function onExternalUserAuthenticated (options: {
npmName: string
authName: string
authResult: RegisterServerExternalAuthenticatedResult
}) {
Function autoBlacklistVideoIfNeeded
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function autoBlacklistVideoIfNeeded (parameters: {
video: MVideoWithBlacklistLight
user?: MUser
isRemote: boolean
isNew: boolean
Function updateUserFromExternal
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function updateUserFromExternal (
user: MUserDefault,
userOptions: ExternalUser,
userUpdater: RegisterServerAuthenticatedResult['userUpdater']
) {
Function init
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
init () {
const events = this.getContext().nodeEvent
events.on('postPublish', (sessionId: string, streamPath: string) => {
logger.debug('RTMP received stream', { id: sessionId, streamPath, ...lTags(sessionId) })
Function cacheFileActivityObjectToDBAttributes
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function cacheFileActivityObjectToDBAttributes (cacheFileObject: CacheFileObject, video: MVideoWithAllFiles, byActor: MActorId) {
if (cacheFileObject.url.mediaType === 'application/x-mpegURL') {
const url = cacheFileObject.url
Function create
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async create (options: CreateOptions) {
const { video, resolution, fps, priority, dependsOnRunnerJob } = options
const jobUUID = buildUUID()
const { separatedAudioFile } = video.getMaxQualityAudioAndVideoFiles()
Function createTranscodingJobs
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async createTranscodingJobs (options: {
transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7
video: MVideoFullLight
resolutions: number[]
isNewVideo: boolean
Function optimizeOriginalVideofile
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function optimizeOriginalVideofile (options: {
video: MVideoFullLight
quickTranscode: boolean
job: Job
}) {
Function displayFatalError
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
displayFatalError () {
// Already displayed an error
if (this.errorModal) return
debugLogger('Display fatal error')
Function getMetadataStream
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private getMetadataStream (streams: any[], type: 'video' | 'audio') {
const stream = streams.find(s => s.codec_type === type)
if (!stream) return undefined
let keyToTranslateFunction = {
Function constructor
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor (hash: ServerVideoPlaylist, translations: { [ id: string ]: string }) {
const absoluteAPIUrl = getAbsoluteAPIUrl()
this.id = hash.id
this.uuid = hash.uuid
Function viewReplies
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
viewReplies (commentId: number, highlightThread = false) {
this.threadLoading[commentId] = true
const params = {
videoId: this.video.uuid,