Skip to content

Tune RUBY remediation points to match Classic #67

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

Merged
merged 1 commit into from
Dec 30, 2015

Conversation

ABaldwinHunter
Copy link
Contributor

Changes include:

  • Refactor calculate_points method to be purview of language,
    not Violation - to permit independent calculation formulas
  • Increase ruby BASE_POINTS
  • Change calculation formula from
    • base_points * issue.mass_threshold
      to
    • base_points + overage * points_per

Rubric in classic for Ruby:
https://github.com/codeclimate/analyzer/blob/master/lib/quality/rubric.rb#L12c

Updates for other languages to come post additional language-specific tuning

replaces https://github.com/codeclimate/codeclimate-duplication/pull/61/files
@codeclimate/review
@brynary

@ABaldwinHunter ABaldwinHunter force-pushed the abh-points-ruby-only branch 2 times, most recently from deff4fc to 6688279 Compare December 30, 2015 22:05
def initialize(base_points, issue, hashes)
@base_points = base_points
def initialize(language, issue, hashes)
@language = language
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would calling this either strategy or language_strategy better match the variable passed in?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand the reasoning behind language_strategy instead of language?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main issue for me is the inconsistency. We're passing in an object named language_strategy in lib/cc/engine/analyzers/reporter.rb but assigning it internally within Violation as language. We should probably stick with one name.

It seems like what we're passing in, based on the methods called on the object, is more like a strategy (or configuration) than a "language".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is, I agree that strategy would be in keeping with the argument passed in, but I think the original name is a bit confusing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, is this object always a subclass of CC::Engine::Analyzers::Base?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, missed your second comment before.

I'm super loathe to use strategy but will change it to language_strategy if you feel strongly. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now seeing that comment. Yes it is

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then what do you think of using the name analyzer anywhere that language or language_strategy is currently used? That might clear up the confusion.

Edit: Or clean up the conflicting naming in a separate commit / PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's outside the scope of this PR and would advocate changing the naming in a separate refactor soon to follow.

wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good 👍

@dblandin
Copy link
Contributor

@ABaldwinHunter This change looks good to me. Easy to follow 👍

Just a few minor nits.

Are we intending to support independent point calculations in the long term or will we eventually standardize cross-language with base_points + (overage * points_per_overage)?

@dblandin
Copy link
Contributor

One other question about your PR description. Is the current calculation base_points * issue.mass_threshold or base_points * issue.mass? Seems to be the ladder from this deletion.

@ABaldwinHunter
Copy link
Contributor Author

@dblandin Thanks for feedback!

I think we are going to move to base_points + (overage * points_per) for all languages v soon.

For ruby, the formula is
base_points + overage * points_per

Ruby::Main overwrites the inherited calculate_points.

@ABaldwinHunter ABaldwinHunter force-pushed the abh-points-ruby-only branch 2 times, most recently from b6581fa to 80e7ea1 Compare December 30, 2015 22:47
Changes include:
- Refactor `calculate_points` method to be purview of language,
not `Violation` - to permit independent calculation formulas
- Increase ruby `BASE_POINTS`
- Change calculation formula from
    - `base_points * issue.mass_threshold`
  to
   - `base_points + overage * points_per`

Rubric in classic for Ruby:
https://github.com/codeclimate/analyzer/blob/master/lib/quality/rubric.rb#L12c

Updates for other languages to come post additional language-specific tuning
@ABaldwinHunter
Copy link
Contributor Author

Updates in place!

def engine_conf
CC::Engine::Analyzers::EngineConfig.new({})
def engine_conf
EngineConfig.new({})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably small enough now to inline on L62.

@dblandin
Copy link
Contributor

Looking good 👍

ABaldwinHunter pushed a commit that referenced this pull request Dec 30, 2015
Tune RUBY remediation points to match Classic
@ABaldwinHunter ABaldwinHunter merged commit 67b9919 into master Dec 30, 2015
@ABaldwinHunter ABaldwinHunter deleted the abh-points-ruby-only branch December 30, 2015 23:07
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.

2 participants