jenkins-bot has submitted this change and it was merged. Change subject: Enable rubocop ......................................................................
Enable rubocop With config copied from wikidata/browsertests.git and fix complaints. Change-Id: I853188f7271507155768f1b03fc751b656861c5b --- M .rubocop.yml A .rubocop_todo.yml M Rakefile M tests/browser/features/support/env.rb 4 files changed, 59 insertions(+), 11 deletions(-) Approvals: Jonas Kress (WMDE): Looks good to me, approved jenkins-bot: Verified diff --git a/.rubocop.yml b/.rubocop.yml index 5d8088c..430f3ae 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1 +1,23 @@ # See https://www.mediawiki.org/wiki/Manual:Coding_conventions/Ruby +inherit_from: .rubocop_todo.yml + +AllCops: + StyleGuideCopsOnly: true + +Metrics/MethodLength: + Enabled: false + +Style/Alias: + Enabled: false + +Style/SignalException: + Enabled: false + +Style/TrivialAccessors: + ExactNameMatch: true + +Style/StringLiterals: + EnforcedStyle: single_quotes + +Style/AsciiComments: + Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 0000000..e0ab40e --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,26 @@ +# This configuration was generated by `rubocop --auto-gen-config` +# on 2014-11-13 12:15:50 +0100 using RuboCop version 0.27.1. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 164 +# Configuration parameters: AllowURI, URISchemes. +Metrics/LineLength: + Max: 465 + +# Offense count: 2 +# Configuration parameters: MinBodyLength. +Style/GuardClause: + Enabled: false + +# Offense count: 9 +# Configuration parameters: MaxLineLength. +Style/IfUnlessModifier: + Enabled: false + +# Offense count: 1 +# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles. +Style/Next: + Enabled: false \ No newline at end of file diff --git a/Rakefile b/Rakefile index fb102b2..6eef121 100644 --- a/Rakefile +++ b/Rakefile @@ -11,4 +11,4 @@ task default: [:test] desc 'Run all build/tests commands (CI entry point)' -task test: [] # TODO add :rubocop after files where moved from WikidataBrowsertests +task test: [:rubocop] diff --git a/tests/browser/features/support/env.rb b/tests/browser/features/support/env.rb index ce50a8a..4a42f8f 100644 --- a/tests/browser/features/support/env.rb +++ b/tests/browser/features/support/env.rb @@ -21,24 +21,24 @@ lenv = MediawikiSelenium::Environment.load_default # this used config/config.yml before TODO remove when everything is migrated ENV['WIKIDATA_REPO_URL'] = lenv.lookup(:mediawiki_url) -ENV['WIKIDATA_REPO_API'] = lenv.lookup(:mediawiki_url_api, default: -> { +ENV['WIKIDATA_REPO_API'] = lenv.lookup(:mediawiki_url_api, default: lambda do lenv.lookup(:mediawiki_url) - .gsub(/wiki\/$/, "w/api.php") - .gsub(/index.php\/?$/, "api.php") -}) -#TODO use user_factory instead -#ENV['WB_REPO_USERNAME'] = lenv.lookup(:mediawiki_user) + .gsub(%r{wiki/$}, 'w/api.php') + .gsub(%r{index.php/?$}, 'api.php') +end) +# TODO: use user_factory instead +# ENV['WB_REPO_USERNAME'] = lenv.lookup(:mediawiki_user) ENV['ITEM_NAMESPACE'] = lenv.lookup(:item_namespace, default: -> { '' }) ENV['PROPERTY_NAMESPACE'] = lenv.lookup(:property_namespace, default: -> { 'Property:' }) ENV['ITEM_ID_PREFIX'] = lenv.lookup(:item_id_prefix, default: -> { 'Q' }) ENV['PROPERTY_ID_PREFIX'] = lenv.lookup(:property_id_prefix, default: -> { 'P' }) ENV['LANGUAGE_CODE'] = lenv.lookup(:language_code, default: -> { 'en' }) -#require_all 'features/support/modules' +# require_all 'features/support/modules' require_all 'features/support/pages' -#require_all 'features/support/utils' +# require_all 'features/support/utils' -# TODO remove once everything is migrated +# TODO: remove once everything is migrated Before('@repo_login') do abort('WB_REPO_USERNAME environment variable is not defined! Please export a value for that variable before proceeding.') unless ENV['WB_REPO_USERNAME'] abort('WB_REPO_PASSWORD environment variable is not defined! Please export a value for that variable before proceeding.') unless ENV['WB_REPO_PASSWORD'] @@ -46,7 +46,7 @@ PageObject.default_element_wait = 10 # increased to avoid fails on saucelabs -# TODO find out if this is still needed? is there a real fix wait on it happening instead of sleeping? move this into one of the gems if this is needed, as other can benefit +# TODO: find out if this is still needed? is there a real fix wait on it happening instead of sleeping? move this into one of the gems if this is needed, as other can benefit unless (env_no = ENV['TEST_ENV_NUMBER'].to_i).zero? sleep env_no * 4 # sleep time to give webdriver time to setup end -- To view, visit https://gerrit.wikimedia.org/r/289869 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I853188f7271507155768f1b03fc751b656861c5b Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: JanZerebecki <[email protected]> Gerrit-Reviewer: Adrian Heine <[email protected]> Gerrit-Reviewer: Jonas Kress (WMDE) <[email protected]> Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
