<commit_before>(function () {
  'use strict';
  var app = angular.module('uploadModule', [
    'blueimp.fileupload'
  ]);

  var getIdFromUrl = function (url) {
    var breakdown = /\/file\/(.+?)\/([0-9a-f]{24})/.exec(url);
    return breakdown[2];
  };

  app.directive('fngJqUploadForm', ['fileUpload', function () {
    return {
      link: function (scope, element, attrs) {
        scope.options = {};
        // Pick up options from the mongoose schema
        scope.formScope = scope.$parent;
        scope.passedParams = scope.formScope[attrs.schema];
        angular.extend(scope.options, scope.passedParams.add);
        scope.url='/file/upload/' + scope.formScope.modelName;
        scope.options.url = scope.url;
        scope.options.maxFileSize = scope.sizeLimit;
        scope.name = scope.passedParams.name;
      },
      restrict: 'E',
      templateUrl: 'templates/fileform.html',
      scope: {},
      controller: function ($scope, $element, fileUpload) {
        $scope.loadingFiles = false;
        $scope.formScope = $scope.$parent;

        if (!$scope.formScope.newRecord) {
          var watchDeregister = $scope.formScope.$watch('phase', function(newVal) {
            if (newVal === 'ready') {
              var storedData = $scope.formScope.record[$scope.name];
              if (storedData) {
                for (var i = 0; i < storedData.length; i++) {
                  $scope.$$childHead.queue = $scope.$$childHead.queue || [];
                  $scope.$$childHead.queue.push({
                    "name": storedData[i].filename,
                    "size": storedData[i].size,
                    "url": "/file/" + $scope.formScope.modelName + "/" + storedData[i]._id,
                    "thumbnailUrl": "/file/" + $scope.formScope.modelName + "/" + storedData[i]._id,
                    "deleteUrl": "/file/" + $scope.formScope.modelName + "/" + storedData[i]._id,
                    "deleteType": "DELETE"
                  });
                }
              }
              watchDeregister();
            }
          });
        }

        $scope.$on('fileuploaddone', function(event, data) {
          $scope.formScope.record[$scope.name] = $scope.formScope.record[$scope.name] || [];
          var fileDetails = data.result.files[0];
          $scope.formScope.record[$scope.name].push(
            {
              _id:      getIdFromUrl(fileDetails.url),
              filename: fileDetails.name,
              size:     fileDetails.size
            });
        });
      }
    };
  }])
    .controller('FileDestroyController', ['$scope', '$http', 'fileUpload', function ($scope, $http, fileUpload) {
      var file = $scope.file,
        state;

      $scope.uploadScope = $scope.$parent.$parent.$parent;
      $scope.formScope = $scope.uploadScope.$parent;
      $scope.name = $scope.uploadScope.passedParams.name;

      var removeFromRecord = function (file) {
        var id = getIdFromUrl(file.url);
        var array = $scope.formScope.record[$scope.name];
        for (var i = array.length - 1; i >= 0; i--) {
          if (array[i]._id === id) {
            array.splice(i, 1);
          }
        }
        $scope.clear(file);
      };

      if (file.url) {
        file.$state = function () {
          return state;
        };
        file.$destroy = function () {
          state = 'pending';
          return $http({
            url: file.deleteUrl,
            method: file.deleteType
          }).then(
            function () {
              state = 'resolved';
              removeFromRecord(file);
            },
            function () {
              state = 'rejected';
              removeFromRecord(file);
            }
          );
        };
      } else if (!file.$cancel && !file._index) {
        file.$cancel = function () {
          removeFromRecord(file);
        };
      }
    }
    ]);
})();<commit_msg>fix(build) Now strict di compliant<commit_after>(function () {
  'use strict';
  var app = angular.module('uploadModule', [
    'blueimp.fileupload'
  ]);

  var getIdFromUrl = function (url) {
    var breakdown = /\/file\/(.+?)\/([0-9a-f]{24})/.exec(url);
    return breakdown[2];
  };

  app.directive('fngJqUploadForm', ['fileUpload', function () {
    return {
      link: function (scope, element, attrs) {
        scope.options = {};
        // Pick up options from the mongoose schema
        scope.formScope = scope.$parent;
        scope.passedParams = scope.formScope[attrs.schema];
        angular.extend(scope.options, scope.passedParams.add);
        scope.url='/file/upload/' + scope.formScope.modelName;
        scope.options.url = scope.url;
        scope.options.maxFileSize = scope.sizeLimit;
        scope.name = scope.passedParams.name;
      },
      restrict: 'E',
      templateUrl: 'templates/fileform.html',
      scope: {},
      controller: ['$scope','$element', 'fileUpload',function ($scope, $element, fileUpload) {
        $scope.loadingFiles = false;
        $scope.formScope = $scope.$parent;

        if (!$scope.formScope.newRecord) {
          var watchDeregister = $scope.formScope.$watch('phase', function(newVal) {
            if (newVal === 'ready') {
              var storedData = $scope.formScope.record[$scope.name];
              if (storedData) {
                for (var i = 0; i < storedData.length; i++) {
                  $scope.$$childHead.queue = $scope.$$childHead.queue || [];
                  $scope.$$childHead.queue.push({
                    "name": storedData[i].filename,
                    "size": storedData[i].size,
                    "url": "/file/" + $scope.formScope.modelName + "/" + storedData[i]._id,
                    "thumbnailUrl": "/file/" + $scope.formScope.modelName + "/" + storedData[i]._id,
                    "deleteUrl": "/file/" + $scope.formScope.modelName + "/" + storedData[i]._id,
                    "deleteType": "DELETE"
                  });
                }
              }
              watchDeregister();
            }
          });
        }

        $scope.$on('fileuploaddone', function(event, data) {
          $scope.formScope.record[$scope.name] = $scope.formScope.record[$scope.name] || [];
          var fileDetails = data.result.files[0];
          $scope.formScope.record[$scope.name].push(
            {
              _id:      getIdFromUrl(fileDetails.url),
              filename: fileDetails.name,
              size:     fileDetails.size
            });
        });
      }]
    };
  }])
    .controller('FileDestroyController', ['$scope', '$http', 'fileUpload', function ($scope, $http, fileUpload) {
      var file = $scope.file,
        state;

      $scope.uploadScope = $scope.$parent.$parent.$parent;
      $scope.formScope = $scope.uploadScope.$parent;
      $scope.name = $scope.uploadScope.passedParams.name;

      var removeFromRecord = function (file) {
        var id = getIdFromUrl(file.url);
        var array = $scope.formScope.record[$scope.name];
        for (var i = array.length - 1; i >= 0; i--) {
          if (array[i]._id === id) {
            array.splice(i, 1);
          }
        }
        $scope.clear(file);
      };

      if (file.url) {
        file.$state = function () {
          return state;
        };
        file.$destroy = function () {
          state = 'pending';
          return $http({
            url: file.deleteUrl,
            method: file.deleteType
          }).then(
            function () {
              state = 'resolved';
              removeFromRecord(file);
            },
            function () {
              state = 'rejected';
              removeFromRecord(file);
            }
          );
        };
      } else if (!file.$cancel && !file._index) {
        file.$cancel = function () {
          removeFromRecord(file);
        };
      }
    }
    ]);
})();
{'fraction_non_alphanumeric': 0.15570315493677353, 'fraction_numerical': 0.002554604674926555, 'mean_word_length': 1.7206393328700487, 'pattern_counts': {'":': 12, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4185353', 'n_tokens_mistral': 2279, 'n_tokens_neox': 2218, 'n_words': 391}