Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump rubocop to 0.37.2 #48

Merged
merged 8 commits into from
Feb 11, 2016
Merged

Bump rubocop to 0.37.2 #48

merged 8 commits into from
Feb 11, 2016

Conversation

jpignata
Copy link
Contributor

@codeclimate/review

@jpignata jpignata mentioned this pull request Jan 31, 2016
@jpignata
Copy link
Contributor Author

Broke the camel's back in CC::Engine::Rubocop, apparently.

@wfleming
Copy link
Contributor

I'm ok with ignoring that line count if you want to, but I also see a fairly easy extraction: this class right now covers all of:

  1. Walking include_paths for files to analyze
  2. Getting analysis results on those file from Rubocop
  3. Formatting said results as Issue JSON to emit on stdout.

Item 3 by itself is ~35 lines, and feels like a distinct responsibility that we already organize as its own class in other engines. Personally, that's where I'd make the change.

@jpignata
Copy link
Contributor Author

@wfleming Nah, we should fix it. It does way too much. I'm extracting things from it now but in doing so I'm also seeing language that doesn't align with our domain very well and a lack of coverage around fiddly bits like remediation point generation. I want to spend a bit more time tackling those issues before requesting re-review.

@jpignata jpignata force-pushed the jp/upgrade-rubocop branch 5 times, most recently from 333b7d8 to e85e236 Compare February 1, 2016 03:33
@jpignata
Copy link
Contributor Author

jpignata commented Feb 1, 2016

@wfleming Ready for 👀 when you have a sec.

@jpignata
Copy link
Contributor Author

jpignata commented Feb 1, 2016

Interestingly they've deprecated one of the cops and if referenced in the rubocop.yml, the anaysis will fial:

Running rubocop: Done!
error: (CC::Analyzer::Engine::EngineFailure) engine rubocop failed with status 1 and stderr 
/usr/lib/ruby/gems/2.2.0/gems/rubocop-0.36.0/lib/rubocop/config.rb:250:in `reject_obsolete_cops': The `Style/TrailingComma` cop no longer exists. Please use `Style/TrailingCommaInLiteral` and/or `Style/TrailingCommaInArguments` instead. (RuboCop::ValidationError)
(configuration found in /code/.rubocop.yml)

Our default configuration references Style/TrailingComma.

@jpignata
Copy link
Contributor Author

jpignata commented Feb 1, 2016

The Code Climate issues are due to changing cop names (Style/MultilineOperationIndentation and Style/TrailingComma).

Code Climate triggered a warning that this class was too large and
looking closely it seems to have several different responsibilities
mixed together. At the same time, a lot of the language used in this
engine doesn't match the language of how we talk about our domain.

These changes aim to break down the Rubocop class into collaborators
and to refine the language to bring its concerns closer to our
domain language.

* Introduce SourceFile
* Rename ViolationDecorator to Issue
* Move presentation concerns into Issue
* Refine remediation point names to better match what they represent
* Begin to improve coverage on remediation point generation
@wfleming
Copy link
Contributor

wfleming commented Feb 1, 2016

This looks good to me. If we can get the updated default config out, I'd say ship it.

@jpignata
Copy link
Contributor Author

jpignata commented Feb 1, 2016

Going to let this sit for a bit until the larger CLI change is out.

On Mon, Feb 1, 2016 at 11:12 AM, Will Fleming [email protected]
wrote:

This looks good to me. If we can get the updated default config out, I'd
say ship it.


Reply to this email directly or view it on GitHub
#48 (comment)
.

@ABaldwinHunter
Copy link
Contributor

Hm, surprised by CC issues; I thought we prefer including a comma after last item in hash.

@wfleming
Copy link
Contributor

wfleming commented Feb 2, 2016

@ABaldwinHunter I believe it's because JP updated the config for the new version, but of course that new version isn't actually running against the repo yet. The new version changed several rule names.

Instead of raising on the inclusion of an obsolete cop, write an error
to STDERR. This is slightly more invisible than failing a build on an
obsolete cop, but preferable as a user won't be blocked when we bump
RuboCop on our engine. We'll write a changelog post advising users of
the necessary changes to make and deprecate this patch in the coming
weeks.
@jpignata jpignata force-pushed the jp/upgrade-rubocop branch 3 times, most recently from 406c281 to 0e05f0b Compare February 11, 2016 03:48
@jpignata jpignata changed the title Bump rubocop to 0.36.0 Bump rubocop to 0.37.1 Feb 11, 2016
@jpignata
Copy link
Contributor Author

This is ready for another look, @codeclimate/review.

@gdiggs
Copy link
Contributor

gdiggs commented Feb 11, 2016

LGTM

@wfleming
Copy link
Contributor

From a quick reading of recent changes in whitequark/parser, and confirming that we are on the most recent version of that gem now, I think this might give us support for Ruby 2.3 syntax. Worth testing a bit more specifically to see if that's worth promoting on release.

@jpignata
Copy link
Contributor Author

It does give us support for Ruby 2.3 syntax. I'll merge this once I have a
changelog draft.

On Thu, Feb 11, 2016 at 1:29 PM, Will Fleming [email protected]
wrote:

From a quick reading of recent changes in whitequark/parser, and
confirming that we are on the most recent version of that gem now, I
think this might give us support for Ruby 2.3 syntax. Worth testing a
bit more specifically to see if that's worth promoting on release.


Reply to this email directly or view it on GitHub
#48 (comment)
.

@wfleming
Copy link
Contributor

🎆

@ABaldwinHunter
Copy link
Contributor

@jpignata nice work! reminder to update doc in addition to changelog once all set.

@jpignata jpignata changed the title Bump rubocop to 0.37.1 Bump rubocop to 0.37.2 Feb 11, 2016
jpignata added a commit that referenced this pull request Feb 11, 2016
@jpignata jpignata merged commit fcfe222 into master Feb 11, 2016
@jpignata jpignata deleted the jp/upgrade-rubocop branch February 11, 2016 21:31
@rheaton
Copy link

rheaton commented Feb 12, 2016

Was this just deployed? Rubocop upgrade breaks older rubocop.yml (we see analysis errors now)

@rheaton
Copy link

rheaton commented Feb 12, 2016

P.S. hi JP. 👋

@jpignata
Copy link
Contributor Author

Hey, @rheaton! Yes, we just deployed this earlier this afternoon. Some configuration syntax moved around between the RuboCop versions which require some tweaks to your config. If you check the build itself, the STDERR output should detail the changes necessary. Can you let me know if you see this output and if it's helpful?

@rheaton
Copy link

rheaton commented Feb 12, 2016

Yes, we see it! It's slow going through since it's one error at a time. Any suggestions?

(PS My teammate @MisterDeejay is working on this)

@jpignata
Copy link
Contributor Author

It's probably giving you separate tranches of output for each of RuboCop's validations. I'd either use the Code Climate CLI or install RuboCop 0.37.2 locally and tweak your configuration there before re-pushing.

@rheaton
Copy link

rheaton commented Feb 12, 2016

@jpignata Thanks!

@jpignata
Copy link
Contributor Author

@rheaton Sorry for the trouble!

@rheaton
Copy link

rheaton commented Feb 12, 2016

NP! We were actually bemoaning that it was an older version of rubocop this morning. 😁 Love those Friday deploys, haha. :trollface:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants