diff --git a/openedx/features/course_experience/static/course_experience/js/WelcomeMessage.js b/openedx/features/course_experience/static/course_experience/js/WelcomeMessage.js index e865563f85..90685eac52 100644 --- a/openedx/features/course_experience/static/course_experience/js/WelcomeMessage.js +++ b/openedx/features/course_experience/static/course_experience/js/WelcomeMessage.js @@ -1,5 +1,5 @@ /* globals $ */ -import 'jquery.cookie'; +import 'jquery.cookie'; // eslint-disable-line import gettext from 'gettext'; // eslint-disable-line import { clampHtmlByWords } from 'common/js/utils/clamp-html'; // eslint-disable-line diff --git a/openedx/features/course_search/static/course_search/js/collections/search_collection.js b/openedx/features/course_search/static/course_search/js/collections/search_collection.js index 137a6acea0..a1a9d3e4ba 100644 --- a/openedx/features/course_search/static/course_search/js/collections/search_collection.js +++ b/openedx/features/course_search/static/course_search/js/collections/search_collection.js @@ -55,7 +55,7 @@ self.trigger('search'); }, error: function(self, response) { - self.errorMessage = self.extractErrorMessage(response); + self.errorMessage = self.extractErrorMessage(response); // eslint-disable-line no-param-reassign self.trigger('error'); } }); @@ -78,7 +78,7 @@ self.trigger('next'); }, error: function(self, response) { - self.errorMessage = self.extractErrorMessage(response); + self.errorMessage = self.extractErrorMessage(response); // eslint-disable-line no-param-reassign self.trigger('error'); }, add: true, diff --git a/openedx/features/learner_profile/static/learner_profile/js/learner_profile_factory.js b/openedx/features/learner_profile/static/learner_profile/js/learner_profile_factory.js index 201a661665..3921027734 100644 --- a/openedx/features/learner_profile/static/learner_profile/js/learner_profile_factory.js +++ b/openedx/features/learner_profile/static/learner_profile/js/learner_profile_factory.js @@ -1,4 +1,4 @@ -(function(define) { +(function (define){ 'use strict'; define([ @@ -19,19 +19,19 @@ 'js/student_account/views/account_settings_fields', 'js/views/message_banner', 'string_utils' - ], function(gettext, $, _, Backbone, Logger, StringUtils, PagingCollection, AccountSettingsModel, - AccountPreferencesModel, FieldsView, LearnerProfileFieldsView, LearnerProfileView, BadgeModel, - BadgeListContainer, AccountSettingsFieldViews, MessageBannerView) { - return function(options) { + ], function (gettext, $, _, Backbone, Logger, StringUtils, PagingCollection, AccountSettingsModel, + AccountPreferencesModel, FieldsView, LearnerProfileFieldsView, LearnerProfileView, BadgeModel, + BadgeListContainer, AccountSettingsFieldViews, MessageBannerView){ + return function (options) { var $learnerProfileElement = $('.wrapper-profile'); var accountSettingsModel = new AccountSettingsModel( _.extend( options.account_settings_data, { - default_public_account_fields: options.default_public_account_fields, - parental_consent_age_limit: options.parental_consent_age_limit, - enable_coppa_compliance: options.enable_coppa_compliance + default_public_account_fields: options.default_public_account_fields, + parental_consent_age_limit: options.parental_consent_age_limit, + enable_coppa_compliance: options.enable_coppa_compliance } ), {parse: true} @@ -208,7 +208,7 @@ platformName: options.platform_name }); - getProfileVisibility = function() { + getProfileVisibility = function (){ if (options.has_preferences_access) { return accountPreferencesModel.get('account_privacy'); } else { @@ -216,7 +216,7 @@ } }; - showLearnerProfileView = function() { + showLearnerProfileView = function (){ // Record that the profile page was viewed Logger.log('edx.user.settings.viewed', { page: 'profile', diff --git a/openedx/features/learner_profile/static/learner_profile/js/views/learner_profile_view.js b/openedx/features/learner_profile/static/learner_profile/js/views/learner_profile_view.js index 006ba60b12..9c9e8704da 100644 --- a/openedx/features/learner_profile/static/learner_profile/js/views/learner_profile_view.js +++ b/openedx/features/learner_profile/static/learner_profile/js/views/learner_profile_view.js @@ -1,4 +1,4 @@ -(function(define) { +(function (define){ 'use strict'; define( @@ -7,10 +7,10 @@ 'common/js/components/views/tabbed_view', 'learner_profile/js/views/section_two_tab' ], - function(gettext, $, _, Backbone, HtmlUtils, TabbedView, SectionTwoTab) { + function (gettext, $, _, Backbone, HtmlUtils, TabbedView, SectionTwoTab){ var LearnerProfileView = Backbone.View.extend({ - initialize: function(options) { + initialize: function (options){ var Router; this.options = _.extend({}, options); _.bindAll(this, 'showFullProfile', 'render', 'renderFields', 'showLoadingError'); @@ -23,7 +23,7 @@ this.firstRender = true; }, - showFullProfile: function() { + showFullProfile: function () { var isAboveMinimumAge = this.options.accountSettingsModel.isAboveMinimumAge(); if (this.options.ownProfile) { return isAboveMinimumAge @@ -33,14 +33,14 @@ } }, - setActiveTab: function(tab) { + setActiveTab: function (tab){ // This tab may not actually exist. if (this.tabbedView.getTabMeta(tab).tab) { this.tabbedView.setActiveTab(tab); } }, - render: function() { + render: function (){ var tabs, $tabbedViewElement, $wrapperProfileBioElement = this.$el.find('.wrapper-profile-bio'), @@ -77,9 +77,9 @@ ]; // Build the accomplishments Tab and fill with data - this.options.badgeListContainer.collection.fetch().done(function() { + this.options.badgeListContainer.collection.fetch().done(function (){ self.options.badgeListContainer.render(); - }).error(function() { + }).error(function (){ self.options.badgeListContainer.renderError(); }); @@ -107,20 +107,21 @@ Backbone.history.start(); } } else { - if(this.isCoppaCompliant()) + if (this.isCoppaCompliant()) { // xss-lint: disable=javascript-jquery-html $wrapperProfileBioElement.html(this.sectionTwoView.render().el); + } } return this; }, - isCoppaCompliant: function() { - var enableCoppaCompliance = this.options.accountSettingsModel.get('enable_coppa_compliance'), - isAboveAge = this.options.accountSettingsModel.isAboveMinimumAge(); - return !enableCoppaCompliance || (enableCoppaCompliance && isAboveAge); + isCoppaCompliant: function (){ + var enableCoppaCompliance = this.options.accountSettingsModel.get('enable_coppa_compliance'), + isAboveAge = this.options.accountSettingsModel.isAboveMinimumAge(); + return !enableCoppaCompliance || (enableCoppaCompliance && isAboveAge); }, - renderFields: function() { + renderFields: function (){ var view = this, fieldView, imageView, @@ -149,14 +150,14 @@ imageView = this.options.profileImageFieldView; this.$('.profile-image-field').append(imageView.render().el); - if (this.showFullProfile()) { - _.each(this.options.sectionOneFieldViews, function(childFieldView) { + if (this.showFullProfile()){ + _.each(this.options.sectionOneFieldViews, function (childFieldView) { view.$('.profile-section-one-fields').append(childFieldView.render().el); }); } }, - showLoadingError: function() { + showLoadingError: function (){ this.$('.ui-loading-indicator').addClass('is-hidden'); this.$('.ui-loading-error').removeClass('is-hidden'); } diff --git a/pavelib/paver_tests/test_stylelint.py b/pavelib/paver_tests/test_stylelint.py index f61bc9ffb0..3e1c79c93f 100644 --- a/pavelib/paver_tests/test_stylelint.py +++ b/pavelib/paver_tests/test_stylelint.py @@ -17,19 +17,20 @@ class TestPaverStylelint(PaverTestCase): Tests for Paver's Stylelint tasks. """ @ddt.data( - [0, False], - [99, False], - [100, True], + [False], + [True], ) @ddt.unpack - def test_run_stylelint(self, violations_limit, should_pass): + def test_run_stylelint(self, should_pass): """ Verify that the quality task fails with Stylelint violations. """ - _mock_stylelint_violations = MagicMock(return_value=100) - with patch('pavelib.quality._get_stylelint_violations', _mock_stylelint_violations): - if should_pass: - call_task('pavelib.quality.run_stylelint', options={"limit": violations_limit}) - else: + if should_pass: + _mock_stylelint_violations = MagicMock(return_value=0) + with patch('pavelib.quality._get_stylelint_violations', _mock_stylelint_violations): + call_task('pavelib.quality.run_stylelint') + else: + _mock_stylelint_violations = MagicMock(return_value=100) + with patch('pavelib.quality._get_stylelint_violations', _mock_stylelint_violations): with pytest.raises(SystemExit): - call_task('pavelib.quality.run_stylelint', options={"limit": violations_limit}) + call_task('pavelib.quality.run_stylelint') diff --git a/pavelib/quality.py b/pavelib/quality.py index c835bdf56e..00c5ab76cc 100644 --- a/pavelib/quality.py +++ b/pavelib/quality.py @@ -375,14 +375,14 @@ def run_stylelint(options): Runs stylelint on Sass files. If limit option is passed, fails build if more violations than the limit are found. """ - violations_limit = int(getattr(options, 'limit', -1)) + violations_limit = 0 num_violations = _get_stylelint_violations() # Record the metric _write_metric(num_violations, (Env.METRICS_DIR / "stylelint")) # Fail if number of violations is greater than the limit - if num_violations > violations_limit > -1: + if num_violations > violations_limit: fail_quality( 'stylelint', "FAILURE: Stylelint failed with too many violations: ({count}).\nThe limit is {violations_limit}.".format( diff --git a/scripts/delete-mongo-test-dbs.js b/scripts/delete-mongo-test-dbs.js index 9d0e8163a3..05d12e827f 100644 --- a/scripts/delete-mongo-test-dbs.js +++ b/scripts/delete-mongo-test-dbs.js @@ -11,7 +11,7 @@ but ignore other databases. String.prototype.startsWith = function(substring) { - return (this.indexOf(substring) == 0); + return (this.indexOf(substring) === 0); }; var dbNameList = db.getMongo().getDBNames(); diff --git a/scripts/generic-ci-tests.sh b/scripts/generic-ci-tests.sh index c444c850a9..fe01c4338c 100755 --- a/scripts/generic-ci-tests.sh +++ b/scripts/generic-ci-tests.sh @@ -131,7 +131,7 @@ case "$TEST_SUITE" in echo "Finding ESLint violations and storing report..." run_paver_quality run_eslint -l $ESLINT_THRESHOLD || { EXIT=1; } echo "Finding Stylelint violations and storing report..." - run_paver_quality run_stylelint -l $STYLELINT_THRESHOLD || { EXIT=1; } + run_paver_quality run_stylelint || { EXIT=1; } echo "Running xss linter report." run_paver_quality run_xsslint -t $XSSLINT_THRESHOLDS || { EXIT=1; } if [[ ! -z "$TARGET_BRANCH" ]]; then diff --git a/scripts/thresholds.sh b/scripts/thresholds.sh index f0bc5c6608..a2045763c1 100755 --- a/scripts/thresholds.sh +++ b/scripts/thresholds.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash set -e -export ESLINT_THRESHOLD=5300 -export STYLELINT_THRESHOLD=880 +export ESLINT_THRESHOLD=4950