Skip to content
This repository has been archived by the owner on Sep 19, 2020. It is now read-only.

add checks for correct use of use_inline_resources #402

Merged
merged 1 commit into from
Nov 6, 2015

Conversation

lamont-granquist
Copy link
Contributor

  • recommend use_inline_resource in all 'LWRPBase' providers
  • catch the use of use_inline_resources when users are also declaring
    def action_whatever instead of action :whatever which defeats
    use_inline_resources

@coderanger
Copy link
Contributor

👍 as it is restricted to LWRPBase-based things.

@lamont-granquist
Copy link
Contributor Author

Yeah, I'm certainly intending to only target the bodies of classes that inherit from Providers::LWRPBase, we'll have to see how buggy my Ruby AST XPath parsing foo is -- but it does have a test that it avoids the simple case of a library file with only a resource in it, which does not declare use_inline_resources and ignores that. I'm not sure I could actually do any 'better' than that, since we're doing static analysis.

There might be edge cases where an abstract base class inherits from LWRPBase but doesn't declare use_inline_resources, even though all the subclasses do, but I think the solution there is to either move use_inline_resources up to the baseclass or else just comment out the FC rule.

@lamont-granquist
Copy link
Contributor Author

@jaymzh @tas50 etc got any thoughts to add about this one?

@@ -0,0 +1,25 @@
Feature: Check for LWRP providers that do not declare use_inline_resources
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this description didn't get filled out

@philoserf
Copy link

I approve AND I prefer on rule per Pull Request.

👍

- recommend use_inline_resource in all 'LWRPBase' providers
- catch the use of use_inline_resources when users are also declaring
  `def action_whatever` instead of `action :whatever` which defeats
  use_inline_resources
@lamont-granquist lamont-granquist force-pushed the lcg/correct-use-inline-resources branch from b429d3c to 4728af6 Compare November 6, 2015 17:17
@lamont-granquist
Copy link
Contributor Author

rebased, squashed, fixed the merge conflicts over the numbering...

lamont-granquist added a commit that referenced this pull request Nov 6, 2015
add checks for correct use of use_inline_resources
@lamont-granquist lamont-granquist merged commit 5251b93 into master Nov 6, 2015
@lamont-granquist lamont-granquist deleted the lcg/correct-use-inline-resources branch November 6, 2015 17:19
@acrmp acrmp added the Feature label Nov 12, 2015
@tas50 tas50 added Enhancements and removed Feature labels Jan 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants