summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/reports/codequality_report
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/reports/codequality_report')
-rw-r--r--app/assets/javascripts/reports/codequality_report/components/codequality_issue_body.vue5
-rw-r--r--app/assets/javascripts/reports/codequality_report/grouped_codequality_reports_app.vue18
-rw-r--r--app/assets/javascripts/reports/codequality_report/store/actions.js31
-rw-r--r--app/assets/javascripts/reports/codequality_report/store/mutations.js3
-rw-r--r--app/assets/javascripts/reports/codequality_report/store/utils/codequality_parser.js (renamed from app/assets/javascripts/reports/codequality_report/store/utils/codequality_comparison.js)16
-rw-r--r--app/assets/javascripts/reports/codequality_report/workers/codequality_comparison_worker.js28
6 files changed, 13 insertions, 88 deletions
diff --git a/app/assets/javascripts/reports/codequality_report/components/codequality_issue_body.vue b/app/assets/javascripts/reports/codequality_report/components/codequality_issue_body.vue
index e5980f1e539..dabfb623f43 100644
--- a/app/assets/javascripts/reports/codequality_report/components/codequality_issue_body.vue
+++ b/app/assets/javascripts/reports/codequality_report/components/codequality_issue_body.vue
@@ -6,7 +6,7 @@
import { GlIcon, GlTooltipDirective } from '@gitlab/ui';
import { s__ } from '~/locale';
import ReportLink from '~/reports/components/report_link.vue';
-import { STATUS_SUCCESS } from '~/reports/constants';
+import { STATUS_SUCCESS, STATUS_NEUTRAL } from '~/reports/constants';
import { SEVERITY_CLASSES, SEVERITY_ICONS } from '../constants';
export default {
@@ -21,7 +21,8 @@ export default {
props: {
status: {
type: String,
- required: true,
+ required: false,
+ default: STATUS_NEUTRAL,
},
issue: {
type: Object,
diff --git a/app/assets/javascripts/reports/codequality_report/grouped_codequality_reports_app.vue b/app/assets/javascripts/reports/codequality_report/grouped_codequality_reports_app.vue
index d293165ef2f..3287ba691bf 100644
--- a/app/assets/javascripts/reports/codequality_report/grouped_codequality_reports_app.vue
+++ b/app/assets/javascripts/reports/codequality_report/grouped_codequality_reports_app.vue
@@ -3,7 +3,6 @@ import { mapState, mapActions, mapGetters } from 'vuex';
import { s__, sprintf } from '~/locale';
import { componentNames } from '~/reports/components/issue_body';
import ReportSection from '~/reports/components/report_section.vue';
-import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import createStore from './store';
export default {
@@ -12,26 +11,12 @@ export default {
components: {
ReportSection,
},
- mixins: [glFeatureFlagsMixin()],
props: {
- headPath: {
- type: String,
- required: true,
- },
- headBlobPath: {
- type: String,
- required: true,
- },
basePath: {
type: String,
required: false,
default: null,
},
- baseBlobPath: {
- type: String,
- required: false,
- default: null,
- },
codequalityReportsPath: {
type: String,
required: false,
@@ -55,9 +40,6 @@ export default {
created() {
this.setPaths({
basePath: this.basePath,
- headPath: this.headPath,
- baseBlobPath: this.baseBlobPath,
- headBlobPath: this.headBlobPath,
reportsPath: this.codequalityReportsPath,
helpPath: this.codequalityHelpPath,
});
diff --git a/app/assets/javascripts/reports/codequality_report/store/actions.js b/app/assets/javascripts/reports/codequality_report/store/actions.js
index ddd1747899f..e3238207af2 100644
--- a/app/assets/javascripts/reports/codequality_report/store/actions.js
+++ b/app/assets/javascripts/reports/codequality_report/store/actions.js
@@ -1,34 +1,23 @@
import axios from '~/lib/utils/axios_utils';
import * as types from './mutation_types';
-import { parseCodeclimateMetrics, doCodeClimateComparison } from './utils/codequality_comparison';
+import { parseCodeclimateMetrics } from './utils/codequality_parser';
export const setPaths = ({ commit }, paths) => commit(types.SET_PATHS, paths);
-export const fetchReports = ({ state, dispatch, commit }, diffFeatureFlagEnabled) => {
+export const fetchReports = ({ state, dispatch, commit }) => {
commit(types.REQUEST_REPORTS);
- if (diffFeatureFlagEnabled) {
- return axios
- .get(state.reportsPath)
- .then(({ data }) => {
- return dispatch('receiveReportsSuccess', {
- newIssues: parseCodeclimateMetrics(data.new_errors, state.headBlobPath),
- resolvedIssues: parseCodeclimateMetrics(data.resolved_errors, state.baseBlobPath),
- });
- })
- .catch((error) => dispatch('receiveReportsError', error));
- }
if (!state.basePath) {
return dispatch('receiveReportsError');
}
- return Promise.all([axios.get(state.headPath), axios.get(state.basePath)])
- .then((results) =>
- doCodeClimateComparison(
- parseCodeclimateMetrics(results[0].data, state.headBlobPath),
- parseCodeclimateMetrics(results[1].data, state.baseBlobPath),
- ),
- )
- .then((data) => dispatch('receiveReportsSuccess', data))
+ return axios
+ .get(state.reportsPath)
+ .then(({ data }) => {
+ return dispatch('receiveReportsSuccess', {
+ newIssues: parseCodeclimateMetrics(data.new_errors, state.headBlobPath),
+ resolvedIssues: parseCodeclimateMetrics(data.resolved_errors, state.baseBlobPath),
+ });
+ })
.catch((error) => dispatch('receiveReportsError', error));
};
diff --git a/app/assets/javascripts/reports/codequality_report/store/mutations.js b/app/assets/javascripts/reports/codequality_report/store/mutations.js
index 095e6637966..8edeb6cc976 100644
--- a/app/assets/javascripts/reports/codequality_report/store/mutations.js
+++ b/app/assets/javascripts/reports/codequality_report/store/mutations.js
@@ -3,9 +3,6 @@ import * as types from './mutation_types';
export default {
[types.SET_PATHS](state, paths) {
state.basePath = paths.basePath;
- state.headPath = paths.headPath;
- state.baseBlobPath = paths.baseBlobPath;
- state.headBlobPath = paths.headBlobPath;
state.reportsPath = paths.reportsPath;
state.helpPath = paths.helpPath;
},
diff --git a/app/assets/javascripts/reports/codequality_report/store/utils/codequality_comparison.js b/app/assets/javascripts/reports/codequality_report/store/utils/codequality_parser.js
index b252c8c9817..a794f5f0577 100644
--- a/app/assets/javascripts/reports/codequality_report/store/utils/codequality_comparison.js
+++ b/app/assets/javascripts/reports/codequality_report/store/utils/codequality_parser.js
@@ -1,5 +1,3 @@
-import CodeQualityComparisonWorker from '../../workers/codequality_comparison_worker';
-
export const parseCodeclimateMetrics = (issues = [], path = '') => {
return issues.map((issue) => {
const parsedIssue = {
@@ -27,17 +25,3 @@ export const parseCodeclimateMetrics = (issues = [], path = '') => {
return parsedIssue;
});
};
-
-export const doCodeClimateComparison = (headIssues, baseIssues) => {
- // Do these comparisons in worker threads to avoid blocking the main thread
- return new Promise((resolve, reject) => {
- const worker = new CodeQualityComparisonWorker();
- worker.addEventListener('message', ({ data }) =>
- data.newIssues && data.resolvedIssues ? resolve(data) : reject(data),
- );
- worker.postMessage({
- headIssues,
- baseIssues,
- });
- });
-};
diff --git a/app/assets/javascripts/reports/codequality_report/workers/codequality_comparison_worker.js b/app/assets/javascripts/reports/codequality_report/workers/codequality_comparison_worker.js
deleted file mode 100644
index ae389d266f8..00000000000
--- a/app/assets/javascripts/reports/codequality_report/workers/codequality_comparison_worker.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import { differenceBy } from 'lodash';
-
-const KEY_TO_FILTER_BY = 'fingerprint';
-
-// eslint-disable-next-line no-restricted-globals
-self.addEventListener('message', (e) => {
- const { data } = e;
-
- if (data === undefined) {
- return null;
- }
-
- const { headIssues, baseIssues } = data;
-
- if (!headIssues || !baseIssues) {
- // eslint-disable-next-line no-restricted-globals
- return self.postMessage({});
- }
-
- // eslint-disable-next-line no-restricted-globals
- self.postMessage({
- newIssues: differenceBy(headIssues, baseIssues, KEY_TO_FILTER_BY),
- resolvedIssues: differenceBy(baseIssues, headIssues, KEY_TO_FILTER_BY),
- });
-
- // eslint-disable-next-line no-restricted-globals
- return self.close();
-});