Showing 3,313 of 3,313 total issues
Function createUserAccountAndChannelAndPlaylist
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function createUserAccountAndChannelAndPlaylist (parameters: {
userToCreate: MUser
userDisplayName?: string
channelNames?: ChannelNames
validateUser?: boolean
Function insertFromImportIntoDB
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function insertFromImportIntoDB (parameters: {
video: MVideoThumbnail
thumbnailModel: MThumbnail
previewModel: MThumbnail
videoChannel: MChannelAccountDefault
Function onTranscriptionEnded
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function onTranscriptionEnded (options: {
video: MVideoFullLight
language: string
vttPath: string
lTags?: (string | number)[]
Function checkVideoFileCanBeEdited
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function checkVideoFileCanBeEdited (video: MVideo, res: express.Response) {
if (video.isLive) {
res.fail({
status: HttpStatusCode.BAD_REQUEST_400,
message: 'Cannot edit a live video'
Function checkVideoCanBeTranscribedOrTranscripted
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function checkVideoCanBeTranscribedOrTranscripted (video: MVideo, res: express.Response) {
if (video.remote) {
res.fail({
status: HttpStatusCode.BAD_REQUEST_400,
message: 'Cannot run this task on a remote video'
Function importObject
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected async importObject (channelImportData: SanitizedObject) {
const account = this.user.Account
const existingChannel = await VideoChannelModel.loadLocalByNameAndPopulateAccount(channelImportData.name)
if (existingChannel) {
Function saveNewOriginalFileIfNeeded
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function saveNewOriginalFileIfNeeded (video: MVideo, videoFile: MVideoFile) {
if (!CONFIG.TRANSCODING.ORIGINAL_FILE.KEEP) return
const videoSource = await VideoSourceModel.loadLatest(video.id)
Function crawlCollectionPage
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function crawlCollectionPage <T> (argUrl: string, handler: HandlerFunction<T>, cleaner?: CleanerFunction) {
let url = argUrl
logger.info('Crawling ActivityPub data on %s.', url)
Function registerSourceHandler
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const registerSourceHandler = function (vjs: typeof videojs) {
if (!Hlsjs.isSupported()) {
logger.info('Hls.js is not supported in this browser.')
return
}
Function doRefresh
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function doRefresh <T extends MActorFull | MActorAccountChannelId> (options: RefreshOptions<T>): RefreshResult <MActorFull> {
const { actor: actorArg, fetchedType } = options
// We need more attributes
const actor = fetchedType === 'all'
Function ngOnInit
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit () {
this.confirmService.showConfirm.subscribe(
payload => {
// Reinit fields
this.title = ''
Function generateCaptionOfSpecificVideo
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private generateCaptionOfSpecificVideo (options: {
video: Video
forceTranscription: boolean
}): Observable<'success' | 'already-has-captions' | 'already-being-transcribed'> {
const { video, forceTranscription } = options
Function checkTranscodingFields
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private checkTranscodingFields () {
const transcodingControl = this.form.get('transcoding.enabled')
const videoStudioControl = this.form.get('videoStudio.enabled')
const hlsControl = this.form.get('transcoding.hls.enabled')
const webVideosControl = this.form.get('transcoding.webVideos.enabled')
Function subscribeToVideoRequests
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private subscribeToVideoRequests () {
this.videoRequests
.pipe(
concatMap(({ reset, obsHighlightedLives, obsVideos }) => {
return forkJoin([ obsHighlightedLives, obsVideos ])
Function constructChannel
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private constructChannel () {
const channel = Channel.build({ window: window.parent, origin: '*', scope: this.embed.getScope() })
channel.bind('setVideoPassword', (txn, value) => this.embed.setVideoPasswordByAPI(value))
Function buildElement
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async buildElement (text: string) {
const html = await this.markdown.customPageMarkdownToHTML({ markdown: text, additionalAllowedTags: this.getSupportedTags() })
const rootElement = document.createElement('div')
rootElement.innerHTML = html
Function buildVODCommand
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async buildVODCommand (options: TranscodeVODOptions & {
videoStreamOnly?: boolean
canCopyAudio?: boolean
canCopyVideo?: boolean
}) {
Function report
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
report (options: OverrideCommandOptions & {
reason: string
accountId?: number
videoId?: number
Similar blocks of code found in 3 locations. Consider refactoring. Open
WEB_VIDEOS: {
BUCKET_NAME: config.get<string>('object_storage.web_videos.bucket_name'),
PREFIX: config.get<string>('object_storage.web_videos.prefix'),
BASE_URL: config.get<string>('object_storage.web_videos.base_url')
},
- 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 57.
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 4 locations. Consider refactoring. Open
it('Should enable signup without approval', async () => {
await prepareSignup({ enabled: true, requiresApproval: false, requiresEmailVerification: false })
await signupPage.getRegisterMenuButton().waitForDisplayed()
})
- 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 57.
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