Bnei-Baruch/mdb

View on GitHub
api/rest_test.go

Summary

Maintainability
F
5 days
Test Coverage

Method RestSuite.TestFilesList has 65 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (suite *RestSuite) TestFilesList() {
    cp := new(DummyAuthProvider)
    req := FilesRequest{
        ListRequest: ListRequest{StartIndex: 1, StopIndex: 5},
    }
Severity: Minor
Found in api/rest_test.go - About 1 hr to fix

    Method RestSuite.TestContentUnitsList has 52 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (suite *RestSuite) TestContentUnitsList() {
        cp := new(DummyAuthProvider)
        req := ContentUnitsRequest{
            ListRequest: ListRequest{StartIndex: 1, StopIndex: 5},
        }
    Severity: Minor
    Found in api/rest_test.go - About 1 hr to fix

      Method RestSuite.TestCollectionsList has 52 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (suite *RestSuite) TestCollectionsList() {
          cp := new(DummyAuthProvider)
      
          req := CollectionsRequest{
              ListRequest: ListRequest{StartIndex: 1, StopIndex: 5},
      Severity: Minor
      Found in api/rest_test.go - About 1 hr to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        func (suite *RestSuite) TestCollectionsList() {
            cp := new(DummyAuthProvider)
        
            req := CollectionsRequest{
                ListRequest: ListRequest{StartIndex: 1, StopIndex: 5},
        Severity: Major
        Found in api/rest_test.go and 1 other location - About 1 day to fix
        api/rest_test.go on lines 134..194

        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 602.

        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

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        func (suite *RestSuite) TestContentUnitsList() {
            cp := new(DummyAuthProvider)
            req := ContentUnitsRequest{
                ListRequest: ListRequest{StartIndex: 1, StopIndex: 5},
            }
        Severity: Major
        Found in api/rest_test.go and 1 other location - About 1 day to fix
        api/rest_test.go on lines 55..116

        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 602.

        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

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        func createDummyContentUnits(exec boil.Executor, n int) []*models.ContentUnit {
            units := make([]*models.ContentUnit, n)
            for i := range units {
                j := n - i - 1
                units[j] = &models.ContentUnit{
        Severity: Major
        Found in api/rest_test.go and 1 other location - About 3 hrs to fix
        api/rest_test.go on lines 395..414

        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 292.

        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

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        func createDummyCollections(exec boil.Executor, n int) []*models.Collection {
            collections := make([]*models.Collection, n)
            for i := range collections {
                j := n - i - 1
                collections[j] = &models.Collection{
        Severity: Major
        Found in api/rest_test.go and 1 other location - About 3 hrs to fix
        api/rest_test.go on lines 416..435

        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 292.

        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

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        func (suite *RestSuite) assertEqualDummyContentUnit(cu *models.ContentUnit, x *ContentUnit, idx int) {
            suite.Equal(cu.ID, x.ID, "content_unit.ID [%d]", idx)
            suite.Equal(cu.UID, x.UID, "content_unit.UID [%d]", idx)
            suite.Equal(cu.TypeID, x.TypeID, "content_unit.TypeID [%d]", idx)
            suite.Equal(len(cu.R.ContentUnitI18ns), len(x.I18n), "content_unit i18ns length [%d]", idx)
        Severity: Major
        Found in api/rest_test.go and 1 other location - About 2 hrs to fix
        api/rest_test.go on lines 350..362

        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 233.

        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

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        func (suite *RestSuite) assertEqualDummyCollection(c *models.Collection, x *Collection, idx int) {
            suite.Equal(c.ID, x.ID, "collection.ID [%d]", idx)
            suite.Equal(c.UID, x.UID, "collection.UID [%d]", idx)
            suite.Equal(c.TypeID, x.TypeID, "collection.TypeID [%d]", idx)
            suite.Equal(len(c.R.CollectionI18ns), len(x.I18n), "collection i18ns length [%d]", idx)
        Severity: Major
        Found in api/rest_test.go and 1 other location - About 2 hrs to fix
        api/rest_test.go on lines 364..376

        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 233.

        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

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

        func (suite *RestSuite) TestCollectionItem() {
            cp := new(DummyAuthProvider)
            c, err := handleGetCollection(cp, suite.tx, 1)
            suite.Nil(c, "Collection nil")
            suite.Require().NotNil(err, "Not Found error")
        Severity: Major
        Found in api/rest_test.go and 3 other locations - About 2 hrs to fix
        api/rest_test.go on lines 196..210
        api/rest_test.go on lines 288..302
        api/rest_test.go on lines 332..346

        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 193.

        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

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

        func (suite *RestSuite) TestFileItem() {
            cp := new(DummyAuthProvider)
            f, err := handleGetFile(cp, suite.tx, 1)
            suite.Nil(f, "file nil")
            suite.Require().NotNil(err, "Not Found error")
        Severity: Major
        Found in api/rest_test.go and 3 other locations - About 2 hrs to fix
        api/rest_test.go on lines 118..132
        api/rest_test.go on lines 196..210
        api/rest_test.go on lines 332..346

        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 193.

        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

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

        func (suite *RestSuite) TestContentUnitItem() {
            cp := new(DummyAuthProvider)
            cu, err := handleGetContentUnit(cp, suite.tx, 1)
            suite.Nil(cu, "ContentUnit nil")
            suite.Require().NotNil(err, "Not Found error")
        Severity: Major
        Found in api/rest_test.go and 3 other locations - About 2 hrs to fix
        api/rest_test.go on lines 118..132
        api/rest_test.go on lines 288..302
        api/rest_test.go on lines 332..346

        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 193.

        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

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

        func (suite *RestSuite) TestOperationItem() {
            cp := new(DummyAuthProvider)
            f, err := handleGetFile(cp, suite.tx, 1)
            suite.Nil(f, "file nil")
            suite.Require().NotNil(err, "Not Found error")
        Severity: Major
        Found in api/rest_test.go and 3 other locations - About 2 hrs to fix
        api/rest_test.go on lines 118..132
        api/rest_test.go on lines 196..210
        api/rest_test.go on lines 288..302

        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 193.

        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

        Further Reading

        There are no issues that match your filters.

        Category
        Status