shaungrady/angular-http-etag

View on GitHub
src/httpDecorator.js

Summary

Maintainability
D
2 days
Test Coverage

Function httpEtagHttpDecorator has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
Open

function httpEtagHttpDecorator ($delegate, httpEtag) {
  var $http = $delegate
  var cachableHttpMethods = [
    'GET',
    'JSONP'
Severity: Minor
Found in src/httpDecorator.js - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function httpEtagHttpDecorator has 152 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function httpEtagHttpDecorator ($delegate, httpEtag) {
  var $http = $delegate
  var cachableHttpMethods = [
    'GET',
    'JSONP'
Severity: Major
Found in src/httpDecorator.js - About 6 hrs to fix

    Function $httpDecorator has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function $httpDecorator (httpConfig) {
        var useLegacyPromiseExtensions = httpEtagHttpDecorator.useLegacyPromiseExtensions()
        var hasConfig = !!httpConfig.etagCache
        var isCacheableMethod = cachableHttpMethods.indexOf(httpConfig.method) >= 0
        var isCachable = hasConfig && isCacheableMethod
    Severity: Major
    Found in src/httpDecorator.js - About 2 hrs to fix

      Function httpEtagPromiseFactory has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function httpEtagPromiseFactory (httpPromise) {
            var then = httpPromise.then
            var success = httpPromise.success
      
            if (useLegacyPromiseExtensions) {
      Severity: Minor
      Found in src/httpDecorator.js - About 1 hr to fix

        Function processHttpConfigEtagValue has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function processHttpConfigEtagValue (httpConfig) {
            var etagValue = httpConfig.etagCache
            var etagValueType = typeof etagValue
            var etagCacheConfig = {}
        
        
        Severity: Minor
        Found in src/httpDecorator.js - About 1 hr to fix

          There are no issues that match your filters.

          Category
          Status