File handlers_test.go
has 1583 lines of code (exceeds 500 allowed). Consider refactoring. Open
package api
import (
"database/sql"
"encoding/hex"
Method HandlersSuite.TestHandleConvert
has 158 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *HandlersSuite) TestHandleConvert() {
// Create dummy input file
fi := File{
FileName: "dummy input file",
CreatedAt: &Timestamp{time.Now()},
Method HandlersSuite.TestHandleTranscodeSuccess
has 100 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *HandlersSuite) TestHandleTranscodeSuccess() {
// Create dummy original file
ofi := File{
FileName: "dummy_original_file.wmv",
CreatedAt: &Timestamp{time.Now()},
HandlersSuite
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
type HandlersSuite struct {
suite.Suite
utils.TestDBManager
tx *sql.Tx
}
Method HandlersSuite.TestHandleInsertKiteiMakor
has 95 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *HandlersSuite) TestHandleInsertKiteiMakor() {
// Create dummy content unit
cu, err := CreateContentUnit(suite.tx, common.CT_LESSON_PART, nil)
suite.Require().Nil(err)
Method HandlersSuite.TestHandleUpload
has 92 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *HandlersSuite) TestHandleUpload() {
// First seen, unknown, file
input := UploadRequest{
Operation: Operation{
Station: "Upload station",
Method HandlersSuite.TestHandleInsertPublication
has 91 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *HandlersSuite) TestHandleInsertPublication() {
// Create dummy content unit
cu, err := CreateContentUnit(suite.tx, common.CT_ARTICLE, nil)
suite.Require().Nil(err)
Method HandlersSuite.TestHandleTrim
has 88 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *HandlersSuite) TestHandleTrim() {
// Create dummy original and proxy parent files
ofi := File{
FileName: "dummy original parent file",
CreatedAt: &Timestamp{time.Now()},
Method HandlersSuite.TestHandleJoin
has 88 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *HandlersSuite) TestHandleJoin() {
// create dummy input files
inOriginals := make([]string, 3)
for i := 0; i < len(inOriginals); i++ {
Method HandlersSuite.TestHandleInsert
has 84 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *HandlersSuite) TestHandleInsert() {
// Create dummy content unit
cu, err := CreateContentUnit(suite.tx, common.CT_LESSON_PART, nil)
suite.Require().Nil(err)
Method HandlersSuite.TestHandleDemux
has 70 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *HandlersSuite) TestHandleDemux() {
// Create dummy parent file
fi := File{
FileName: "dummy parent file",
CreatedAt: &Timestamp{time.Now()},
Method HandlersSuite.TestHandleInsertUpdateMode
has 68 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *HandlersSuite) TestHandleInsertUpdateMode() {
// Create dummy content unit
cu, err := CreateContentUnit(suite.tx, common.CT_LESSON_PART, nil)
suite.Require().Nil(err)
Method HandlersSuite.TestHandleInsertRenameMode
has 68 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *HandlersSuite) TestHandleInsertRenameMode() {
// Create dummy content unit
cu, err := CreateContentUnit(suite.tx, common.CT_LESSON_PART, nil)
suite.Require().Nil(err)
Method HandlersSuite.TestHandleInsertDeclamation
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *HandlersSuite) TestHandleInsertDeclamation() {
// Do insert operation
input := InsertRequest{
Operation: Operation{
Station: "Some station",
Method HandlersSuite.TestHandleTrimNoProxy
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *HandlersSuite) TestHandleTrimNoProxy() {
// Create dummy original parent file
ofi := File{
FileName: "dummy original parent file",
CreatedAt: &Timestamp{time.Now()},
Method HandlersSuite.TestHandleCaptureStop
has 59 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *HandlersSuite) TestHandleCaptureStop() {
// Prepare capture_start operation
opStart, evnts, err := handleCaptureStart(suite.tx, CaptureStartRequest{
Operation: Operation{
Station: "Capture station",
Method HandlersSuite.TestHandleSend
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *HandlersSuite) TestHandleSend() {
// Create dummy original and proxy trimmed files
ofi := File{
FileName: "dummy original trimmed file",
CreatedAt: &Timestamp{time.Now()},
Method HandlersSuite.TestHandleJoinNoProxy
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *HandlersSuite) TestHandleJoinNoProxy() {
// create dummy input files
inOriginals := make([]string, 3)
for i := 0; i < len(inOriginals); i++ {
Method HandlersSuite.TestHandleDemuxNoProxy
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (suite *HandlersSuite) TestHandleDemuxNoProxy() {
// Create dummy parent file
fi := File{
FileName: "dummy parent file",
CreatedAt: &Timestamp{time.Now()},
Identical blocks of code found in 2 locations. Consider refactoring. Open
for i, x := range input.Output {
f := fm[x.FileName]
suite.Equal(x.FileName, f.Name, "Output[%d]: Name", i)
suite.Equal(x.Sha1, hex.EncodeToString(f.Sha1.Bytes), "Output[%d]: SHA1", i)
suite.Equal(x.Size, f.Size, "Output[%d]: Size", i)
- 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 316.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
for i, x := range input.Output[:len(input.Output)-2] {
f := fm[x.FileName]
suite.Equal(x.FileName, f.Name, "Output[%d]: Name", i)
suite.Equal(x.Sha1, hex.EncodeToString(f.Sha1.Bytes), "Output[%d]: SHA1", i)
suite.Equal(x.Size, f.Size, "Output[%d]: Size", i)
- 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 316.
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 3 locations. Consider refactoring. Open
for i := 0; i < len(inOriginals); i++ {
fi := File{
FileName: fmt.Sprintf("dummy original file %d", i+1),
CreatedAt: &Timestamp{time.Now()},
Sha1: utils.RandomSHA1(),
- 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 134.
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 3 locations. Consider refactoring. Open
for i := 0; i < len(inOriginals); i++ {
fi := File{
FileName: fmt.Sprintf("dummy original file %d", i+1),
CreatedAt: &Timestamp{time.Now()},
Sha1: utils.RandomSHA1(),
- 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 134.
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 3 locations. Consider refactoring. Open
for i := 0; i < len(inProxies); i++ {
fi := File{
FileName: fmt.Sprintf("dummy proxy file %d", i+1),
CreatedAt: &Timestamp{time.Now()},
Sha1: utils.RandomSHA1(),
- 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 134.
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
input := InsertRequest{
Operation: Operation{
Station: "Some station",
User: "operator@dev.com",
WorkflowID: "workflow_id",
- 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 121.
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
input := InsertRequest{
Operation: Operation{
Station: "Some station",
User: "operator@dev.com",
WorkflowID: "workflow_id",
- 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 121.
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