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

A GeneralRule class rule is not passed an object with a type attribute #31

Closed
jaloren opened this issue Jun 1, 2015 · 1 comment
Closed

Comments

@jaloren
Copy link

jaloren commented Jun 1, 2015

I tried to define a GeneralRule class. According to the documentation here, this means I will be passed a RobotFile class when the apply method defined in the class is executed.
https://github.com/boakley/robotframework-lint/wiki/The-GeneralRule-class

According to the documentation here, the RobotFile class is super class of SuiteFile and ResourceFile
https://github.com/boakley/robotframework-lint/wiki/The-RobotFile-class

Both the SuiteFile and ResourceFile classes have the type attribute which indicate whether its a resource or test suite. My expectation would be that in a GeneralRule class, the RobotFile object would have a type attribute that can be inspected to find out if the object is a SuiteFile or ResourceFile.

However, when I access the type attribute, I get the following exception:

SettingTable' object has no attribute 'type'

Here's an example class.

class ImportLibraryInResource(GeneralRule):
    severity = ERROR

    def configure(self, jsonfile):
        self.jsonfn = jsonfile
        self.allowed_libs = json.load(open(jsonfile,'r'))

    def apply(self,RobotFile):
        print RobotFile.type
boakley pushed a commit that referenced this issue Jun 3, 2015
@boakley
Copy link
Owner

boakley commented Jul 21, 2015

This will be available in the next release (0.6)

@boakley boakley closed this as completed Jul 21, 2015
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

No branches or pull requests

2 participants