Page MenuHomePhabricator

Document RuboCop workflow
Closed, ResolvedPublic

Description

  • how to set it up for a repository
bundle exec rubocop --auto-gen-config
  • how to make rubocop run after every patch set submission to gerrit
  • how to solve problems from the autogenerated todo file one by one

Details

Commits
Unknown Object (Diffusion Commit)

Event Timeline

zeljkofilipin updated the task description. (Show Details)
zeljkofilipin raised the priority of this task from to Normal.
zeljkofilipin claimed this task.
zeljkofilipin changed Security from none to None.
zeljkofilipin added a subscriber: zeljkofilipin.
zeljkofilipin added a comment.EditedFeb 28 2015, 11:51 AM

I wrote a blog post recently with generic RuboCop workflow, not specific to Wikimedia.

http://filipin.eu/rubocop/

I still have to document Wikimedia specific things.

Diffusion added a commit: Unknown Object (Diffusion Commit).Mar 4 2015, 8:23 AM
zeljkofilipin removed zeljkofilipin as the assignee of this task.Mar 27 2015, 11:41 AM

Looks like all that needs to be done if you want to run ruby syntax check and rubocop for a mediawiki extension is to run extension-rubylint Zuul template.

Code:

# Template for MediaWiki extensions.
# Run Ruby linter.
- name: extension-rubylint
  check:
   - 'ruby1.9.3lint'
  test:
   - 'bundle-rubocop'
   - 'ruby1.9.3lint'
  gate-and-submit:
   - 'bundle-rubocop'
   - 'ruby1.9.3lint'

Example:

- name: mediawiki/extensions/ArticleFeedbackv5
  template:
    - name: extension-checks
    - name: extension-rubylint
hashar added a subscriber: hashar.Mar 31 2015, 1:44 PM

Feel free to add a step by step tutorial for ruby repositories, we have a few already: https://www.mediawiki.org/wiki/Continuous_integration/Tutorials . Though it should cover more than rubocop, see parent task T1361.

If the repository is not a mediawiki extension, then add only ruby1.9.3lint job to check , and both bundle-rubocop and ruby1.9.3lint jobs to test and gate-and-submit.

Example:

- name: mediawiki/ruby/api
  check:
   - ruby1.9.3lint
  test:
   - bundle-rubocop
   - ruby1.9.3lint
   - bundle-rspec
   - mediawiki-ruby-api-gembuild
   - bundle-yard
  gate-and-submit:
   - bundle-rubocop
   - ruby1.9.3lint
   - bundle-rspec
   - mediawiki-ruby-api-gembuild
   - bundle-yard
  postmerge:
   - mediawiki-ruby-api-gembuild
   - mediawiki-ruby-api-bundle-yard-publish

Not working on this. I plan to continue with this later, but feel free to take the task.

zeljkofilipin removed zeljkofilipin as the assignee of this task.Apr 8 2015, 10:00 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 24 2015, 5:58 AM
hashar closed this task as Resolved.Oct 28 2015, 2:07 PM
hashar claimed this task.

We have moved to use rake as an entry point. It is described on https://www.mediawiki.org/wiki/Continuous_integration/Entry_points#Ruby which seems to be good enough as a documentation for now. Ie one would run rake rubocop.