Commit f8b5265b authored by Nick Thomas's avatar Nick Thomas

CE->EE: Fix errors brought up by static analysis

parent 5703e313
......@@ -449,7 +449,6 @@ import initGroupAnalytics from './init_group_analytics';
new BlobViewer();
new NewCommitForm($('.js-create-dir-form'));
if (document.querySelector('.js-tree-content').dataset.pathLocksAvailable === 'true') {
PathLocks.init(
document.querySelector('.js-tree-content').dataset.pathLocksToggle,
......
......@@ -135,66 +135,6 @@ class DropdownUtils {
return updatedItem;
}
static mergeDuplicateLabels(dataMap, newLabel) {
const updatedMap = dataMap;
const key = newLabel.title;
const hasKeyProperty = Object.prototype.hasOwnProperty.call(updatedMap, key);
if (!hasKeyProperty) {
updatedMap[key] = newLabel;
} else {
const existing = updatedMap[key];
if (!existing.multipleColors) {
existing.multipleColors = [existing.color];
}
existing.multipleColors.push(newLabel.color);
}
return updatedMap;
}
static duplicateLabelColor(labelColors) {
const colors = labelColors;
const spacing = 100 / colors.length;
// Reduce the colors to 4
colors.length = Math.min(colors.length, 4);
const color = colors.map((c, i) => {
const percentFirst = Math.floor(spacing * i);
const percentSecond = Math.floor(spacing * (i + 1));
return `${c} ${percentFirst}%, ${c} ${percentSecond}%`;
}).join(', ');
return `linear-gradient(${color})`;
}
static duplicateLabelPreprocessing(data) {
const results = [];
const dataMap = {};
data.forEach(DropdownUtils.mergeDuplicateLabels.bind(null, dataMap));
Object.keys(dataMap)
.forEach((key) => {
const label = dataMap[key];
if (label.multipleColors) {
label.color = DropdownUtils.duplicateLabelColor(label.multipleColors);
label.text_color = '#000000';
}
results.push(label);
});
results.preprocessed = true;
return results;
}
static setDataValueIfSelected(filter, selected) {
const dataValue = selected.getAttribute('data-value');
......
......@@ -388,7 +388,7 @@ describe IssuesFinder do
end
context 'for an admin' do
let(:admin_user) { create(:user, :admin) }
let(:admin_user) { create(:user, :admin) }
subject { described_class.new(admin_user, params).with_confidentiality_access_check }
......
......@@ -65,7 +65,6 @@ RSpec.configure do |config|
config.include EE::LicenseHelpers
config.include Rails.application.routes.url_helpers, type: :routing
config.infer_spec_type_from_file_location!
config.define_derived_metadata(file_path: %r{/spec/requests/(ci/)?api/}) do |metadata|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment