efritz/chevron

View on GitHub

Showing 157 of 157 total issues

MockLogger has 52 methods (exceeds 20 allowed). Consider refactoring.
Open

type MockLogger struct {
    statsLogWithFieldsLock          sync.RWMutex
    statLogWithFieldsFuncCallCount  int
    statLogWithFieldsFuncCallParams []LoggerLogWithFieldsParamSet
    LogWithFieldsFunc               func(logging.LogLevel, logging.Fields, string, ...interface{})
Severity: Major
Found in middleware/mocks/logger_mock.go - About 7 hrs to fix

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

    package middleware
    
    type (
        SchemaConfigFunc func(m *SchemaMiddleware)
    )
    Severity: Major
    Found in middleware/schema_options.go and 1 other location - About 1 hr to fix
    middleware/recover_options.go on lines 1..17

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

    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

    package middleware
    
    type (
        RecoverConfigFunc func(m *RecoverMiddleware)
    )
    Severity: Major
    Found in middleware/recover_options.go and 1 other location - About 1 hr to fix
    middleware/schema_options.go on lines 1..17

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

    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

    Method SchemaMiddleware.Convert has 7 return statements (exceeds 4 allowed).
    Open

    func (m *SchemaMiddleware) Convert(f chevron.Handler) (chevron.Handler, error) {
        schema, err := loadSchema(m.path)
        if err != nil {
            return nil, err
        }
    Severity: Major
    Found in middleware/schema.go - About 45 mins to fix

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

      func (m *MockLogger) FatalWithFields(v0 logging.Fields, v1 string, v2 ...interface{}) {
          m.statsFatalWithFieldsLock.Lock()
          m.statFatalWithFieldsFuncCallCount++
          m.statFatalWithFieldsFuncCallParams = append(m.statFatalWithFieldsFuncCallParams, LoggerFatalWithFieldsParamSet{v0, v1, v2})
          m.statsFatalWithFieldsLock.Unlock()
      Severity: Major
      Found in middleware/mocks/logger_mock.go and 4 other locations - About 45 mins to fix
      middleware/mocks/logger_mock.go on lines 154..160
      middleware/mocks/logger_mock.go on lines 172..178
      middleware/mocks/logger_mock.go on lines 244..250
      middleware/mocks/logger_mock.go on lines 316..322

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

      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 5 locations. Consider refactoring.
      Open

      func (m *MockLogger) ErrorWithFields(v0 logging.Fields, v1 string, v2 ...interface{}) {
          m.statsErrorWithFieldsLock.Lock()
          m.statErrorWithFieldsFuncCallCount++
          m.statErrorWithFieldsFuncCallParams = append(m.statErrorWithFieldsFuncCallParams, LoggerErrorWithFieldsParamSet{v0, v1, v2})
          m.statsErrorWithFieldsLock.Unlock()
      Severity: Major
      Found in middleware/mocks/logger_mock.go and 4 other locations - About 45 mins to fix
      middleware/mocks/logger_mock.go on lines 154..160
      middleware/mocks/logger_mock.go on lines 244..250
      middleware/mocks/logger_mock.go on lines 298..304
      middleware/mocks/logger_mock.go on lines 316..322

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

      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 5 locations. Consider refactoring.
      Open

      func (m *MockLogger) DebugWithFields(v0 logging.Fields, v1 string, v2 ...interface{}) {
          m.statsDebugWithFieldsLock.Lock()
          m.statDebugWithFieldsFuncCallCount++
          m.statDebugWithFieldsFuncCallParams = append(m.statDebugWithFieldsFuncCallParams, LoggerDebugWithFieldsParamSet{v0, v1, v2})
          m.statsDebugWithFieldsLock.Unlock()
      Severity: Major
      Found in middleware/mocks/logger_mock.go and 4 other locations - About 45 mins to fix
      middleware/mocks/logger_mock.go on lines 172..178
      middleware/mocks/logger_mock.go on lines 244..250
      middleware/mocks/logger_mock.go on lines 298..304
      middleware/mocks/logger_mock.go on lines 316..322

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

      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 5 locations. Consider refactoring.
      Open

      func (m *MockLogger) InfoWithFields(v0 logging.Fields, v1 string, v2 ...interface{}) {
          m.statsInfoWithFieldsLock.Lock()
          m.statInfoWithFieldsFuncCallCount++
          m.statInfoWithFieldsFuncCallParams = append(m.statInfoWithFieldsFuncCallParams, LoggerInfoWithFieldsParamSet{v0, v1, v2})
          m.statsInfoWithFieldsLock.Unlock()
      Severity: Major
      Found in middleware/mocks/logger_mock.go and 4 other locations - About 45 mins to fix
      middleware/mocks/logger_mock.go on lines 154..160
      middleware/mocks/logger_mock.go on lines 172..178
      middleware/mocks/logger_mock.go on lines 244..250
      middleware/mocks/logger_mock.go on lines 298..304

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

      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 5 locations. Consider refactoring.
      Open

      func (m *MockLogger) WarningWithFields(v0 logging.Fields, v1 string, v2 ...interface{}) {
          m.statsWarningWithFieldsLock.Lock()
          m.statWarningWithFieldsFuncCallCount++
          m.statWarningWithFieldsFuncCallParams = append(m.statWarningWithFieldsFuncCallParams, LoggerWarningWithFieldsParamSet{v0, v1, v2})
          m.statsWarningWithFieldsLock.Unlock()
      Severity: Major
      Found in middleware/mocks/logger_mock.go and 4 other locations - About 45 mins to fix
      middleware/mocks/logger_mock.go on lines 154..160
      middleware/mocks/logger_mock.go on lines 172..178
      middleware/mocks/logger_mock.go on lines 298..304
      middleware/mocks/logger_mock.go on lines 316..322

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

      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

      Method CacheMiddleware.Convert has 5 return statements (exceeds 4 allowed).
      Open

      func (m *CacheMiddleware) Convert(f chevron.Handler) (chevron.Handler, error) {
          handler := func(ctx context.Context, req *http.Request, logger nacelle.Logger) response.Response {
              // If we don't have a cache instance or if this request can
              // have side effects, do not attempt to touch the cache in
              // either direction.
      Severity: Major
      Found in middleware/cache.go - About 35 mins to fix

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

        func (m *MockLogger) Debug(v0 string, v1 ...interface{}) {
            m.statsDebugLock.Lock()
            m.statDebugFuncCallCount++
            m.statDebugFuncCallParams = append(m.statDebugFuncCallParams, LoggerDebugParamSet{v0, v1})
            m.statsDebugLock.Unlock()
        Severity: Major
        Found in middleware/mocks/logger_mock.go and 4 other locations - About 35 mins to fix
        middleware/mocks/logger_mock.go on lines 190..196
        middleware/mocks/logger_mock.go on lines 208..214
        middleware/mocks/logger_mock.go on lines 226..232
        middleware/mocks/logger_mock.go on lines 280..286

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

        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 5 locations. Consider refactoring.
        Open

        func (m *MockLogger) Error(v0 string, v1 ...interface{}) {
            m.statsErrorLock.Lock()
            m.statErrorFuncCallCount++
            m.statErrorFuncCallParams = append(m.statErrorFuncCallParams, LoggerErrorParamSet{v0, v1})
            m.statsErrorLock.Unlock()
        Severity: Major
        Found in middleware/mocks/logger_mock.go and 4 other locations - About 35 mins to fix
        middleware/mocks/logger_mock.go on lines 190..196
        middleware/mocks/logger_mock.go on lines 208..214
        middleware/mocks/logger_mock.go on lines 226..232
        middleware/mocks/logger_mock.go on lines 262..268

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

        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 5 locations. Consider refactoring.
        Open

        func (m *MockLogger) Fatal(v0 string, v1 ...interface{}) {
            m.statsFatalLock.Lock()
            m.statFatalFuncCallCount++
            m.statFatalFuncCallParams = append(m.statFatalFuncCallParams, LoggerFatalParamSet{v0, v1})
            m.statsFatalLock.Unlock()
        Severity: Major
        Found in middleware/mocks/logger_mock.go and 4 other locations - About 35 mins to fix
        middleware/mocks/logger_mock.go on lines 208..214
        middleware/mocks/logger_mock.go on lines 226..232
        middleware/mocks/logger_mock.go on lines 262..268
        middleware/mocks/logger_mock.go on lines 280..286

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

        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 5 locations. Consider refactoring.
        Open

        func (m *MockLogger) Info(v0 string, v1 ...interface{}) {
            m.statsInfoLock.Lock()
            m.statInfoFuncCallCount++
            m.statInfoFuncCallParams = append(m.statInfoFuncCallParams, LoggerInfoParamSet{v0, v1})
            m.statsInfoLock.Unlock()
        Severity: Major
        Found in middleware/mocks/logger_mock.go and 4 other locations - About 35 mins to fix
        middleware/mocks/logger_mock.go on lines 190..196
        middleware/mocks/logger_mock.go on lines 226..232
        middleware/mocks/logger_mock.go on lines 262..268
        middleware/mocks/logger_mock.go on lines 280..286

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

        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 5 locations. Consider refactoring.
        Open

        func (m *MockLogger) Warning(v0 string, v1 ...interface{}) {
            m.statsWarningLock.Lock()
            m.statWarningFuncCallCount++
            m.statWarningFuncCallParams = append(m.statWarningFuncCallParams, LoggerWarningParamSet{v0, v1})
            m.statsWarningLock.Unlock()
        Severity: Major
        Found in middleware/mocks/logger_mock.go and 4 other locations - About 35 mins to fix
        middleware/mocks/logger_mock.go on lines 190..196
        middleware/mocks/logger_mock.go on lines 208..214
        middleware/mocks/logger_mock.go on lines 262..268
        middleware/mocks/logger_mock.go on lines 280..286

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

        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

        exported method AuthMiddleware.Convert should have comment or be unexported
        Open

        func (m *AuthMiddleware) Convert(f chevron.Handler) (chevron.Handler, error) {
        Severity: Minor
        Found in middleware/auth.go by golint

        exported type JWTClaimsFactory should have comment or be unexported
        Open

            JWTClaimsFactory func() jwt.Claims
        Severity: Minor
        Found in middleware/auth_jwt.go by golint

        exported function NewMockCache should have comment or be unexported
        Open

        func NewMockCache() *MockCache {
        Severity: Minor
        Found in middleware/mocks/cache_mock.go by golint

        exported method MockCache.SetValueFuncCallCount should have comment or be unexported
        Open

        func (m *MockCache) SetValueFuncCallCount() int {
        Severity: Minor
        Found in middleware/mocks/cache_mock.go by golint

        exported method MockCache.SetValueFuncCallParams should have comment or be unexported
        Open

        func (m *MockCache) SetValueFuncCallParams() []CacheSetValueParamSet {
        Severity: Minor
        Found in middleware/mocks/cache_mock.go by golint
        Severity
        Category
        Status
        Source
        Language